Qore Swagger Module Reference 2.2.2
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
256namespace Swagger {
263
265const LM_LAX_COLLECTIONFORMAT = (1 << 1);
266
269
272
274const LM_AUTO_FORM_DATA = (1 << 4);
275
278
281
283const LM_ACCEPT_QUERY_OBJECTS = (1 << 7);
284
286const LM_IGNORE_INVALID_PATHS = (1 << 8);
287
289const LM_ALL = ...;
290
292
294const ValidIntFormats = ("int32", "int64", "unix-time");
296const ValidNumberFormats = ("double", "float");
298const ValidStringFormats = ("binary", "byte", "date", "password", "unix-time");
299
302
303
306
307
309const ValidIntFormatsHash = map {$1: True}, ValidIntFormats;
314
317
318
319const JsonSerialization = ...;
320
321
323const MimeDataTypes = ...;
324
325
327const SerializationModules = keys (map {$1.module: True}, MimeDataTypes.iterator(), $1.module);
328
331
333const ValidSchemes = ("http", "https", "ws", "wss");
334const ValidSchemesHash = map {$1: True}, ValidSchemes;
335
338
339public:
341
346
349
350
352
355 constructor(hash<auto> oh);
356
357
360
361
363
366 initialize(hash<auto> oh);
367};
368
371
372public:
374 *float maximum;
375
377 *float minimum;
378
381
384
387
390
392 *string pattern;
393
396
399
402
404
407 hash<string, bool> enum;
408
411
413
416 constructor(string objType, hash<auto> oh);
417
418
421
422
424protected:
425 auto getExampleValueWithFormat(string type, *string format, *string fname);
426public:
427
428
430protected:
431 check(bool serialize, bool request, string type, *string format, *SchemaObject items, string path, string method, string name, reference<auto> value);
432public:
433
434
435protected:
436 checkStringIntern(string path, string method, string name, string value);
437public:
438
439
440protected:
441 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, list<auto> v, reference<list> value);
442public:
443
444
445protected:
446 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash<auto> v, reference<hash> value);
447public:
448
449
450protected:
451 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, int v, reference<auto> value);
452public:
453
454
455protected:
456 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, number v, reference<number> value);
457public:
458
459
460protected:
461 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, float v, reference<number> value);
462public:
463
464
465protected:
466 checkInternNumber(bool serialize, bool request, string type, *string format, string path, string method, string name, auto v, reference<auto> value);
467public:
468
469
471protected:
472 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, binary v, reference value);
473public:
474
475
477protected:
478 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, string v, reference<auto> value);
479public:
480
481
483protected:
484 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, date v, reference<auto> value);
485public:
486
487
488protected:
489 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, bool v, reference<bool> value);
490public:
491
492
493protected:
494 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
495public:
496
497
499protected:
500 checkArrayParam(bool serialize, bool request, SchemaObject items, string path, string method, string name, reference<list<auto>> value);
501public:
502
503
505protected:
506 static throwInvalidType(string name, string actual, string expected, auto value);
507public:
508
509
511
513 static bool checkValueType(reference<auto> value, string type);
514};
515
518
519public:
521
530 static SwaggerSchema fromString(string swaggerSpecification, *bool json, *hash<auto> opts);
531
533
542 static SwaggerSchema fromFile(string filepath, *hash<auto> opts);
543
545
557 static SwaggerSchema fromUrl(string url, *bool json, *hash<auto> opts);
558
560
569 static hash<auto> parseSchemaContent(string filepath, string str);
570
572 static hash<auto> parseSchemaSource(string str, string ser);
573
575 static string detectSourceEncoding(string str);
576};
577
580
581public:
583
586 hash<string, AbstractParameterObject> parameters();
587
589 string query_obj;
590
592 constructor(hash<auto> oh) ;
593
594
597
598
601
602};
603
605class SwaggerSchema : public ParameterGroup, public AbstractRestSchemaValidator {
606
607public:
609
614
617
620
622
628 *string host;
629
631
636 *string basePath;
637
639
644 hash<string, bool> schemes;
645
647
651 hash<string, bool> consumes;
652
654
658 hash<string, bool> produces;
659
661
664 hash<string, SchemaObject> definitions();
665
667
670 hash<string, ResponseObject> responses;
671
673
676 hash<string, SecuritySchemeObject> securityDefinitions;
677
679
690 hash<string, softlist<string>> security;
691
693
702 list<TagObject> tags;
703
705 hash<auto> store;
706
709
711
721 const SwaggerOptions = ...;
722
723
724protected:
727
729 *string def_path;
730
732
735
737 string hash_str;
738
741
743 *softbool utc_dates;
744
747
749 hash<string, hash<string, SchemaObject>> so_map;
750
752 hash<string, hash<string, AbstractDataProviderType>> typemap;
753
754public:
755
756private:
759
760public:
761
763
775 constructor(string schema_source, hash<auto> oh, *hash<auto> opts) ;
776
777
779
791 constructor(LoggerInterface logger, string schema_source, hash<auto> oh, *hash<auto> opts) ;
792
793
795protected:
796 constructorIntern(string schema_source, hash<auto> oh, *hash<auto> opts);
797public:
798
799
800 *int getParseFlags();
801
802
803 *bool getUtcDates();
804
805
806 *string getQueryDateFormat();
807
808
809 *SchemaObject tryGetSchemaObject(string name, hash<auto> oh, reference<string> hash_str);
810
811
812 cacheSchemaObject(string name, string hash_str, SchemaObject so);
813
814
816
818 SchemaObject resolveSchemaObject(string name, string refstr, hash<auto> oh);
819
820
822
824 ParameterItemsSchemaObject resolveParameterItemsSchemaObject(string name, string refstr, hash<auto> oh, *string inLoc);
825
826
828
830 AbstractParameterObject resolveParameter(string name, string refstr, hash<auto> oh);
831
832
834
836 ResponseObject resolveResponse(string name, string refstr, hash<auto> oh);
837
838
840 AbstractDataProviderType getTypeForReference(string rstr, bool required = True, *HTTPClient rest);
841
842
843 replaceTypeForReference(string rstr, AbstractDataProviderType t);
844
845
847 AbstractDataProviderType getType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True);
848
849
850protected:
851 *AbstractDataProviderType checkType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True, reference<string> id);
852public:
853
854
856protected:
857 AbstractDataProviderType getTypeIntern(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True);
858public:
859
860
862 AbstractDataProviderType getSchemaDataType(string path, SchemaObject schema, bool required = True, *HTTPClient rest);
863
864
866 AbstractDataField getFieldFromSchema(string name, *string desc, SchemaObject schema, bool required = True, *HTTPClient rest);
867
868
870 addFieldsFromParameters(HashDataType rv, hash<string, AbstractParameterObject> parameters, reference<bool> required);
871
872
874 AbstractDataField getFieldForHeaders(string name, hash<auto> headers);
875
876
878 static *AbstractDataProviderType getCacheType(reference<hash<string, AbstractDataProviderType>> h, string key);
879
881 AbstractDataField getFieldFromParameter(string path, string name, string type, *string format, *SchemaObject arrayItems, *string desc, bool required, *list<auto> allowed_values, auto default_value);
882
883
885protected:
886 addFieldsFromParametersIntern(HashDataType rv, hash<string, AbstractParameterObject> parameters, reference<bool> required);
887public:
888
889
891
895protected:
896 string getHashImpl();
897public:
898
899
901
905protected:
907public:
908
909
911
924protected:
925 hash<RestSchemaValidator::RestRequestClientInfo> processRequestImpl(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types);
926public:
927
928
930
941protected:
942 hash<RestSchemaValidator::RestRequestServerInfo> parseRequestImpl(string method, string path, *data http_body, reference<hash> headers);
943public:
944
945
947
966protected:
967 hash<HttpResponseInfo> processResponseImpl(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types);
968public:
969
970
972
982protected:
983 hash<RestSchemaValidator::RestResponseClientInfo> parseResponseImpl(string method, string path, int code, *data response_body, hash<auto> hdr);
984public:
985
986
988protected:
989 fixPath(reference<string> path);
990public:
991
992
994
996protected:
997 hash<string, list<string>> getPathOperationHashImpl();
998public:
999
1000
1002
1006protected:
1008public:
1009
1010
1012
1014protected:
1016public:
1017
1018
1020
1025protected:
1026 hash<RestQoreExampleCodeInfo> getQoreExampleRequestImpl(string method, string path);
1027public:
1028
1029
1031
1037protected:
1038 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequestImpl(string method, string path, *softlist<string> content_types);
1039public:
1040
1041
1043
1049protected:
1050 hash<RestQoreExampleCodeInfo> getQoreExampleResponseImpl(string method, string path, int code);
1051public:
1052
1053
1055
1062protected:
1063 hash<RestExampleResponseInfo> getExampleResponseImpl(string method, string path, int code, *softlist<string> content_types);
1064public:
1065
1066
1068
1070protected:
1071 hash<auto> getExternalReference(string refstr);
1072public:
1073
1074
1076
1080protected:
1081 AbstractDataProvider getDataProviderImpl(HTTPClient rest);
1082public:
1083
1084
1086
1090protected:
1092public:
1093
1094
1096
1100protected:
1102public:
1103
1104
1106
1120private:
1121 hash<RestSchemaValidator::RestRequestClientInfo> processRequestIntern(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1122public:
1123
1124
1126
1146private:
1147 hash<HttpResponseInfo> processResponseIntern(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1148public:
1149
1150
1152
1160private:
1161 bool checkRequestContentTypeHeader(reference<hash<RestRequestClientInfo>> req, auto body, *hash<auto> headers);
1162public:
1163
1164
1166
1174private:
1175 bool checkResponseContentTypeHeader(reference<hash<HttpResponseInfo>> resp, auto body, *hash<auto> headers);
1176public:
1177
1178
1180
1187private:
1188 bool checkResponseTextPlain(reference<hash<HttpResponseInfo>> resp, auto body, hash<string, bool> mime_types, *list<auto> content_types);
1189public:
1190
1191
1193private:
1194 SchemaObject processDefinition(string key, auto value);
1195public:
1196
1197};
1198
1200class InfoObject : public ObjectBase {
1201
1202public:
1204 string title;
1205
1207 *string desc;
1208
1211
1213 string version;
1214
1217
1220
1222
1228 constructor(hash<auto> oh) ;
1229
1230};
1231
1234
1235public:
1237 *string name;
1238
1240 *string url;
1241
1243 *string email;
1244
1246
1251 constructor(hash<auto> oh) ;
1252
1253};
1254
1257
1258public:
1260 string name;
1261
1263 *string url;
1264
1266
1272 constructor(hash<auto> oh) ;
1273
1274};
1275
1277
1284
1285public:
1286protected:
1288 string pfx;
1289
1291 string name;
1292
1295
1298
1300 hash<string, PathComponent> paths;
1301
1302public:
1303
1305 constructor(hash<auto> oh, string pfx, SwaggerSchema swagger);
1306
1307
1309protected:
1310 constructor(string full_path, list<auto> l, int offset, hash<auto> oh);
1311public:
1312
1313
1315protected:
1316 add(string full_path, list<auto> l, int offset, hash<auto> oh, SwaggerSchema swagger);
1317public:
1318
1319
1321
1323 PathItemObject match(list<auto> path);
1324
1325
1327
1329 *PathItemObject tryMatch(list<auto> path);
1330
1331
1333
1335 getPathOperationHash(reference<hash<string, list<string>>> h);
1336
1337};
1338
1340class PathsObject : public ObjectBase {
1341
1342public:
1343protected:
1346
1347public:
1348
1350
1358 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1359
1360
1362
1364 PathItemObject match(string path);
1365
1366
1368
1371
1372
1374
1376 hash<string, list<string>> getPathOperationHash();
1377
1378};
1379
1381
1387
1388public:
1390
1395 *string ref;
1396
1399
1400protected:
1402
1412 hash<string, OperationObject> operations;
1413
1414public:
1415
1417
1426 constructor(string path, hash<auto> oh, SwaggerSchema swagger) ;
1427
1428
1430
1437 OperationObject getOperation(string method, string path);
1438
1439
1441
1443 softlist getMethods();
1444
1445};
1446
1449
1450public:
1452 string path;
1453
1455 string method;
1456
1458
1461 list tags;
1462
1464 *string summary;
1465
1467 *string desc;
1468
1470
1474 bool deprec = False;
1475
1478
1480
1487
1489
1494 hash<string, bool> consumes;
1495
1497
1502 hash<string, bool> produces;
1503
1505 hash<string, AbstractParameterObject> formData;
1506
1509
1512
1514
1518 list<string> schemes;
1519
1521
1533 list<hash<string, list<string>>> security;
1534
1536
1545 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1546
1547
1549 *data getRequestBody(PathItemObject pio, auto body, reference<hash<auto>> headers, *bool freeform);
1550
1551
1553
1564 validateRequest(bool serialize, PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers, *reference<hash<string, bool>> mime_types, *bool freeform);
1565
1566
1568
1578 parseRequest(PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers);
1579
1580
1582 validateResponse(string method, string path, PathItemObject pio, int http_code, reference<auto> response_body, reference<hash<string, bool>> mime_types, bool deserialize = True);
1583
1584
1586
1594 hash<RestQoreExampleCodeInfo> getQoreExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger);
1595
1596
1598
1607 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger, reference rbody);
1608
1609
1611
1618 hash<RestQoreExampleCodeInfo> getQoreExampleResponse(string method, string path, int code);
1619
1620
1622
1630 hash<RestExampleResponseInfo> getExampleResponse(string method, string path, int code, reference<auto> body);
1631
1632
1633protected:
1634 getQoreExampleParams(reference<hash<auto>> query, reference<hash<auto>> headers, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1635public:
1636
1637
1639protected:
1640 doDefaultParams(reference<hash<UriQueryInfo>> h, reference<hash> headers, reference<auto> body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1641public:
1642
1643
1645protected:
1646 checkMissingParams(hash<UriQueryInfo> h, *hash<auto> headers, auto body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1647public:
1648
1649
1651
1653protected:
1655public:
1656
1657
1659protected:
1660 error(string err, string fmt, ...);
1661public:
1662
1663};
1664
1667
1668public:
1670 *string desc;
1671
1673 string url;
1674
1676
1682 constructor(hash<auto> oh) ;
1683
1684};
1685
1687
1724
1725public:
1727
1734 string name;
1735
1737
1740 string inLoc;
1741
1743 *string desc;
1744
1746
1751 bool required = False;
1752
1753protected:
1754 const OtherParameterMap = ...;
1755
1756
1757public:
1758
1760
1767 constructor(hash<auto> oh, *int opt_flags) ;
1768
1769
1771 abstract check(bool serialize, bool request, string path, string method, string name, reference value);
1772
1775
1776
1778 static AbstractParameterObject newParameter(string name, hash<auto> oh, SwaggerSchema swagger);
1779};
1780
1783
1784public:
1787
1789
1796 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1797
1798
1800 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
1801
1802
1804 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv);
1805
1806
1807 // returns an example value for a REST API call
1811 auto getExampleValue(*hash<string, bool> emap, *string fname);
1812
1813};
1814
1817
1818public:
1820
1830 string type;
1831
1833 *string format;
1834
1836
1841 bool allowEmptyValue = False;
1842
1845
1847
1861
1863
1871
1873 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1874
1875
1877 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
1878
1879
1882
1883
1885 auto getExampleValue(*hash<string, bool> emap, *string fname);
1886
1887
1889protected:
1890 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
1891public:
1892
1893
1895protected:
1896 abstract setType(SwaggerSchema swagger);
1897public:
1898};
1899
1902
1903public:
1905 const ParameterTypes = ...;
1906
1907
1908 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1909
1910
1912protected:
1914public:
1915
1916};
1917
1920
1921public:
1924
1926
1936 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1937
1938
1940protected:
1942public:
1943
1944};
1945
1948
1949public:
1950 // The documentation of responses other than the ones declared for specific HTTP response codes.
1955
1956 // A hash mapping HTTP status codes to @ref ResponseObject "ResponseObjects".
1961 hash<string, ResponseObject> responses;
1962
1964
1974 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1975
1976};
1977
1980
1981public:
1983 string desc;
1984
1986
1993
1995
1998 hash<auto> headers;
1999
2001
2009
2011
2019protected:
2020 constructor(string key, hash<auto> oh, SwaggerSchema swagger) ;
2021public:
2022
2023
2025
2034 static ResponseObject newResponse(string key, hash<auto> oh, SwaggerSchema swagger);
2035};
2036
2038class HeaderObject : public ObjectBase, public SchemaBase {
2039
2040public:
2042 *string desc;
2043
2045
2049 string type;
2050
2052 *string format;
2053
2056
2058
2068
2070
2077
2079
2087 constructor(hash<auto> oh, SwaggerSchema swagger) ;
2088
2089
2091protected:
2092 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2093public:
2094
2095};
2096
2098class TagObject : public ObjectBase {
2099
2100public:
2102 string name;
2103
2105 *string desc;
2106
2109
2111
2117 constructor(hash<auto> oh) ;
2118
2119};
2120
2122class SchemaObject : public ObjectBase, public SchemaBase {
2123
2124public:
2126 string name;
2127
2129
2133 string type;
2134
2136 *string format;
2137
2139 *string title;
2140
2142 *string desc;
2143
2146
2149
2152
2155
2157
2159 bool nullable = False;
2160
2162
2166 hash<string, SchemaObject> properties;
2167
2169 hash<string, bool> nullable_properties;
2170
2172
2177
2179
2182 hash<string, bool> required;
2183
2185
2204
2206
2213 bool readOnly = False;
2214
2216
2224 list<SchemaObject> allOf();
2225
2227
2235
2238
2241
2243 *AbstractDataProviderType dataType;
2244
2246 *AbstractDataProviderType orNothingDataType;
2247
2249 const ScalarTypes = ...;
2250
2251
2253 const ReferenceTypes = ...;
2254
2255
2256protected:
2257 SwaggerSchema swagger;
2258
2259 // maps fields: name -> {Y,N} -> field
2260 hash<string, hash<string, AbstractDataField>> fieldmap;
2261
2262public:
2263
2265
2278protected:
2279 constructor(string name, hash<auto> oh, SwaggerSchema swagger, *string hash_str, *bool require_items) ;
2280public:
2281
2282
2283 replaceType(AbstractDataProviderType t);
2284
2285
2286 AbstractDataProviderType getDataType(bool required = True, *HTTPClient rest);
2287
2288
2290protected:
2291 AbstractDataProviderType getDataTypeIntern(string path, bool required = True, *HTTPClient rest);
2292public:
2293
2294
2296 AbstractDataField getField(string name, *string desc, bool required = True, *HTTPClient rest);
2297
2298
2300protected:
2301 static *AbstractDataField getCacheField(reference<hash<string, AbstractDataField>> h, string key);
2302public:
2303
2304
2306protected:
2307 getSchemaObjectFields(HashDataType type, string path, auto def_body);
2308public:
2309
2310
2312protected:
2313 AbstractDataField getFieldIntern(string path, string name, *string desc, bool required = True, *HTTPClient rest, auto default_value);
2314public:
2315
2316
2318 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv, string name, bool decl);
2319
2320
2321 // returns an example value for a REST API call
2322 auto getExampleValue(*hash<string, bool> emap, *string fname);
2323
2324
2326 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
2327
2328
2329protected:
2330 checkObjectProperty(string name, string prop);
2331public:
2332
2333
2334protected:
2335 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
2336public:
2337
2338
2340protected:
2341 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);
2342public:
2343
2344
2346protected:
2347 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2348public:
2349
2350
2352
2363 static SchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger, *bool require_items);
2364
2366
2368 static SchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger);
2369};
2370
2373
2374public:
2376
2390
2392
2404protected:
2405 constructor(string name, hash<auto> oh, SwaggerSchema swagger, *string inLoc) ;
2406public:
2407
2408
2410
2422 static ParameterItemsSchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger, *string inLoc);
2423
2425
2427 static ParameterItemsSchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger, *string inLoc);
2428};
2429
2431
2436class XmlObject : public ObjectBase {
2437
2438public:
2440
2447 *string name;
2448
2450 *string ns;
2451
2453 *string prefix;
2454
2456
2458 bool attribute = False;
2459
2461
2467 bool wrapped = False;
2468
2470
2475 constructor(hash<auto> oh) ;
2476
2477};
2478
2480
2486
2487public:
2489 string type;
2490
2492 *string desc;
2493
2495
2498 *string name;
2499
2501
2504 *string inLoc;
2505
2507
2512 *string flow;
2513
2515
2519
2521
2524 *string tokenUrl;
2525
2527
2535
2537
2546 constructor(hash<auto> oh) ;
2547
2548};
2549
2551class ScopesObject : public ObjectBase {
2552
2553public:
2555
2558 hash<string, string> fields;
2559
2561
2567 constructor(hash<auto> oh) ;
2568
2569};
2570};
2571
2572// private namespace for internal definitions
2573namespace Priv {
2574 // a set of string values
2575 const SwaggerListToStringSet = -1;
2576 // a set of any type that can be converted to a string
2577 const SwaggerListToAnySet = -2;
2578 const SwaggerListToHashOfStrings = -3;
2579
2580 const TypeMap = ...;
2581
2582
2584
2594 required_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2595
2596
2598
2608 required_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2609
2610
2612
2623 bool optional_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2624
2625
2627
2638 bool optional_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2639
2640
2642 *bool check_type_code(string objType, hash<auto> oh, string name, auto val, int typeCode, *int opt_flags);
2643
2644
2646 get_value(string objType, string name, int typeCode, auto val, reference<auto> target);
2647
2648
2650 string get_qore_type(string name, string type, *string format, *SchemaObject items);
2651
2652};
static auto deserialize(InputStream stream, *int flags)
serialize(OutputStream stream, *int flags)
Describes a single operation parameter.
Definition Swagger.qm.dox.h:1723
bool required
Determines whether this parameter is mandatory.
Definition Swagger.qm.dox.h:1751
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:1734
string inLoc
Required. The location of the parameter.
Definition Swagger.qm.dox.h:1740
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:1743
AbstractParameterObject specialization for "body" parameters.
Definition Swagger.qm.dox.h:1782
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:1786
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:1233
constructor(hash< auto > oh)
Constructor.
*string name
The identifying name of the contact person/organization.
Definition Swagger.qm.dox.h:1237
*string url
The URL pointing to the contact information. MUST be in the format of a URL.
Definition Swagger.qm.dox.h:1240
*string email
The email address of the contact person/organization. MUST be in the format of an email address.
Definition Swagger.qm.dox.h:1243
Allows referencing an external resource for extended documentation.
Definition Swagger.qm.dox.h:1666
*string desc
A short description of the target documentation. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1670
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:1673
AbstractParameterObject specialization for formData parameters
Definition Swagger.qm.dox.h:1901
setType(SwaggerSchema swagger)
Sets the parameter type.
const ParameterTypes
valid parameter types
Definition Swagger.qm.dox.h:1905
describes a single HTTP header
Definition Swagger.qm.dox.h:2038
*string desc
A short description of the header.
Definition Swagger.qm.dox.h:2042
*SchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition Swagger.qm.dox.h:2055
auto defaultVal
Declares the value of the header that the server will use if none is provided.
Definition Swagger.qm.dox.h:2076
string type
Required. The type of the object.
Definition Swagger.qm.dox.h:2049
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:2052
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:2067
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:1200
string version
Required. Provides the version of the application API (not to be confused with the specification vers...
Definition Swagger.qm.dox.h:1213
constructor(hash< auto > oh)
Constructor.
string title
Required. The title of the application.
Definition Swagger.qm.dox.h:1204
*LicenseObject license
The license information for the exposed API.
Definition Swagger.qm.dox.h:1219
*ContactObject contact
The contact information for the exposed API.
Definition Swagger.qm.dox.h:1216
*string termsOfService
The Terms of Service for the API.
Definition Swagger.qm.dox.h:1210
*string desc
A short description of the application. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1207
License information for the exposed API.
Definition Swagger.qm.dox.h:1256
constructor(hash< auto > oh)
Constructor.
string name
Required. The license name used for the API.
Definition Swagger.qm.dox.h:1260
*string url
A URL to the license used for the API. MUST be in the format of a URL.
Definition Swagger.qm.dox.h:1263
Base class for the Swagger specification objects, wrapping the vendor extensions.
Definition Swagger.qm.dox.h:337
initialize(hash< auto > oh)
Initialize.
hash< auto > vendorExtensions
Allows extensions to the Swagger Schema.
Definition Swagger.qm.dox.h:345
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:1448
list< string > schemes
The transfer protocol for the operation.
Definition Swagger.qm.dox.h:1518
*string desc
A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1467
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:1502
*ExternalDocumentationObject externalDocs
Additional external documentation for this operation.
Definition Swagger.qm.dox.h:1477
string path
the URI path for the operation
Definition Swagger.qm.dox.h:1452
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:1464
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:1455
AbstractParameterObject body
The body parameter, if defined.
Definition Swagger.qm.dox.h:1508
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:1511
*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:1461
*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:1486
hash< string, AbstractParameterObject > formData
formData parameter; if defined for this operation, body parameter will be excluded
Definition Swagger.qm.dox.h:1505
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:1533
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:1494
bool deprec
Declares this operation to be deprecated.
Definition Swagger.qm.dox.h:1474
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:1919
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:1923
Common class for objects that have parameters.
Definition Swagger.qm.dox.h:579
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:589
items schema object for non-body parameters
Definition Swagger.qm.dox.h:2372
*string collectionFormat
Determines the format of the array if type array is used.
Definition Swagger.qm.dox.h:2389
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:1283
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:1300
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:1291
*PathComponent wildcard
if there is a wildcard to a PathComponent
Definition Swagger.qm.dox.h:1294
string pfx
path prefix
Definition Swagger.qm.dox.h:1288
*PathItemObject pio
the PathItemObject associated with this path (if any)
Definition Swagger.qm.dox.h:1297
Describes the operations available on a single path.
Definition Swagger.qm.dox.h:1386
softlist getMethods()
returns a list of HTTP methods supported by this object
*string ref
Allows for an external definition of this path item.
Definition Swagger.qm.dox.h:1395
hash< string, OperationObject > operations
A hash of OperationObjects correspoding to different methods.
Definition Swagger.qm.dox.h:1412
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:1398
constructor(string path, hash< auto > oh, SwaggerSchema swagger)
Constructor.
This class stores the path tree for URI path matching.
Definition Swagger.qm.dox.h:1340
*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:1345
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:1979
*SchemaObject schema
A definition of the response structure.
Definition Swagger.qm.dox.h:1992
string desc
Required. A short description of the response. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1983
hash< auto > headers
A hash of headers that are (can be) sent with the response.
Definition Swagger.qm.dox.h:1998
hash examples
A hash of example response messages.
Definition Swagger.qm.dox.h:2008
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:1947
ResponseObject defaultResp
Definition Swagger.qm.dox.h:1954
constructor(string path, string method, hash< auto > oh, SwaggerSchema swagger)
Constructor.
hash< string, ResponseObject > responses
Definition Swagger.qm.dox.h:1961
Base used by OtherParameter, HeaderObject and SchemaObject.
Definition Swagger.qm.dox.h:370
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:383
*int minItems
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
Definition Swagger.qm.dox.h:398
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:410
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:395
*int minLength
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
Definition Swagger.qm.dox.h:389
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:374
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:386
*bool exclusiveMax
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
Definition Swagger.qm.dox.h:380
*bool uniqueItems
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
Definition Swagger.qm.dox.h:401
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:377
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:392
defines an object in a schema
Definition Swagger.qm.dox.h:2122
auto additionalProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.4.
Definition Swagger.qm.dox.h:2176
bool readOnly
Relevant only for Schema "properties" definitions. Declares the property as "read only".
Definition Swagger.qm.dox.h:2213
bool nullable
extension that allows types to be nullable
Definition Swagger.qm.dox.h:2159
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:2166
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:2136
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
AbstractDataField getField(string name, *string desc, bool required=True, *HTTPClient rest)
Returns a field definition from the Swagger parameter.
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:2151
string name
the name of this object for documentation and example purposes
Definition Swagger.qm.dox.h:2126
string type
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.2.
Definition Swagger.qm.dox.h:2133
*string discriminator
Adds support for polymorphism.
Definition Swagger.qm.dox.h:2203
*SchemaObject items
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.1.
Definition Swagger.qm.dox.h:2145
*XmlObject xml
This MAY be used only on properties schemas. It has no effect on root schemas.
Definition Swagger.qm.dox.h:2234
hash< string, bool > nullable_properties
extention to allow properties to be nullable
Definition Swagger.qm.dox.h:2169
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:2243
string getQoreExample(reference< hash< RestQoreExampleCodeInfo > > rv, string name, bool decl)
returns example Qore code for the object
*ExternalDocumentationObject externalDocs
Additional external documentation for this schema.
Definition Swagger.qm.dox.h:2237
const ScalarTypes
valid scalar types
Definition Swagger.qm.dox.h:2249
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:2142
*AbstractDataProviderType orNothingDataType
The data type of the schema (not required)
Definition Swagger.qm.dox.h:2246
auto defaultVal
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2.
Definition Swagger.qm.dox.h:2148
*string title
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.1.
Definition Swagger.qm.dox.h:2139
AbstractDataField getFieldIntern(string path, string name, *string desc, bool required=True, *HTTPClient rest, auto default_value)
Returns a field definition from the Swagger parameter.
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:2182
auto example
A free-form property to include an example of an instance for this schema.
Definition Swagger.qm.dox.h:2240
const ReferenceTypes
valid reference types
Definition Swagger.qm.dox.h:2253
*int minProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.2.
Definition Swagger.qm.dox.h:2154
Lists the available scopes for an OAuth2 security scheme.
Definition Swagger.qm.dox.h:2551
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:2558
Allows the definition of a security scheme that can be used by the operations.
Definition Swagger.qm.dox.h:2485
*string flow
The flow used by the OAuth2 security scheme.
Definition Swagger.qm.dox.h:2512
*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:2518
string type
Required. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
Definition Swagger.qm.dox.h:2489
*string inLoc
The location of the API key. Valid values are "query" or "header".
Definition Swagger.qm.dox.h:2504
constructor(hash< auto > oh)
Constructor.
*string name
The name of the header or query parameter to be used.
Definition Swagger.qm.dox.h:2498
*ScopesObject scopes
The available scopes for the OAuth2 security scheme.
Definition Swagger.qm.dox.h:2534
*string desc
A short description for security scheme.
Definition Swagger.qm.dox.h:2492
*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:2524
Used for loading the Swagger definitions.
Definition Swagger.qm.dox.h:517
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:605
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:752
hash< string, bool > produces
A set of MIME types (strings) the APIs can produce.
Definition Swagger.qm.dox.h:658
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:749
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:758
*string def_path
the default path to use when retrieving external schema references
Definition Swagger.qm.dox.h:729
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:690
hash< string, ResponseObject > responses
Response definitions that can be used across operations. This property does not define global respons...
Definition Swagger.qm.dox.h:670
*ExternalDocumentationObject externalDocs
Additional external documentation.
Definition Swagger.qm.dox.h:708
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:734
*string basePath
The base path on which the API is served, which is relative to the host.
Definition Swagger.qm.dox.h:636
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:737
hash< string, SecuritySchemeObject > securityDefinitions
Security scheme definitions that can be used across the specification.
Definition Swagger.qm.dox.h:676
*int opt_flags
parse option flags
Definition Swagger.qm.dox.h:740
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:705
string swaggerSpec
Swagger Specification version being used.
Definition Swagger.qm.dox.h:613
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:616
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:743
hash< auto > getExternalReference(string refstr)
retrieves external references
*string query_date_format
Date format for serializing dates in queries.
Definition Swagger.qm.dox.h:746
bool compact_serialization
if serialized data should be subject to compact serialization (default: True)
Definition Swagger.qm.dox.h:726
const SwaggerOptions
SwaggerSchema options.
Definition Swagger.qm.dox.h:721
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:628
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:651
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:644
PathsObject paths
Required. The available paths and operations for the API.
Definition Swagger.qm.dox.h:619
list< TagObject > tags
A list of tags used by the specification with additional metadata.
Definition Swagger.qm.dox.h:702
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:2098
*ExternalDocumentationObject externalDocs
Additional external documentation for this tag.
Definition Swagger.qm.dox.h:2108
*string desc
A short description for the tag. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:2105
string name
Required. The name of the tag.
Definition Swagger.qm.dox.h:2102
constructor(hash< auto > oh)
Constructor.
AbstractParameterObject specialization for parameters other than "body"
Definition Swagger.qm.dox.h:1816
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:1830
*ParameterItemsSchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition Swagger.qm.dox.h:1844
*string collectionFormat
Determines the format of the array if type array is used.
Definition Swagger.qm.dox.h:1860
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:1833
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:1841
auto defaultVal
Declares the value of the parameter that the server will use if none is provided.
Definition Swagger.qm.dox.h:1870
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:2436
bool wrapped
MAY be used only for an array definition.
Definition Swagger.qm.dox.h:2467
*string name
Replaces the name of the element/attribute used for the described schema property.
Definition Swagger.qm.dox.h:2447
bool attribute
Declares whether the property definition translates to an attribute instead of an element.
Definition Swagger.qm.dox.h:2458
constructor(hash< auto > oh)
Constructor.
*string prefix
The prefix to be used for the name.
Definition Swagger.qm.dox.h:2453
*string ns
The URL of the namespace definition. Value SHOULD be in the form of a URL.
Definition Swagger.qm.dox.h:2450
const LM_IGNORE_INVALID_PATHS
parse option: ignore invalid paths
Definition Swagger.qm.dox.h:286
const LM_OPTIONAL_REF_PROPERTIES
parse option: object properties with reference types are automatically optional
Definition Swagger.qm.dox.h:277
const LM_IGNORE_INVALID_REQUIRED
parse option: ignore invalid "required" properties
Definition Swagger.qm.dox.h:268
const LM_ALL
parse options: all options
Definition Swagger.qm.dox.h:289
const LM_ACCEPT_INVALID_BODY_PARAMS
parse option: reconstruct invalid body parameters
Definition Swagger.qm.dox.h:271
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:274
const LM_ACCEPT_ALL_PROPERTIES
parse option: accept additional properties without raising an error
Definition Swagger.qm.dox.h:280
const LM_LAX_COLLECTIONFORMAT
parse option: allow collectionFormat on non-array types
Definition Swagger.qm.dox.h:265
const LM_ACCEPT_QUERY_OBJECTS
parse option: accept object as a query parameter type (as with OpenApi 3+)
Definition Swagger.qm.dox.h:283
const LM_IGNORE_MISSING_REQUIRED
Definition Swagger.qm.dox.h:262
main namespace for all public Swagger declarations
Definition Swagger.qm.dox.h:256
const CollectionFormats
allowed collection formats
Definition Swagger.qm.dox.h:301
const ValidNumberFormats
Valid number type formats.
Definition Swagger.qm.dox.h:296
const ValidStringFormatsHash
A hash of valid string type formats.
Definition Swagger.qm.dox.h:313
const ValidNumberFormatsHash
A hash of valid number type formats.
Definition Swagger.qm.dox.h:311
const ParameterCollectionFormats
valid parameter collection formats
Definition Swagger.qm.dox.h:305
const SerializationModules
modules available for data serialization and/or deserialization
Definition Swagger.qm.dox.h:327
const ValidStringFormats
Valid string type formats.
Definition Swagger.qm.dox.h:298
const ValidIntFormatsHash
A hash of valid integer type formats.
Definition Swagger.qm.dox.h:309
const MimeDataTypes
supported mime types for de/serializing data
Definition Swagger.qm.dox.h:323
const MimeContentTypes
MIME types for data serialization.
Definition Swagger.qm.dox.h:330
const ValidIntFormats
Valid integer type formats.
Definition Swagger.qm.dox.h:294
const YamlSerialization
Yaml serialization.
Definition Swagger.qm.dox.h:316
const ValidSchemes
Valid transfer protocol schemes.
Definition Swagger.qm.dox.h:333