Qore Swagger Module Reference 2.2.3
Loading...
Searching...
No Matches
Swagger.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* Swagger.qm Copyright (C) 2017 - 2024 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25
26// make sure we have the required qore version
27
28// try importing JSON and YAML modules
29
30
31
32
33
34
259namespace Swagger {
266
268const LM_LAX_COLLECTIONFORMAT = (1 << 1);
269
272
275
277const LM_AUTO_FORM_DATA = (1 << 4);
278
281
284
286const LM_ACCEPT_QUERY_OBJECTS = (1 << 7);
287
289const LM_IGNORE_INVALID_PATHS = (1 << 8);
290
292const LM_ALL = ...;
293
295
297const ValidIntFormats = ("int32", "int64", "unix-time");
299const ValidNumberFormats = ("double", "float");
301const ValidStringFormats = ("binary", "byte", "date", "password", "unix-time");
302
305
306
309
310
312const ValidIntFormatsHash = map {$1: True}, ValidIntFormats;
317
320
321
322const JsonSerialization = ...;
323
324
326const MimeDataTypes = ...;
327
328
330const SerializationModules = keys (map {$1.module: True}, MimeDataTypes.iterator(), $1.module);
331
334
336const ValidSchemes = ("http", "https", "ws", "wss");
337const ValidSchemesHash = map {$1: True}, ValidSchemes;
338
341
342public:
344
349
352
353
355
358 constructor(hash<auto> oh);
359
360
363
364
366
369 initialize(hash<auto> oh);
370};
371
374
375public:
377 *float maximum;
378
380 *float minimum;
381
384
387
390
393
395 *string pattern;
396
399
402
405
407
410 hash<string, bool> enum;
411
414
416
419 constructor(string objType, hash<auto> oh);
420
421
424
425
427protected:
428 auto getExampleValueWithFormat(string type, *string format, *string fname);
429public:
430
431
433protected:
434 check(bool serialize, bool request, string type, *string format, *SchemaObject items, string path, string method, string name, reference<auto> value);
435public:
436
437
438protected:
439 checkStringIntern(string path, string method, string name, string value);
440public:
441
442
443protected:
444 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, list<auto> v, reference<list> value);
445public:
446
447
448protected:
449 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash<auto> v, reference<hash> value);
450public:
451
452
453protected:
454 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, int v, reference<auto> value);
455public:
456
457
458protected:
459 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, number v, reference<number> value);
460public:
461
462
463protected:
464 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, float v, reference<number> value);
465public:
466
467
468protected:
469 checkInternNumber(bool serialize, bool request, string type, *string format, string path, string method, string name, auto v, reference<auto> value);
470public:
471
472
474protected:
475 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, binary v, reference value);
476public:
477
478
480protected:
481 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, string v, reference<auto> value);
482public:
483
484
486protected:
487 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, date v, reference<auto> value);
488public:
489
490
491protected:
492 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, bool v, reference<bool> value);
493public:
494
495
496protected:
497 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
498public:
499
500
502protected:
503 checkArrayParam(bool serialize, bool request, SchemaObject items, string path, string method, string name, reference<list<auto>> value);
504public:
505
506
508protected:
509 static throwInvalidType(string name, string actual, string expected, auto value);
510public:
511
512
514
516 static bool checkValueType(reference<auto> value, string type);
517};
518
521
522public:
524
533 static SwaggerSchema fromString(string swaggerSpecification, *bool json, *hash<auto> opts);
534
536
545 static SwaggerSchema fromFile(string filepath, *hash<auto> opts);
546
548
560 static SwaggerSchema fromUrl(string url, *bool json, *hash<auto> opts);
561
563
572 static hash<auto> parseSchemaContent(string filepath, string str);
573
575 static hash<auto> parseSchemaSource(string str, string ser);
576
578 static string detectSourceEncoding(string str);
579};
580
583
584public:
586
589 hash<string, AbstractParameterObject> parameters();
590
592 string query_obj;
593
595 constructor(hash<auto> oh) ;
596
597
600
601
604
605};
606
608class SwaggerSchema : public ParameterGroup, public AbstractRestSchemaValidator {
609
610public:
612
617
620
623
625
631 *string host;
632
634
639 *string basePath;
640
642
647 hash<string, bool> schemes;
648
650
654 hash<string, bool> consumes;
655
657
661 hash<string, bool> produces;
662
664
667 hash<string, SchemaObject> definitions();
668
670
673 hash<string, ResponseObject> responses;
674
676
679 hash<string, SecuritySchemeObject> securityDefinitions;
680
682
693 hash<string, softlist<string>> security;
694
696
705 list<TagObject> tags;
706
708 hash<auto> store;
709
712
714
724 const SwaggerOptions = ...;
725
726
727protected:
730
732 *string def_path;
733
735
738
740 string hash_str;
741
744
746 *softbool utc_dates;
747
750
752 hash<string, hash<string, SchemaObject>> so_map;
753
755 hash<string, hash<string, AbstractDataProviderType>> typemap;
756
757public:
758
759private:
762
763public:
764
766
778 constructor(string schema_source, hash<auto> oh, *hash<auto> opts) ;
779
780
782
794 constructor(LoggerInterface logger, string schema_source, hash<auto> oh, *hash<auto> opts) ;
795
796
798protected:
799 constructorIntern(string schema_source, hash<auto> oh, *hash<auto> opts);
800public:
801
802
803 *int getParseFlags();
804
805
806 *bool getUtcDates();
807
808
809 *string getQueryDateFormat();
810
811
812 *SchemaObject tryGetSchemaObject(string name, hash<auto> oh, reference<string> hash_str);
813
814
815 cacheSchemaObject(string name, string hash_str, SchemaObject so);
816
817
819
821 SchemaObject resolveSchemaObject(string name, string refstr, hash<auto> oh);
822
823
825
827 ParameterItemsSchemaObject resolveParameterItemsSchemaObject(string name, string refstr, hash<auto> oh, *string inLoc);
828
829
831
833 AbstractParameterObject resolveParameter(string name, string refstr, hash<auto> oh);
834
835
837
839 ResponseObject resolveResponse(string name, string refstr, hash<auto> oh);
840
841
843 AbstractDataProviderType getTypeForReference(string rstr, bool required = True, *HTTPClient rest);
844
845
846 replaceTypeForReference(string rstr, AbstractDataProviderType t);
847
848
850 AbstractDataProviderType getType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True);
851
852
853protected:
854 *AbstractDataProviderType checkType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True, reference<string> id);
855public:
856
857
859protected:
860 AbstractDataProviderType getTypeIntern(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True);
861public:
862
863
865 AbstractDataProviderType getSchemaDataType(string path, SchemaObject schema, bool required = True, *HTTPClient rest);
866
867
869 AbstractDataField getFieldFromSchema(string name, *string desc, SchemaObject schema, bool required = True, *HTTPClient rest);
870
871
873 addFieldsFromParameters(HashDataType rv, hash<string, AbstractParameterObject> parameters, reference<bool> required);
874
875
877 AbstractDataField getFieldForHeaders(string name, hash<auto> headers);
878
879
881 static *AbstractDataProviderType getCacheType(reference<hash<string, AbstractDataProviderType>> h, string key);
882
884 AbstractDataField getFieldFromParameter(string path, string name, string type, *string format, *SchemaObject arrayItems, *string desc, bool required, *list<auto> allowed_values, auto default_value);
885
886
888protected:
889 addFieldsFromParametersIntern(HashDataType rv, hash<string, AbstractParameterObject> parameters, reference<bool> required);
890public:
891
892
894
898protected:
899 string getHashImpl();
900public:
901
902
904
908protected:
910public:
911
912
914
927protected:
928 hash<RestSchemaValidator::RestRequestClientInfo> processRequestImpl(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types);
929public:
930
931
933
944protected:
945 hash<RestSchemaValidator::RestRequestServerInfo> parseRequestImpl(string method, string path, *data http_body, reference<hash> headers);
946public:
947
948
950
969protected:
970 hash<HttpResponseInfo> processResponseImpl(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types);
971public:
972
973
975
985protected:
986 hash<RestSchemaValidator::RestResponseClientInfo> parseResponseImpl(string method, string path, int code, *data response_body, hash<auto> hdr);
987public:
988
989
991protected:
992 fixPath(reference<string> path);
993public:
994
995
997
999protected:
1000 hash<string, list<string>> getPathOperationHashImpl();
1001public:
1002
1003
1005
1009protected:
1011public:
1012
1013
1015
1017protected:
1019public:
1020
1021
1023
1028protected:
1029 hash<RestQoreExampleCodeInfo> getQoreExampleRequestImpl(string method, string path);
1030public:
1031
1032
1034
1040protected:
1041 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequestImpl(string method, string path, *softlist<string> content_types);
1042public:
1043
1044
1046
1052protected:
1053 hash<RestQoreExampleCodeInfo> getQoreExampleResponseImpl(string method, string path, int code);
1054public:
1055
1056
1058
1065protected:
1066 hash<RestExampleResponseInfo> getExampleResponseImpl(string method, string path, int code, *softlist<string> content_types);
1067public:
1068
1069
1071
1073protected:
1074 hash<auto> getExternalReference(string refstr);
1075public:
1076
1077
1079
1083protected:
1084 AbstractDataProvider getDataProviderImpl(HTTPClient rest);
1085public:
1086
1087
1089
1093protected:
1095public:
1096
1097
1099
1103protected:
1105public:
1106
1107
1109
1123private:
1124 hash<RestSchemaValidator::RestRequestClientInfo> processRequestIntern(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1125public:
1126
1127
1129
1149private:
1150 hash<HttpResponseInfo> processResponseIntern(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1151public:
1152
1153
1155
1163private:
1164 bool checkRequestContentTypeHeader(reference<hash<RestRequestClientInfo>> req, auto body, *hash<auto> headers);
1165public:
1166
1167
1169
1177private:
1178 bool checkResponseContentTypeHeader(reference<hash<HttpResponseInfo>> resp, auto body, *hash<auto> headers);
1179public:
1180
1181
1183
1190private:
1191 bool checkResponseTextPlain(reference<hash<HttpResponseInfo>> resp, auto body, hash<string, bool> mime_types, *list<auto> content_types);
1192public:
1193
1194
1196private:
1197 SchemaObject processDefinition(string key, auto value);
1198public:
1199
1200};
1201
1203class InfoObject : public ObjectBase {
1204
1205public:
1207 string title;
1208
1210 *string desc;
1211
1214
1216 string version;
1217
1220
1223
1225
1231 constructor(hash<auto> oh) ;
1232
1233};
1234
1237
1238public:
1240 *string name;
1241
1243 *string url;
1244
1246 *string email;
1247
1249
1254 constructor(hash<auto> oh) ;
1255
1256};
1257
1260
1261public:
1263 string name;
1264
1266 *string url;
1267
1269
1275 constructor(hash<auto> oh) ;
1276
1277};
1278
1280
1287
1288public:
1289protected:
1291 string pfx;
1292
1294 string name;
1295
1298
1301
1303 hash<string, PathComponent> paths;
1304
1305public:
1306
1308 constructor(hash<auto> oh, string pfx, SwaggerSchema swagger);
1309
1310
1312protected:
1313 constructor(string full_path, list<auto> l, int offset, hash<auto> oh);
1314public:
1315
1316
1318protected:
1319 add(string full_path, list<auto> l, int offset, hash<auto> oh, SwaggerSchema swagger);
1320public:
1321
1322
1324
1326 PathItemObject match(list<auto> path);
1327
1328
1330
1332 *PathItemObject tryMatch(list<auto> path);
1333
1334
1336
1338 getPathOperationHash(reference<hash<string, list<string>>> h);
1339
1340};
1341
1343class PathsObject : public ObjectBase {
1344
1345public:
1346protected:
1349
1350public:
1351
1353
1361 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1362
1363
1365
1367 PathItemObject match(string path);
1368
1369
1371
1374
1375
1377
1379 hash<string, list<string>> getPathOperationHash();
1380
1381};
1382
1384
1390
1391public:
1393
1398 *string ref;
1399
1402
1403protected:
1405
1415 hash<string, OperationObject> operations;
1416
1418 const ObjType = "Path Item";
1419
1420public:
1421
1423
1432 constructor(string path, hash<auto> oh, SwaggerSchema swagger) ;
1433
1434
1436 merge(string path, hash<auto> oh, SwaggerSchema swagger);
1437
1438
1440
1447 OperationObject getOperation(string method, string path);
1448
1449
1451
1453 softlist getMethods();
1454
1455};
1456
1459
1460public:
1462 string path;
1463
1465 string method;
1466
1468
1471 list tags;
1472
1474 *string summary;
1475
1477 *string desc;
1478
1480
1484 bool deprec = False;
1485
1488
1490
1497
1499
1504 hash<string, bool> consumes;
1505
1507
1512 hash<string, bool> produces;
1513
1515 hash<string, AbstractParameterObject> formData;
1516
1519
1522
1524
1528 list<string> schemes;
1529
1531
1543 list<hash<string, list<string>>> security;
1544
1546
1555 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1556
1557
1559 *data getRequestBody(PathItemObject pio, auto body, reference<hash<auto>> headers, *bool freeform);
1560
1561
1563
1574 validateRequest(bool serialize, PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers, *reference<hash<string, bool>> mime_types, *bool freeform);
1575
1576
1578
1588 parseRequest(PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers);
1589
1590
1592 validateResponse(string method, string path, PathItemObject pio, int http_code, reference<auto> response_body, reference<hash<string, bool>> mime_types, bool deserialize = True);
1593
1594
1596
1604 hash<RestQoreExampleCodeInfo> getQoreExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger);
1605
1606
1608
1617 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger, reference rbody);
1618
1619
1621
1628 hash<RestQoreExampleCodeInfo> getQoreExampleResponse(string method, string path, int code);
1629
1630
1632
1640 hash<RestExampleResponseInfo> getExampleResponse(string method, string path, int code, reference<auto> body);
1641
1642
1643protected:
1644 getQoreExampleParams(reference<hash<auto>> query, reference<hash<auto>> headers, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1645public:
1646
1647
1649protected:
1650 doDefaultParams(reference<hash<UriQueryInfo>> h, reference<hash> headers, reference<auto> body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1651public:
1652
1653
1655protected:
1656 checkMissingParams(hash<UriQueryInfo> h, *hash<auto> headers, auto body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1657public:
1658
1659
1661
1663protected:
1665public:
1666
1667
1669protected:
1670 error(string err, string fmt, ...);
1671public:
1672
1673};
1674
1677
1678public:
1680 *string desc;
1681
1683 string url;
1684
1686
1692 constructor(hash<auto> oh) ;
1693
1694};
1695
1697
1734
1735public:
1737
1744 string name;
1745
1747
1750 string inLoc;
1751
1753 *string desc;
1754
1756
1761 bool required = False;
1762
1763protected:
1764 const OtherParameterMap = ...;
1765
1766
1767public:
1768
1770
1777 constructor(hash<auto> oh, *int opt_flags) ;
1778
1779
1781 abstract check(bool serialize, bool request, string path, string method, string name, reference value);
1782
1785
1786
1788 static AbstractParameterObject newParameter(string name, hash<auto> oh, SwaggerSchema swagger);
1789};
1790
1793
1794public:
1797
1799
1806 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1807
1808
1810 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
1811
1812
1814 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv);
1815
1816
1817 // returns an example value for a REST API call
1821 auto getExampleValue(*hash<string, bool> emap, *string fname);
1822
1823};
1824
1827
1828public:
1830
1840 string type;
1841
1843 *string format;
1844
1846
1851 bool allowEmptyValue = False;
1852
1855
1857
1871
1873
1881
1883 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1884
1885
1887 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
1888
1889
1892
1893
1895 auto getExampleValue(*hash<string, bool> emap, *string fname);
1896
1897
1899protected:
1900 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
1901public:
1902
1903
1905protected:
1906 abstract setType(SwaggerSchema swagger);
1907public:
1908};
1909
1912
1913public:
1915 const ParameterTypes = ...;
1916
1917
1918 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1919
1920
1922protected:
1924public:
1925
1926};
1927
1930
1931public:
1934
1936
1946 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1947
1948
1950protected:
1952public:
1953
1954};
1955
1958
1959public:
1960 // The documentation of responses other than the ones declared for specific HTTP response codes.
1965
1966 // A hash mapping HTTP status codes to @ref ResponseObject "ResponseObjects".
1971 hash<string, ResponseObject> responses;
1972
1974
1984 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1985
1986};
1987
1990
1991public:
1993 string desc;
1994
1996
2003
2005
2008 hash<auto> headers;
2009
2011
2019
2021
2029protected:
2030 constructor(string key, hash<auto> oh, SwaggerSchema swagger) ;
2031public:
2032
2033
2035
2044 static ResponseObject newResponse(string key, hash<auto> oh, SwaggerSchema swagger);
2045};
2046
2048class HeaderObject : public ObjectBase, public SchemaBase {
2049
2050public:
2052 *string desc;
2053
2055
2059 string type;
2060
2062 *string format;
2063
2066
2068
2078
2080
2087
2089
2097 constructor(hash<auto> oh, SwaggerSchema swagger) ;
2098
2099
2101protected:
2102 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2103public:
2104
2105};
2106
2108class TagObject : public ObjectBase {
2109
2110public:
2112 string name;
2113
2115 *string desc;
2116
2119
2121
2127 constructor(hash<auto> oh) ;
2128
2129};
2130
2132class SchemaObject : public ObjectBase, public SchemaBase {
2133
2134public:
2136 string name;
2137
2139
2143 string type;
2144
2146 *string format;
2147
2149 *string title;
2150
2152 *string desc;
2153
2156
2159
2162
2165
2167
2169 bool nullable = False;
2170
2172
2176 hash<string, SchemaObject> properties;
2177
2179 hash<string, bool> nullable_properties;
2180
2182
2187
2189
2192 hash<string, bool> required;
2193
2195
2214
2216
2223 bool readOnly = False;
2224
2226
2234 list<SchemaObject> allOf();
2235
2237
2245
2248
2251
2253 *AbstractDataProviderType dataType;
2254
2256 *AbstractDataProviderType orNothingDataType;
2257
2259 const ScalarTypes = ...;
2260
2261
2263 const ReferenceTypes = ...;
2264
2265
2266protected:
2267 SwaggerSchema swagger;
2268
2269 // maps fields: name -> {Y,N} -> field
2270 hash<string, hash<string, AbstractDataField>> fieldmap;
2271
2272public:
2273
2275
2288protected:
2289 constructor(string name, hash<auto> oh, SwaggerSchema swagger, *string hash_str, *bool require_items) ;
2290public:
2291
2292
2293 replaceType(AbstractDataProviderType t);
2294
2295
2296 AbstractDataProviderType getDataType(bool required = True, *HTTPClient rest);
2297
2298
2300protected:
2301 AbstractDataProviderType getDataTypeIntern(string path, bool required = True, *HTTPClient rest);
2302public:
2303
2304
2306 AbstractDataField getField(string name, *string desc, bool required = True, *HTTPClient rest, auto default_value);
2307
2308
2310 AbstractDataField getField(string path, string name, *string desc, bool required = True, *HTTPClient rest, auto default_value);
2311
2312
2314protected:
2315 static *AbstractDataField getCacheField(reference<hash<string, AbstractDataField>> h, string key);
2316public:
2317
2318
2320protected:
2321 getSchemaObjectFields(HashDataType type, string path, auto def_body);
2322public:
2323
2324
2326protected:
2327 AbstractDataField getFieldIntern(string path, string name, *string desc, bool required = True, *HTTPClient rest, auto default_value, *string rstr);
2328public:
2329
2330
2332 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv, string name, bool decl);
2333
2334
2335 // returns an example value for a REST API call
2336 auto getExampleValue(*hash<string, bool> emap, *string fname);
2337
2338
2340 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
2341
2342
2343protected:
2344 checkObjectProperty(string name, string prop);
2345public:
2346
2347
2348protected:
2349 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
2350public:
2351
2352
2354protected:
2355 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash<auto> v, reference<hash<auto>> value, *bool no_check_others);
2356public:
2357
2358
2360protected:
2361 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2362public:
2363
2364
2366
2377 static SchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger, *bool require_items);
2378
2380
2382 static SchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger);
2383};
2384
2387
2388public:
2390
2404
2406
2418protected:
2419 constructor(string name, hash<auto> oh, SwaggerSchema swagger, *string inLoc) ;
2420public:
2421
2422
2424
2436 static ParameterItemsSchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger, *string inLoc);
2437
2439
2441 static ParameterItemsSchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger, *string inLoc);
2442};
2443
2445
2450class XmlObject : public ObjectBase {
2451
2452public:
2454
2461 *string name;
2462
2464 *string ns;
2465
2467 *string prefix;
2468
2470
2472 bool attribute = False;
2473
2475
2481 bool wrapped = False;
2482
2484
2489 constructor(hash<auto> oh) ;
2490
2491};
2492
2494
2500
2501public:
2503 string type;
2504
2506 *string desc;
2507
2509
2512 *string name;
2513
2515
2518 *string inLoc;
2519
2521
2526 *string flow;
2527
2529
2533
2535
2538 *string tokenUrl;
2539
2541
2549
2551
2560 constructor(hash<auto> oh) ;
2561
2562};
2563
2565class ScopesObject : public ObjectBase {
2566
2567public:
2569
2572 hash<string, string> fields;
2573
2575
2581 constructor(hash<auto> oh) ;
2582
2583};
2584};
2585
2586// private namespace for internal definitions
2587namespace Priv {
2588 // a set of string values
2589 const SwaggerListToStringSet = -1;
2590 // a set of any type that can be converted to a string
2591 const SwaggerListToAnySet = -2;
2592 const SwaggerListToHashOfStrings = -3;
2593
2594 const TypeMap = ...;
2595
2596
2598
2608 required_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2609
2610
2612
2622 required_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2623
2624
2626
2637 bool optional_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2638
2639
2641
2652 bool optional_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2653
2654
2656 *bool check_type_code(string objType, hash<auto> oh, string name, auto val, int typeCode, *int opt_flags);
2657
2658
2660 get_value(string objType, string name, int typeCode, auto val, reference<auto> target);
2661
2662
2664 string get_qore_type(string name, string type, *string format, *SchemaObject items);
2665
2666};
static auto deserialize(InputStream stream, *int flags)
serialize(OutputStream stream, *int flags)
Describes a single operation parameter.
Definition Swagger.qm.dox.h:1733
bool required
Determines whether this parameter is mandatory.
Definition Swagger.qm.dox.h:1761
auto getDefaultValue()
returns the default value of the parameter (default: NOTHING)
abstract check(bool serialize, bool request, string path, string method, string name, reference value)
verifies the parameter in an actual REST API call
constructor(hash< auto > oh, *int opt_flags)
Constructor.
string name
Required. The name of the parameter. Parameter names are case sensitive.
Definition Swagger.qm.dox.h:1744
string inLoc
Required. The location of the parameter.
Definition Swagger.qm.dox.h:1750
static AbstractParameterObject newParameter(string name, hash< auto > oh, SwaggerSchema swagger)
gets a concrete instance of an AbstractParameterObject
*string desc
A brief description of the parameter. This could contain examples of use. GFM syntax can be used for ...
Definition Swagger.qm.dox.h:1753
AbstractParameterObject specialization for "body" parameters.
Definition Swagger.qm.dox.h:1792
string getQoreExample(reference< hash< RestQoreExampleCodeInfo > > rv)
generates Qore example code for a REST API call
SchemaObject schema
Required. The schema defining the type used for the body parameter.
Definition Swagger.qm.dox.h:1796
constructor(hash< auto > oh, SwaggerSchema swagger)
Constructor.
check(bool serialize, bool request, string path, string method, string name, reference< auto > value)
verifies the parameter in an actual REST API call
auto getExampleValue(*hash< string, bool > emap, *string fname)
Contact information for the exposed API.
Definition Swagger.qm.dox.h:1236
constructor(hash< auto > oh)
Constructor.
*string name
The identifying name of the contact person/organization.
Definition Swagger.qm.dox.h:1240
*string url
The URL pointing to the contact information. MUST be in the format of a URL.
Definition Swagger.qm.dox.h:1243
*string email
The email address of the contact person/organization. MUST be in the format of an email address.
Definition Swagger.qm.dox.h:1246
Allows referencing an external resource for extended documentation.
Definition Swagger.qm.dox.h:1676
*string desc
A short description of the target documentation. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1680
constructor(hash< auto > oh)
Constructor.
string url
Required. The URL for the target documentation. Value MUST be in the format of a URL.
Definition Swagger.qm.dox.h:1683
AbstractParameterObject specialization for formData parameters
Definition Swagger.qm.dox.h:1911
setType(SwaggerSchema swagger)
Sets the parameter type.
const ParameterTypes
valid parameter types
Definition Swagger.qm.dox.h:1915
describes a single HTTP header
Definition Swagger.qm.dox.h:2048
*string desc
A short description of the header.
Definition Swagger.qm.dox.h:2052
*SchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition Swagger.qm.dox.h:2065
auto defaultVal
Declares the value of the header that the server will use if none is provided.
Definition Swagger.qm.dox.h:2086
string type
Required. The type of the object.
Definition Swagger.qm.dox.h:2059
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:2062
static checkValueType(reference< auto > value, string type, *SchemaObject items, *string loc)
validates default values
*string collectionFormat
Determines the format of the array if type array is used.
Definition Swagger.qm.dox.h:2077
constructor(hash< auto > oh, SwaggerSchema swagger)
Constructor.
The object provides metadata about the API. The metadata can be used by the clients if needed,...
Definition Swagger.qm.dox.h:1203
string version
Required. Provides the version of the application API (not to be confused with the specification vers...
Definition Swagger.qm.dox.h:1216
constructor(hash< auto > oh)
Constructor.
string title
Required. The title of the application.
Definition Swagger.qm.dox.h:1207
*LicenseObject license
The license information for the exposed API.
Definition Swagger.qm.dox.h:1222
*ContactObject contact
The contact information for the exposed API.
Definition Swagger.qm.dox.h:1219
*string termsOfService
The Terms of Service for the API.
Definition Swagger.qm.dox.h:1213
*string desc
A short description of the application. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1210
License information for the exposed API.
Definition Swagger.qm.dox.h:1259
constructor(hash< auto > oh)
Constructor.
string name
Required. The license name used for the API.
Definition Swagger.qm.dox.h:1263
*string url
A URL to the license used for the API. MUST be in the format of a URL.
Definition Swagger.qm.dox.h:1266
Base class for the Swagger specification objects, wrapping the vendor extensions.
Definition Swagger.qm.dox.h:340
initialize(hash< auto > oh)
Initialize.
hash< auto > vendorExtensions
Allows extensions to the Swagger Schema.
Definition Swagger.qm.dox.h:348
constructor(ObjectBase other)
copy constructor
constructor(hash< auto > oh)
Constructor.
constructor()
Constructor.
Describes a single API operation on a path.
Definition Swagger.qm.dox.h:1458
list< string > schemes
The transfer protocol for the operation.
Definition Swagger.qm.dox.h:1528
*string desc
A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1477
checkMissingParams(hash< UriQueryInfo > h, *hash< auto > headers, auto body, hash< string, AbstractParameterObject > parameters, *hash< string, AbstractParameterObject > child_params)
checks for missing params
hash< string, bool > produces
A hash of MIME types (strings) the operation can produce.
Definition Swagger.qm.dox.h:1512
*ExternalDocumentationObject externalDocs
Additional external documentation for this operation.
Definition Swagger.qm.dox.h:1487
string path
the URI path for the operation
Definition Swagger.qm.dox.h:1462
validateResponse(string method, string path, PathItemObject pio, int http_code, reference< auto > response_body, reference< hash< string, bool > > mime_types, bool deserialize=True)
validates a response against the response definition, if any
*string summary
A short summary of what the operation does.
Definition Swagger.qm.dox.h:1474
hash< RestQoreExampleCodeInfo > getQoreExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger)
returns example Qore code for the given request
string method
the HTTP method for the operation
Definition Swagger.qm.dox.h:1465
AbstractParameterObject body
The body parameter, if defined.
Definition Swagger.qm.dox.h:1518
hash< RestQoreExampleCodeInfo > getQoreExampleResponse(string method, string path, int code)
returns example Qore code for the given response
hash< RestExampleResponseInfo > getExampleResponse(string method, string path, int code, reference< auto > body)
returns a hash of example message information for the given request
error(string err, string fmt,...)
raises an exception with context information
parseRequest(PathItemObject pio, reference< hash< UriQueryInfo > > h, reference< auto > body, reference< hash > headers)
parses and processes a REST request on the server side
doDefaultParams(reference< hash< UriQueryInfo > > h, reference< hash > headers, reference< auto > body, hash< string, AbstractParameterObject > parameters, *hash< string, AbstractParameterObject > child_params)
add default parameters
ResponsesObject responses
Required. The list of possible responses as they are returned from executing this operation.
Definition Swagger.qm.dox.h:1521
*data getRequestBody(PathItemObject pio, auto body, reference< hash< auto > > headers, *bool freeform)
Processes a generated request.
list tags
A list of tags (strings or TagObjects) for API documentation control.
Definition Swagger.qm.dox.h:1471
*ResponseObject getResponse(int code)
returns the ResponseObject for hthe given HTTP code or NOTHING if none is configured
*string operationId
Unique string used to identify the operation.
Definition Swagger.qm.dox.h:1496
hash< string, AbstractParameterObject > formData
formData parameter; if defined for this operation, body parameter will be excluded
Definition Swagger.qm.dox.h:1515
hash< RestSchemaValidator::RestExampleRequestInfo > getExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger, reference rbody)
returns a hash of example message information for the given request
list< hash< string, list< string > > > security
A declaration of which security schemes are applied for this operation.
Definition Swagger.qm.dox.h:1543
validateRequest(bool serialize, PathItemObject pio, reference< hash< UriQueryInfo > > h, reference< auto > body, reference< hash > headers, *reference< hash< string, bool > > mime_types, *bool freeform)
processes a REST API client-side request to the operation
hash< string, bool > consumes
A list of MIME types (strings) the operation can consume.
Definition Swagger.qm.dox.h:1504
bool deprec
Declares this operation to be deprecated.
Definition Swagger.qm.dox.h:1484
constructor(string path, string method, hash< auto > oh, SwaggerSchema swagger)
Constructor.
AbstractParameterObject specialization for parameters other than "body" and "formData"
Definition Swagger.qm.dox.h:1929
constructor(string name, hash< auto > oh, SwaggerSchema swagger)
Constructor.
setType(SwaggerSchema swagger)
Sets the parameter type.
const ParameterTypes
valid parameter types
Definition Swagger.qm.dox.h:1933
Common class for objects that have parameters.
Definition Swagger.qm.dox.h:582
constructor(hash< auto > oh)
Creates the object from the hash definition.
addParameter(AbstractParameterObject p)
Adds a parameter to the group.
addParameter(string key, AbstractParameterObject p)
Adds a parameter to the group.
hash< string, AbstractParameterObject > parameters()
A hash of parameters for this object.
string query_obj
Any query param with type "object"? (OpenAPI 3 compatible)
Definition Swagger.qm.dox.h:592
items schema object for non-body parameters
Definition Swagger.qm.dox.h:2386
*string collectionFormat
Determines the format of the array if type array is used.
Definition Swagger.qm.dox.h:2403
static ParameterItemsSchemaObject newSchemaObject(string name, hash< auto > oh, SwaggerSchema swagger, *string inLoc)
returns a SchemaObject for the schema definition; resolves references
constructor(string name, hash< auto > oh, SwaggerSchema swagger, *string inLoc)
private constructor; use newSchemaObject() instead
static ParameterItemsSchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger, *string inLoc)
throws an "INVALID-FIELD-TYPE" exception
Holds the relative paths to the individual endpoints.
Definition Swagger.qm.dox.h:1286
constructor(hash< auto > oh, string pfx, SwaggerSchema swagger)
creates the object
constructor(string full_path, list< auto > l, int offset, hash< auto > oh)
private constructor
add(string full_path, list< auto > l, int offset, hash< auto > oh, SwaggerSchema swagger)
adds a component or a Path Item Object to the tree
hash< string, PathComponent > paths
hash of non-wildcard paths to the next level
Definition Swagger.qm.dox.h:1303
PathItemObject match(list< auto > path)
returns either a PathItemObject for the path
getPathOperationHash(reference< hash< string, list< string > > > h)
returns a hash of URI paths as keys with values as lists of supported HTTP methods
*PathItemObject tryMatch(list< auto > path)
returns either a PathItemObject for the path
string name
current component name
Definition Swagger.qm.dox.h:1294
*PathComponent wildcard
if there is a wildcard to a PathComponent
Definition Swagger.qm.dox.h:1297
string pfx
path prefix
Definition Swagger.qm.dox.h:1291
*PathItemObject pio
the PathItemObject associated with this path (if any)
Definition Swagger.qm.dox.h:1300
Describes the operations available on a single path.
Definition Swagger.qm.dox.h:1389
softlist getMethods()
returns a list of HTTP methods supported by this object
const ObjType
This objet type.
Definition Swagger.qm.dox.h:1418
merge(string path, hash< auto > oh, SwaggerSchema swagger)
Try to merge another PathItemObject description for the same path into this one.
*string ref
Allows for an external definition of this path item.
Definition Swagger.qm.dox.h:1398
hash< string, OperationObject > operations
A hash of OperationObjects correspoding to different methods.
Definition Swagger.qm.dox.h:1415
OperationObject getOperation(string method, string path)
returns the operation object for the given method
AbstractParameterObject body
The body parameter, if defined.
Definition Swagger.qm.dox.h:1401
constructor(string path, hash< auto > oh, SwaggerSchema swagger)
Constructor.
This class stores the path tree for URI path matching.
Definition Swagger.qm.dox.h:1343
*PathItemObject tryMatch(string path)
matches a URI path with a PathItemObject
PathItemObject match(string path)
matches a URI path with a PathItemObject
constructor(hash< auto > oh, SwaggerSchema swagger)
Constructor.
PathComponent paths
the tree of path components for path matching with wildcards
Definition Swagger.qm.dox.h:1348
hash< string, list< string > > getPathOperationHash()
returns a hash of URI paths as keys with values as lists of supported HTTP methods
Describes a single response from an API Operation.
Definition Swagger.qm.dox.h:1989
*SchemaObject schema
A definition of the response structure.
Definition Swagger.qm.dox.h:2002
string desc
Required. A short description of the response. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1993
hash< auto > headers
A hash of headers that are (can be) sent with the response.
Definition Swagger.qm.dox.h:2008
hash examples
A hash of example response messages.
Definition Swagger.qm.dox.h:2018
static ResponseObject newResponse(string key, hash< auto > oh, SwaggerSchema swagger)
returns a new ResponseObject corresponding to the schema definition passed
constructor(string key, hash< auto > oh, SwaggerSchema swagger)
private constructor; use newResponse() instead
contains the possible responses for an operation
Definition Swagger.qm.dox.h:1957
ResponseObject defaultResp
Definition Swagger.qm.dox.h:1964
constructor(string path, string method, hash< auto > oh, SwaggerSchema swagger)
Constructor.
hash< string, ResponseObject > responses
Definition Swagger.qm.dox.h:1971
Base used by OtherParameter, HeaderObject and SchemaObject.
Definition Swagger.qm.dox.h:373
checkArrayParam(bool serialize, bool request, SchemaObject items, string path, string method, string name, reference< list< auto > > value)
validates the value against the schema definition
*bool exclusiveMin
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
Definition Swagger.qm.dox.h:386
*int minItems
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
Definition Swagger.qm.dox.h:401
checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, date v, reference< auto > value)
converts dates to/from string or int values for supported formats
*float multipleOf
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
Definition Swagger.qm.dox.h:413
checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, string v, reference< auto > value)
validates string values
constructor(string objType, hash< auto > oh)
Constructor.
*int maxItems
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
Definition Swagger.qm.dox.h:398
*int minLength
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
Definition Swagger.qm.dox.h:392
static throwInvalidType(string name, string actual, string expected, auto value)
throws an SCHEMA-VALIDATION-ERROR exception
*float maximum
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
Definition Swagger.qm.dox.h:377
checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, binary v, reference value)
converts binary values to strings for supported formats
constructor(SchemaBase other)
Copy constructor.
*int maxLength
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
Definition Swagger.qm.dox.h:389
*bool exclusiveMax
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
Definition Swagger.qm.dox.h:383
*bool uniqueItems
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
Definition Swagger.qm.dox.h:404
static bool checkValueType(reference< auto > value, string type)
Checks the value against the type.
auto getExampleValueWithFormat(string type, *string format, *string fname)
returns an example value for the given type
*float minimum
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
Definition Swagger.qm.dox.h:380
check(bool serialize, bool request, string type, *string format, *SchemaObject items, string path, string method, string name, reference< auto > value)
validates the value against the schema definition
*string pattern
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
Definition Swagger.qm.dox.h:395
defines an object in a schema
Definition Swagger.qm.dox.h:2132
auto additionalProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.4.
Definition Swagger.qm.dox.h:2186
bool readOnly
Relevant only for Schema "properties" definitions. Declares the property as "read only".
Definition Swagger.qm.dox.h:2223
bool nullable
extension that allows types to be nullable
Definition Swagger.qm.dox.h:2169
hash< string, SchemaObject > properties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.4.
Definition Swagger.qm.dox.h:2176
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:2146
static SchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger)
throws an "INVALID-FIELD-TYPE" exception
static SchemaObject newSchemaObject(string name, hash< auto > oh, SwaggerSchema swagger, *bool require_items)
returns a SchemaObject for the schema definition; resolves references
check(bool serialize, bool request, string path, string method, string name, reference< auto > value)
validates the value against the schema definition
constructor(string name, hash< auto > oh, SwaggerSchema swagger, *string hash_str, *bool require_items)
private constructor; use newSchemaObject() instead
static *AbstractDataField getCacheField(reference< hash< string, AbstractDataField > > h, string key)
Returns a field object from the given cache.
list< SchemaObject > allOf()
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.3.
*int maxProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.1.
Definition Swagger.qm.dox.h:2161
string name
the name of this object for documentation and example purposes
Definition Swagger.qm.dox.h:2136
string type
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.2.
Definition Swagger.qm.dox.h:2143
*string discriminator
Adds support for polymorphism.
Definition Swagger.qm.dox.h:2213
*SchemaObject items
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.1.
Definition Swagger.qm.dox.h:2155
*XmlObject xml
This MAY be used only on properties schemas. It has no effect on root schemas.
Definition Swagger.qm.dox.h:2244
hash< string, bool > nullable_properties
extention to allow properties to be nullable
Definition Swagger.qm.dox.h:2179
AbstractDataProviderType getDataTypeIntern(string path, bool required=True, *HTTPClient rest)
Returns the data type for the given schema.
checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash< auto > v, reference< hash< auto > > value, *bool no_check_others)
validates a schema object against a value
*AbstractDataProviderType dataType
The data type of the schema (required)
Definition Swagger.qm.dox.h:2253
string getQoreExample(reference< hash< RestQoreExampleCodeInfo > > rv, string name, bool decl)
returns example Qore code for the object
AbstractDataField getField(string name, *string desc, bool required=True, *HTTPClient rest, auto default_value)
Returns a field definition from the Swagger parameter.
AbstractDataField getFieldIntern(string path, string name, *string desc, bool required=True, *HTTPClient rest, auto default_value, *string rstr)
Returns a field definition from the Swagger parameter.
AbstractDataField getField(string path, string name, *string desc, bool required=True, *HTTPClient rest, auto default_value)
Returns a field definition from the Swagger parameter.
*ExternalDocumentationObject externalDocs
Additional external documentation for this schema.
Definition Swagger.qm.dox.h:2247
const ScalarTypes
valid scalar types
Definition Swagger.qm.dox.h:2259
static checkValueType(reference< auto > value, string type, *SchemaObject items, *string loc)
validates default values
*string desc
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.1.
Definition Swagger.qm.dox.h:2152
*AbstractDataProviderType orNothingDataType
The data type of the schema (not required)
Definition Swagger.qm.dox.h:2256
auto defaultVal
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2.
Definition Swagger.qm.dox.h:2158
*string title
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.1.
Definition Swagger.qm.dox.h:2149
getSchemaObjectFields(HashDataType type, string path, auto def_body)
Sets fields of a schema object.
hash< string, bool > required
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.3.
Definition Swagger.qm.dox.h:2192
auto example
A free-form property to include an example of an instance for this schema.
Definition Swagger.qm.dox.h:2250
const ReferenceTypes
valid reference types
Definition Swagger.qm.dox.h:2263
*int minProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.2.
Definition Swagger.qm.dox.h:2164
Lists the available scopes for an OAuth2 security scheme.
Definition Swagger.qm.dox.h:2565
constructor(hash< auto > oh)
Constructor.
hash< string, string > fields
Maps between a name of a scope to a short description of it (as the value of the property).
Definition Swagger.qm.dox.h:2572
Allows the definition of a security scheme that can be used by the operations.
Definition Swagger.qm.dox.h:2499
*string flow
The flow used by the OAuth2 security scheme.
Definition Swagger.qm.dox.h:2526
*string authorizationUrl
The authorization URL to be used for this flow. This SHOULD be in the form of a URL.
Definition Swagger.qm.dox.h:2532
string type
Required. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
Definition Swagger.qm.dox.h:2503
*string inLoc
The location of the API key. Valid values are "query" or "header".
Definition Swagger.qm.dox.h:2518
constructor(hash< auto > oh)
Constructor.
*string name
The name of the header or query parameter to be used.
Definition Swagger.qm.dox.h:2512
*ScopesObject scopes
The available scopes for the OAuth2 security scheme.
Definition Swagger.qm.dox.h:2548
*string desc
A short description for security scheme.
Definition Swagger.qm.dox.h:2506
*string tokenUrl
The token URL to be used for this flow. This SHOULD be in the form of a URL.
Definition Swagger.qm.dox.h:2538
Used for loading the Swagger definitions.
Definition Swagger.qm.dox.h:520
static string detectSourceEncoding(string str)
tries to determine the Swagger schema source encoding automatically
static SwaggerSchema fromString(string swaggerSpecification, *bool json, *hash< auto > opts)
Load Swagger definition from a string.
static hash< auto > parseSchemaSource(string str, string ser)
parses the source encoding from the given string
static hash< auto > parseSchemaContent(string filepath, string str)
Load a schema definition from a file.
static SwaggerSchema fromUrl(string url, *bool json, *hash< auto > opts)
Load Swagger definition from a URL or file path.
static SwaggerSchema fromFile(string filepath, *hash< auto > opts)
Load Swagger definition from a file.
This is the root document object for the API specification. It combines what previously was the Resou...
Definition Swagger.qm.dox.h:608
hash< RestQoreExampleCodeInfo > getQoreExampleResponseImpl(string method, string path, int code)
returns example Qore code for the given response
hash< HttpResponseInfo > processResponseImpl(string method, string path, int code, auto response_body, *hash< auto > headers, *softlist< string > content_types)
processes a REST response with a serialized message body, validates any response data against schema ...
AbstractDataProviderType getSchemaDataType(string path, SchemaObject schema, bool required=True, *HTTPClient rest)
Returns the data type for the given schema.
AbstractDataProvider getDataProviderImpl(HTTPClient rest)
returns a data provider object for this connection
setTimeZoneLocaleImpl(*TimeZone tz)
Allows the time zone locale to be set for serialization / deserialization.
addFieldsFromParameters(HashDataType rv, hash< string, AbstractParameterObject > parameters, reference< bool > required)
Adds field definitions to a hash type from Swagger parameters.
hash< RestSchemaValidator::RestRequestServerInfo > parseRequestImpl(string method, string path, *data http_body, reference< hash > headers)
processes and parses a client request and returns the deserialized message body (if any)
bool checkResponseTextPlain(reference< hash< HttpResponseInfo > > resp, auto body, hash< string, bool > mime_types, *list< auto > content_types)
Check if the response body can be sent as text/plain and if so, modify the response hash.
hash< string, hash< string, AbstractDataProviderType > > typemap
type map; identifer -> {Y,N} -> type
Definition Swagger.qm.dox.h:755
hash< string, bool > produces
A set of MIME types (strings) the APIs can produce.
Definition Swagger.qm.dox.h:661
hash< RestQoreExampleCodeInfo > getQoreExampleRequestImpl(string method, string path)
returns example Qore code for the given request
string getTargetUrlImpl()
returns the target URL for the schema
AbstractDataProviderType getTypeIntern(string path, string typestr, *string format, *SchemaObject arrayItems, bool required=True)
Returns the data type corresponding to the values.
setBasePathImpl(string basePath)
overrides the basePath value
hash< string, SchemaObject > definitions()
An object to hold data types produced and consumed by operations.
bool checkResponseContentTypeHeader(reference< hash< HttpResponseInfo > > resp, auto body, *hash< auto > headers)
Check if the headers contain a content-type header and if so, modify the response hash.
hash< string, hash< string, SchemaObject > > so_map
maps name -> SHA1 hash of the config -> schema objects for recursive references
Definition Swagger.qm.dox.h:752
hash< string, list< string > > getPathOperationHashImpl()
returns a hash of URI paths as keys with values as lists of supported HTTP methods
*hash< auto > source_definition_hash
the raw parsed definitions; used for resolving out-of-order references
Definition Swagger.qm.dox.h:761
*string def_path
the default path to use when retrieving external schema references
Definition Swagger.qm.dox.h:732
hash< HttpResponseInfo > processResponseIntern(string method, string path, int code, auto response_body, *hash< auto > headers, *softlist< string > content_types, bool compact_serialization)
processes a REST response with a serialized message body, validates any response data against schema ...
AbstractDataField getFieldFromParameter(string path, string name, string type, *string format, *SchemaObject arrayItems, *string desc, bool required, *list< auto > allowed_values, auto default_value)
Returns a field from a Swagger parameter.
addFieldsFromParametersIntern(HashDataType rv, hash< string, AbstractParameterObject > parameters, reference< bool > required)
Adds field definitions from Swagger parameters.
hash< string, softlist< string > > security
A declaration of which security schemes are applied for the API as a whole.
Definition Swagger.qm.dox.h:693
hash< string, ResponseObject > responses
Response definitions that can be used across operations. This property does not define global respons...
Definition Swagger.qm.dox.h:673
*ExternalDocumentationObject externalDocs
Additional external documentation.
Definition Swagger.qm.dox.h:711
constructor(LoggerInterface logger, string schema_source, hash< auto > oh, *hash< auto > opts)
Builds the schema representation from the deserialized schema hash describing the root document objec...
hash< RestSchemaValidator::RestExampleRequestInfo > getExampleRequestImpl(string method, string path, *softlist< string > content_types)
returns a hash of example message information for the given request
string getBasePathImpl()
returns the base path prefix for all requests in this schema
ResponseObject resolveResponse(string name, string refstr, hash< auto > oh)
resolves a reference to a response
AbstractParameterObject resolveParameter(string name, string refstr, hash< auto > oh)
resolves a reference to a parameter
hash< RestSchemaValidator::RestRequestClientInfo > processRequestIntern(string method, string path, auto body, *hash< auto > headers, *softlist< string > content_types, bool compact_serialization)
processes a client-side REST request and returns a hash that can be used to make the outgoing client-...
bool checkRequestContentTypeHeader(reference< hash< RestRequestClientInfo > > req, auto body, *hash< auto > headers)
Check if the headers contain a content-type header and if so, modify the request hash.
*code try_import
a call reference or closure to be passed a string name for external schema references
Definition Swagger.qm.dox.h:737
*string basePath
The base path on which the API is served, which is relative to the host.
Definition Swagger.qm.dox.h:639
AbstractDataProviderType getType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required=True)
Returns the data type corresponding to the values.
constructorIntern(string schema_source, hash< auto > oh, *hash< auto > opts)
common constructor implementation
static *AbstractDataProviderType getCacheType(reference< hash< string, AbstractDataProviderType > > h, string key)
Returns a type object from the given cache.
string hash_str
the hash for the schema
Definition Swagger.qm.dox.h:740
hash< string, SecuritySchemeObject > securityDefinitions
Security scheme definitions that can be used across the specification.
Definition Swagger.qm.dox.h:679
*int opt_flags
parse option flags
Definition Swagger.qm.dox.h:743
SchemaObject processDefinition(string key, auto value)
Processes a schema definition.
ParameterItemsSchemaObject resolveParameterItemsSchemaObject(string name, string refstr, hash< auto > oh, *string inLoc)
resolves a reference to a parameter items schema object
hash< auto > store
Free-form data storage for types or other related information.
Definition Swagger.qm.dox.h:708
string swaggerSpec
Swagger Specification version being used.
Definition Swagger.qm.dox.h:616
SchemaObject resolveSchemaObject(string name, string refstr, hash< auto > oh)
resolves a reference to a schema object
*TimeZone getTimeZoneLocaleImpl()
Returns the time zone locale used for serialization / deserialization.
InfoObject info
Required. Provides metadata about the API. The metadata can be used by the clients if needed.
Definition Swagger.qm.dox.h:619
string getHashImpl()
returns a unique hash for the schema that can be used to compare schemas
*softbool utc_dates
Send dates in UTC format.
Definition Swagger.qm.dox.h:746
hash< auto > getExternalReference(string refstr)
retrieves external references
*string query_date_format
Date format for serializing dates in queries.
Definition Swagger.qm.dox.h:749
bool compact_serialization
if serialized data should be subject to compact serialization (default: True)
Definition Swagger.qm.dox.h:729
const SwaggerOptions
SwaggerSchema options.
Definition Swagger.qm.dox.h:724
fixPath(reference< string > path)
removes the base path from the beginning of the path, if present
constructor(string schema_source, hash< auto > oh, *hash< auto > opts)
Builds the schema representation from the deserialized schema hash describing the root document objec...
hash< RestExampleResponseInfo > getExampleResponseImpl(string method, string path, int code, *softlist< string > content_types)
returns a hash of example message information for the given request
*string host
The host (name or IP) serving the API.
Definition Swagger.qm.dox.h:631
hash< RestSchemaValidator::RestResponseClientInfo > parseResponseImpl(string method, string path, int code, *data response_body, hash< auto > hdr)
parses and validates the response from the server and returns a hash of the processed info
hash< string, bool > consumes
A set of MIME types (strings) the APIs can consume.
Definition Swagger.qm.dox.h:654
AbstractDataField getFieldForHeaders(string name, hash< auto > headers)
Returns a field of header fields.
AbstractDataProviderType getTypeForReference(string rstr, bool required=True, *HTTPClient rest)
Returns the data type corresponding to the reference type.
AbstractDataField getFieldFromSchema(string name, *string desc, SchemaObject schema, bool required=True, *HTTPClient rest)
Returns a field definition from the Swagger parameter.
hash< string, bool > schemes
The transfer protocol of the API.
Definition Swagger.qm.dox.h:647
PathsObject paths
Required. The available paths and operations for the API.
Definition Swagger.qm.dox.h:622
list< TagObject > tags
A list of tags used by the specification with additional metadata.
Definition Swagger.qm.dox.h:705
hash< RestSchemaValidator::RestRequestClientInfo > processRequestImpl(string method, string path, auto body, *hash< auto > headers, *softlist< string > content_types)
processes a client-side REST request and returns a hash that can be used to make the outgoing client-...
Allows adding metadata to a single tag that is used by the OperationObject. It is not mandatory to ha...
Definition Swagger.qm.dox.h:2108
*ExternalDocumentationObject externalDocs
Additional external documentation for this tag.
Definition Swagger.qm.dox.h:2118
*string desc
A short description for the tag. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:2115
string name
Required. The name of the tag.
Definition Swagger.qm.dox.h:2112
constructor(hash< auto > oh)
Constructor.
AbstractParameterObject specialization for parameters other than "body"
Definition Swagger.qm.dox.h:1826
static checkValueType(reference< auto > value, string type, *SchemaObject items, *string loc)
validates default values
auto getExampleValue(*hash< string, bool > emap, *string fname)
returns an example value of the parameter (default: NOTHING)
abstract setType(SwaggerSchema swagger)
Sets the parameter type.
auto getDefaultValue()
returns the default value of the parameter (default: NOTHING)
string type
Required. The type of the parameter.
Definition Swagger.qm.dox.h:1840
*ParameterItemsSchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition Swagger.qm.dox.h:1854
*string collectionFormat
Determines the format of the array if type array is used.
Definition Swagger.qm.dox.h:1870
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:1843
constructor(string name, hash< auto > oh, SwaggerSchema swagger)
Creates the object.
bool allowEmptyValue
Sets the ability to pass empty-valued parameters.
Definition Swagger.qm.dox.h:1851
auto defaultVal
Declares the value of the parameter that the server will use if none is provided.
Definition Swagger.qm.dox.h:1880
check(bool serialize, bool request, string path, string method, string name, reference< auto > value)
validates the value against the schema definition
A metadata object that allows for more fine-tuned XML model definitions.
Definition Swagger.qm.dox.h:2450
bool wrapped
MAY be used only for an array definition.
Definition Swagger.qm.dox.h:2481
*string name
Replaces the name of the element/attribute used for the described schema property.
Definition Swagger.qm.dox.h:2461
bool attribute
Declares whether the property definition translates to an attribute instead of an element.
Definition Swagger.qm.dox.h:2472
constructor(hash< auto > oh)
Constructor.
*string prefix
The prefix to be used for the name.
Definition Swagger.qm.dox.h:2467
*string ns
The URL of the namespace definition. Value SHOULD be in the form of a URL.
Definition Swagger.qm.dox.h:2464
const LM_IGNORE_INVALID_PATHS
parse option: ignore invalid paths
Definition Swagger.qm.dox.h:289
const LM_OPTIONAL_REF_PROPERTIES
parse option: object properties with reference types are automatically optional
Definition Swagger.qm.dox.h:280
const LM_IGNORE_INVALID_REQUIRED
parse option: ignore invalid "required" properties
Definition Swagger.qm.dox.h:271
const LM_ALL
parse options: all options
Definition Swagger.qm.dox.h:292
const LM_ACCEPT_INVALID_BODY_PARAMS
parse option: reconstruct invalid body parameters
Definition Swagger.qm.dox.h:274
const LM_AUTO_FORM_DATA
parse option: add consumes application/x-www-form-urlencoded to API endpoint if formData is used in p...
Definition Swagger.qm.dox.h:277
const LM_ACCEPT_ALL_PROPERTIES
parse option: accept additional properties without raising an error
Definition Swagger.qm.dox.h:283
const LM_LAX_COLLECTIONFORMAT
parse option: allow collectionFormat on non-array types
Definition Swagger.qm.dox.h:268
const LM_ACCEPT_QUERY_OBJECTS
parse option: accept object as a query parameter type (as with OpenApi 3+)
Definition Swagger.qm.dox.h:286
const LM_IGNORE_MISSING_REQUIRED
Definition Swagger.qm.dox.h:265
main namespace for all public Swagger declarations
Definition Swagger.qm.dox.h:259
const CollectionFormats
allowed collection formats
Definition Swagger.qm.dox.h:304
const ValidNumberFormats
Valid number type formats.
Definition Swagger.qm.dox.h:299
const ValidStringFormatsHash
A hash of valid string type formats.
Definition Swagger.qm.dox.h:316
const ValidNumberFormatsHash
A hash of valid number type formats.
Definition Swagger.qm.dox.h:314
const ParameterCollectionFormats
valid parameter collection formats
Definition Swagger.qm.dox.h:308
const SerializationModules
modules available for data serialization and/or deserialization
Definition Swagger.qm.dox.h:330
const ValidStringFormats
Valid string type formats.
Definition Swagger.qm.dox.h:301
const ValidIntFormatsHash
A hash of valid integer type formats.
Definition Swagger.qm.dox.h:312
const MimeDataTypes
supported mime types for de/serializing data
Definition Swagger.qm.dox.h:326
const MimeContentTypes
MIME types for data serialization.
Definition Swagger.qm.dox.h:333
const ValidIntFormats
Valid integer type formats.
Definition Swagger.qm.dox.h:297
const YamlSerialization
Yaml serialization.
Definition Swagger.qm.dox.h:319
const ValidSchemes
Valid transfer protocol schemes.
Definition Swagger.qm.dox.h:336