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 *softfloat maximum;
378
380 *softfloat 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:
429public:
430
431
433protected:
434 auto getExampleValueWithFormat(string type, *string format, *string fname);
435public:
436
437
439protected:
440 check(bool serialize, bool request, string type, *string format, *SchemaObject items, string path, string method, string name, reference<auto> value);
441public:
442
443
444protected:
445 checkStringIntern(string path, string method, string name, string value);
446public:
447
448
449protected:
450 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, list<auto> v, reference<list> value);
451public:
452
453
454protected:
455 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash<auto> v, reference<hash> value);
456public:
457
458
459protected:
460 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, int v, reference<auto> value);
461public:
462
463
464protected:
465 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, number v, reference<number> value);
466public:
467
468
469protected:
470 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, float v, reference<number> value);
471public:
472
473
474protected:
475 checkInternNumber(bool serialize, bool request, string type, *string format, string path, string method, string name, auto v, reference<auto> value);
476public:
477
478
480protected:
481 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, binary v, reference value);
482public:
483
484
486protected:
487 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, string v, reference<auto> value);
488public:
489
490
492protected:
493 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, date v, reference<auto> value);
494public:
495
496
497protected:
498 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, bool v, reference<bool> value);
499public:
500
501
502protected:
503 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
504public:
505
506
508protected:
509 checkArrayParam(bool serialize, bool request, SchemaObject items, string path, string method, string name, reference<list<auto>> value);
510public:
511
512
514protected:
515 static throwInvalidType(string name, string actual, string expected, auto value);
516public:
517
518
520
522 static bool checkValueType(reference<auto> value, string type);
523};
524
527
528public:
530
539 static SwaggerSchema fromString(string swaggerSpecification, *bool json, *hash<auto> opts);
540
542
551 static SwaggerSchema fromFile(string filepath, *hash<auto> opts);
552
554
566 static SwaggerSchema fromUrl(string url, *bool json, *hash<auto> opts);
567
569
578 static hash<auto> parseSchemaContent(string filepath, string str);
579
581 static hash<auto> parseSchemaSource(string str, string ser);
582
584 static string detectSourceEncoding(string str);
585};
586
589
590public:
592
595 hash<string, AbstractParameterObject> parameters();
596
598 string query_obj;
599
601 constructor(hash<auto> oh) ;
602
603
606
607
610
611};
612
614class SwaggerSchema : public ParameterGroup, public AbstractRestSchemaValidator {
615
616public:
618
623
626
629
631
637 *string host;
638
640
645 *string basePath;
646
648
653 hash<string, bool> schemes;
654
656
660 hash<string, bool> consumes;
661
663
667 hash<string, bool> produces;
668
670
673 hash<string, SchemaObject> definitions();
674
676
679 hash<string, ResponseObject> responses;
680
682
685 hash<string, SecuritySchemeObject> securityDefinitions;
686
688
699 hash<string, softlist<string>> security;
700
702
711 list<TagObject> tags;
712
714 hash<auto> store;
715
718
720
730 const SwaggerOptions = ...;
731
732
733protected:
736
738 *string def_path;
739
741
744
746 string hash_str;
747
750
752 *softbool utc_dates;
753
756
758 hash<string, hash<string, SchemaObject>> so_map;
759
761 hash<string, hash<string, AbstractDataProviderType>> typemap;
762
763public:
764
765private:
768
769public:
770
772
784 constructor(string schema_source, hash<auto> oh, *hash<auto> opts) ;
785
786
788
800 constructor(LoggerInterface logger, string schema_source, hash<auto> oh, *hash<auto> opts) ;
801
802
804protected:
805 constructorIntern(string schema_source, hash<auto> oh, *hash<auto> opts);
806public:
807
808
809 *int getParseFlags();
810
811
812 *bool getUtcDates();
813
814
815 *string getQueryDateFormat();
816
817
818 *SchemaObject tryGetSchemaObject(string name, hash<auto> oh, reference<string> hash_str);
819
820
821 cacheSchemaObject(string name, string hash_str, SchemaObject so);
822
823
825
827 SchemaObject resolveSchemaObject(string name, string refstr, hash<auto> oh);
828
829
831
833 ParameterItemsSchemaObject resolveParameterItemsSchemaObject(string name, string refstr, hash<auto> oh, *string inLoc);
834
835
837
839 AbstractParameterObject resolveParameter(string name, string refstr, hash<auto> oh);
840
841
843
845 ResponseObject resolveResponse(string name, string refstr, hash<auto> oh);
846
847
849 AbstractDataProviderType getTypeForReference(string rstr, bool required = True, *HTTPClient rest);
850
851
852 replaceTypeForReference(string rstr, AbstractDataProviderType t);
853
854
856 AbstractDataProviderType getType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True);
857
858
859protected:
860 *AbstractDataProviderType checkType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True, reference<string> id);
861public:
862
863
865protected:
866 AbstractDataProviderType getTypeIntern(string path, string typestr, *string format, *SchemaObject arrayItems, bool required = True);
867public:
868
869
871 AbstractDataProviderType getSchemaDataType(string path, SchemaObject schema, bool required = True, *HTTPClient rest);
872
873
875 AbstractDataField getFieldFromSchema(string name, *string desc, SchemaObject schema, bool required = True, *HTTPClient rest);
876
877
879 addFieldsFromParameters(HashDataType rv, hash<string, AbstractParameterObject> parameters, reference<bool> required);
880
881
883 AbstractDataField getFieldForHeaders(string name, hash<auto> headers);
884
885
887 static *AbstractDataProviderType getCacheType(reference<hash<string, AbstractDataProviderType>> h, string key);
888
890 AbstractDataField getFieldFromParameter(string path, string name, string type, *string format, *SchemaObject arrayItems, *string desc, bool required, *list<auto> allowed_values, auto default_value);
891
892
894protected:
895 addFieldsFromParametersIntern(HashDataType rv, hash<string, AbstractParameterObject> parameters, reference<bool> required);
896public:
897
898
900
904protected:
905 string getHashImpl();
906public:
907
908
910
914protected:
916public:
917
918
920
933protected:
934 hash<RestSchemaValidator::RestRequestClientInfo> processRequestImpl(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types);
935public:
936
937
939
950protected:
951 hash<RestSchemaValidator::RestRequestServerInfo> parseRequestImpl(string method, string path, *data http_body, reference<hash> headers);
952public:
953
954
956
975protected:
976 hash<HttpResponseInfo> processResponseImpl(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types);
977public:
978
979
981
991protected:
992 hash<RestSchemaValidator::RestResponseClientInfo> parseResponseImpl(string method, string path, int code, *data response_body, hash<auto> hdr);
993public:
994
995
997protected:
998 fixPath(reference<string> path);
999public:
1000
1001
1003
1005protected:
1006 hash<string, list<string>> getPathOperationHashImpl();
1007public:
1008
1009
1011
1015protected:
1017public:
1018
1019
1021
1023protected:
1025public:
1026
1027
1029
1034protected:
1035 hash<RestQoreExampleCodeInfo> getQoreExampleRequestImpl(string method, string path);
1036public:
1037
1038
1040
1046protected:
1047 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequestImpl(string method, string path, *softlist<string> content_types);
1048public:
1049
1050
1052
1058protected:
1059 hash<RestQoreExampleCodeInfo> getQoreExampleResponseImpl(string method, string path, int code);
1060public:
1061
1062
1064
1071protected:
1072 hash<RestExampleResponseInfo> getExampleResponseImpl(string method, string path, int code, *softlist<string> content_types);
1073public:
1074
1075
1077
1079protected:
1080 hash<auto> getExternalReference(string refstr);
1081public:
1082
1083
1085
1089protected:
1090 AbstractDataProvider getDataProviderImpl(HTTPClient rest);
1091public:
1092
1093
1095
1099protected:
1101public:
1102
1103
1105
1109protected:
1111public:
1112
1113
1115
1129private:
1130 hash<RestSchemaValidator::RestRequestClientInfo> processRequestIntern(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1131public:
1132
1133
1135
1155private:
1156 hash<HttpResponseInfo> processResponseIntern(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1157public:
1158
1159
1161
1169private:
1170 bool checkRequestContentTypeHeader(reference<hash<RestRequestClientInfo>> req, auto body, *hash<auto> headers);
1171public:
1172
1173
1175
1183private:
1184 bool checkResponseContentTypeHeader(reference<hash<HttpResponseInfo>> resp, auto body, *hash<auto> headers);
1185public:
1186
1187
1189
1196private:
1197 bool checkResponseTextPlain(reference<hash<HttpResponseInfo>> resp, auto body, hash<string, bool> mime_types, *list<auto> content_types);
1198public:
1199
1200
1202private:
1203 SchemaObject processDefinition(string key, auto value);
1204public:
1205
1206};
1207
1209class InfoObject : public ObjectBase {
1210
1211public:
1213 string title;
1214
1216 *string desc;
1217
1220
1222 string version;
1223
1226
1229
1231
1237 constructor(hash<auto> oh) ;
1238
1239};
1240
1243
1244public:
1246 *string name;
1247
1249 *string url;
1250
1252 *string email;
1253
1255
1260 constructor(hash<auto> oh) ;
1261
1262};
1263
1266
1267public:
1269 string name;
1270
1272 *string url;
1273
1275
1281 constructor(hash<auto> oh) ;
1282
1283};
1284
1286
1293
1294public:
1295protected:
1297 string pfx;
1298
1300 string name;
1301
1304
1307
1309 hash<string, PathComponent> paths;
1310
1311public:
1312
1314 constructor(hash<auto> oh, string pfx, SwaggerSchema swagger);
1315
1316
1318protected:
1319 constructor(string full_path, list<auto> l, int offset, hash<auto> oh);
1320public:
1321
1322
1324protected:
1325 add(string full_path, list<auto> l, int offset, hash<auto> oh, SwaggerSchema swagger);
1326public:
1327
1328
1330
1332 PathItemObject match(list<auto> path);
1333
1334
1336
1338 *PathItemObject tryMatch(list<auto> path);
1339
1340
1342
1344 getPathOperationHash(reference<hash<string, list<string>>> h);
1345
1346};
1347
1349class PathsObject : public ObjectBase {
1350
1351public:
1352protected:
1355
1356public:
1357
1359
1367 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1368
1369
1371
1373 PathItemObject match(string path);
1374
1375
1377
1380
1381
1383
1385 hash<string, list<string>> getPathOperationHash();
1386
1387};
1388
1390
1396
1397public:
1399
1404 *string ref;
1405
1408
1409protected:
1411
1421 hash<string, OperationObject> operations;
1422
1424 const ObjType = "Path Item";
1425
1426public:
1427
1429
1438 constructor(string path, hash<auto> oh, SwaggerSchema swagger) ;
1439
1440
1442 merge(string path, hash<auto> oh, SwaggerSchema swagger);
1443
1444
1446
1453 OperationObject getOperation(string method, string path);
1454
1455
1457
1459 softlist getMethods();
1460
1461};
1462
1465
1466public:
1468 string path;
1469
1471 string method;
1472
1474
1477 list tags;
1478
1480 *string summary;
1481
1483 *string desc;
1484
1486
1490 bool deprec = False;
1491
1494
1496
1503
1505
1510 hash<string, bool> consumes;
1511
1513
1518 hash<string, bool> produces;
1519
1521 hash<string, AbstractParameterObject> formData;
1522
1525
1528
1530
1534 list<string> schemes;
1535
1537
1549 list<hash<string, list<string>>> security;
1550
1552
1561 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1562
1563
1565 *data getRequestBody(PathItemObject pio, auto body, reference<hash<auto>> headers, *bool freeform);
1566
1567
1569
1580 validateRequest(bool serialize, PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers, *reference<hash<string, bool>> mime_types, *bool freeform);
1581
1582
1584
1594 parseRequest(PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers);
1595
1596
1598 validateResponse(string method, string path, PathItemObject pio, int http_code, reference<auto> response_body, reference<hash<string, bool>> mime_types, bool deserialize = True);
1599
1600
1602
1610 hash<RestQoreExampleCodeInfo> getQoreExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger);
1611
1612
1614
1623 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger, reference rbody);
1624
1625
1627
1634 hash<RestQoreExampleCodeInfo> getQoreExampleResponse(string method, string path, int code);
1635
1636
1638
1646 hash<RestExampleResponseInfo> getExampleResponse(string method, string path, int code, reference<auto> body);
1647
1648
1649protected:
1650 getQoreExampleParams(reference<hash<auto>> query, reference<hash<auto>> headers, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1651public:
1652
1653
1655protected:
1656 doDefaultParams(reference<hash<UriQueryInfo>> h, reference<hash> headers, reference<auto> body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1657public:
1658
1659
1661protected:
1662 checkMissingParams(hash<UriQueryInfo> h, *hash<auto> headers, auto body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1663public:
1664
1665
1667
1669protected:
1671public:
1672
1673
1675protected:
1676 error(string err, string fmt, ...);
1677public:
1678
1679};
1680
1683
1684public:
1686 *string desc;
1687
1689 string url;
1690
1692
1698 constructor(hash<auto> oh) ;
1699
1700};
1701
1703
1740
1741public:
1743
1750 string name;
1751
1753
1756 string inLoc;
1757
1759 *string desc;
1760
1762
1767 bool required = False;
1768
1769protected:
1770 const OtherParameterMap = ...;
1771
1772
1773public:
1774
1776
1783 constructor(hash<auto> oh, *int opt_flags) ;
1784
1785
1787 abstract check(bool serialize, bool request, string path, string method, string name, reference value);
1788
1791
1792
1794 static AbstractParameterObject newParameter(string name, hash<auto> oh, SwaggerSchema swagger);
1795};
1796
1799
1800public:
1803
1805
1812 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1813
1814
1816 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
1817
1818
1820 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv);
1821
1822
1823 // returns an example value for a REST API call
1827 auto getExampleValue(*hash<string, bool> emap, *string fname);
1828
1829};
1830
1833
1834public:
1836
1846 string type;
1847
1849 *string format;
1850
1852
1857 bool allowEmptyValue = False;
1858
1861
1863
1877
1879
1887
1889 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1890
1891
1893 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
1894
1895
1898
1899
1901 auto getExampleValue(*hash<string, bool> emap, *string fname);
1902
1903
1905protected:
1906 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
1907public:
1908
1909
1911protected:
1912 abstract setType(SwaggerSchema swagger);
1913public:
1914};
1915
1918
1919public:
1921 const ParameterTypes = ...;
1922
1923
1924 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1925
1926
1928protected:
1930public:
1931
1932};
1933
1936
1937public:
1940
1942
1952 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1953
1954
1956protected:
1958public:
1959
1960};
1961
1964
1965public:
1966 // The documentation of responses other than the ones declared for specific HTTP response codes.
1971
1972 // A hash mapping HTTP status codes to @ref ResponseObject "ResponseObjects".
1977 hash<string, ResponseObject> responses;
1978
1980
1990 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1991
1992};
1993
1996
1997public:
1999 string desc;
2000
2002
2009
2011
2014 hash<auto> headers;
2015
2017
2025
2027
2035protected:
2036 constructor(string key, hash<auto> oh, SwaggerSchema swagger) ;
2037public:
2038
2039
2041
2050 static ResponseObject newResponse(string key, hash<auto> oh, SwaggerSchema swagger);
2051};
2052
2054class HeaderObject : public ObjectBase, public SchemaBase {
2055
2056public:
2058 *string desc;
2059
2061
2065 string type;
2066
2068 *string format;
2069
2072
2074
2084
2086
2093
2095
2103 constructor(hash<auto> oh, SwaggerSchema swagger) ;
2104
2105
2107protected:
2108 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2109public:
2110
2111};
2112
2114class TagObject : public ObjectBase {
2115
2116public:
2118 string name;
2119
2121 *string desc;
2122
2125
2127
2133 constructor(hash<auto> oh) ;
2134
2135};
2136
2138class SchemaObject : public ObjectBase, public SchemaBase {
2139
2140public:
2142 string name;
2143
2145
2149 string type;
2150
2152 *string format;
2153
2155 *string title;
2156
2158 *string desc;
2159
2162
2165
2168
2171
2173
2175 bool nullable = False;
2176
2178
2182 hash<string, SchemaObject> properties;
2183
2185 hash<string, bool> nullable_properties;
2186
2188
2193
2195
2198 hash<string, bool> required;
2199
2201
2220
2222
2229 bool readOnly = False;
2230
2232
2240 list<SchemaObject> allOf();
2241
2243
2251
2254
2257
2259 *AbstractDataProviderType dataType;
2260
2262 *AbstractDataProviderType orNothingDataType;
2263
2265 const ScalarTypes = ...;
2266
2267
2269 const ReferenceTypes = ...;
2270
2271
2272protected:
2273 SwaggerSchema swagger;
2274
2275 // maps fields: name -> {Y,N} -> field
2276 hash<string, hash<string, AbstractDataField>> fieldmap;
2277
2278public:
2279
2281
2294protected:
2295 constructor(string name, hash<auto> oh, SwaggerSchema swagger, *string hash_str, *bool require_items) ;
2296public:
2297
2298
2300protected:
2302public:
2303
2304
2305protected:
2306 addProperties(hash<string, auto> props, *int opt_flags);
2307public:
2308
2309
2310 replaceType(AbstractDataProviderType t);
2311
2312
2313 AbstractDataProviderType getDataType(bool required = True, *HTTPClient rest);
2314
2315
2317protected:
2318 AbstractDataProviderType getDataTypeIntern(string path, bool required = True, *HTTPClient rest);
2319public:
2320
2321
2323 AbstractDataField getField(string name, *string desc, bool required = True, *HTTPClient rest, auto default_value);
2324
2325
2327 AbstractDataField getField(string path, string name, *string desc, bool required = True, *HTTPClient rest, auto default_value);
2328
2329
2331protected:
2332 static *AbstractDataField getCacheField(reference<hash<string, AbstractDataField>> h, string key);
2333public:
2334
2335
2337protected:
2338 getSchemaObjectFields(HashDataType type, string path, auto def_body);
2339public:
2340
2341
2343protected:
2344 AbstractDataField getFieldIntern(string path, string name, *string desc, bool required = True, *HTTPClient rest, auto default_value, *string rstr);
2345public:
2346
2347
2349 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv, string name, bool decl);
2350
2351
2352 // returns an example value for a REST API call
2353 auto getExampleValue(*hash<string, bool> emap, *string fname);
2354
2355
2357 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
2358
2359
2360protected:
2361 checkObjectProperty(string name, string prop);
2362public:
2363
2364
2365protected:
2366 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
2367public:
2368
2369
2371protected:
2372 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);
2373public:
2374
2375
2377protected:
2378 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2379public:
2380
2381
2383
2394 static SchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger, *bool require_items);
2395
2397
2399 static SchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger);
2400};
2401
2404
2405public:
2407
2421
2424
2425
2427
2439protected:
2440 constructor(string name, hash<auto> oh, SwaggerSchema swagger, *string inLoc) ;
2441public:
2442
2443
2445
2457 static ParameterItemsSchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger, *string inLoc);
2458
2460
2462 static ParameterItemsSchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger, *string inLoc);
2463};
2464
2466
2471class XmlObject : public ObjectBase {
2472
2473public:
2475
2482 *string name;
2483
2485 *string ns;
2486
2488 *string prefix;
2489
2491
2493 bool attribute = False;
2494
2496
2502 bool wrapped = False;
2503
2505
2510 constructor(hash<auto> oh) ;
2511
2512};
2513
2515
2521
2522public:
2524 string type;
2525
2527 *string desc;
2528
2530
2533 *string name;
2534
2536
2539 *string inLoc;
2540
2542
2547 *string flow;
2548
2550
2554
2556
2559 *string tokenUrl;
2560
2562
2570
2572
2581 constructor(hash<auto> oh) ;
2582
2583};
2584
2586class ScopesObject : public ObjectBase {
2587
2588public:
2590
2593 hash<string, string> fields;
2594
2596
2602 constructor(hash<auto> oh) ;
2603
2604};
2605};
2606
2607// private namespace for internal definitions
2608namespace Priv {
2609 // a set of string values
2610 const SwaggerListToStringSet = -1;
2611 // a set of any type that can be converted to a string
2612 const SwaggerListToAnySet = -2;
2613 const SwaggerListToHashOfStrings = -3;
2614
2615 const TypeMap = ...;
2616
2617
2619
2629 required_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2630
2631
2633
2643 required_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2644
2645
2647
2658 bool optional_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2659
2660
2662
2673 bool optional_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2674
2675
2677 *bool check_type_code(string objType, hash<auto> oh, string name, auto val, int typeCode, *int opt_flags);
2678
2679
2681 get_value(string objType, string name, int typeCode, auto val, reference<auto> target);
2682
2683
2685 string get_qore_type(string name, string type, *string format, *SchemaObject items);
2686
2687};
static auto deserialize(InputStream stream, *int flags)
serialize(OutputStream stream, *int flags)
Describes a single operation parameter.
Definition Swagger.qm.dox.h:1739
bool required
Determines whether this parameter is mandatory.
Definition Swagger.qm.dox.h:1767
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:1750
string inLoc
Required. The location of the parameter.
Definition Swagger.qm.dox.h:1756
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:1759
AbstractParameterObject specialization for "body" parameters.
Definition Swagger.qm.dox.h:1798
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:1802
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:1242
constructor(hash< auto > oh)
Constructor.
*string name
The identifying name of the contact person/organization.
Definition Swagger.qm.dox.h:1246
*string url
The URL pointing to the contact information. MUST be in the format of a URL.
Definition Swagger.qm.dox.h:1249
*string email
The email address of the contact person/organization. MUST be in the format of an email address.
Definition Swagger.qm.dox.h:1252
Allows referencing an external resource for extended documentation.
Definition Swagger.qm.dox.h:1682
*string desc
A short description of the target documentation. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1686
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:1689
AbstractParameterObject specialization for formData parameters
Definition Swagger.qm.dox.h:1917
setType(SwaggerSchema swagger)
Sets the parameter type.
const ParameterTypes
valid parameter types
Definition Swagger.qm.dox.h:1921
describes a single HTTP header
Definition Swagger.qm.dox.h:2054
*string desc
A short description of the header.
Definition Swagger.qm.dox.h:2058
*SchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition Swagger.qm.dox.h:2071
auto defaultVal
Declares the value of the header that the server will use if none is provided.
Definition Swagger.qm.dox.h:2092
string type
Required. The type of the object.
Definition Swagger.qm.dox.h:2065
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:2068
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:2083
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:1209
string version
Required. Provides the version of the application API (not to be confused with the specification vers...
Definition Swagger.qm.dox.h:1222
constructor(hash< auto > oh)
Constructor.
string title
Required. The title of the application.
Definition Swagger.qm.dox.h:1213
*LicenseObject license
The license information for the exposed API.
Definition Swagger.qm.dox.h:1228
*ContactObject contact
The contact information for the exposed API.
Definition Swagger.qm.dox.h:1225
*string termsOfService
The Terms of Service for the API.
Definition Swagger.qm.dox.h:1219
*string desc
A short description of the application. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1216
License information for the exposed API.
Definition Swagger.qm.dox.h:1265
constructor(hash< auto > oh)
Constructor.
string name
Required. The license name used for the API.
Definition Swagger.qm.dox.h:1269
*string url
A URL to the license used for the API. MUST be in the format of a URL.
Definition Swagger.qm.dox.h:1272
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:1464
list< string > schemes
The transfer protocol for the operation.
Definition Swagger.qm.dox.h:1534
*string desc
A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1483
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:1518
*ExternalDocumentationObject externalDocs
Additional external documentation for this operation.
Definition Swagger.qm.dox.h:1493
string path
the URI path for the operation
Definition Swagger.qm.dox.h:1468
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:1480
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:1471
AbstractParameterObject body
The body parameter, if defined.
Definition Swagger.qm.dox.h:1524
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:1527
*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:1477
*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:1502
hash< string, AbstractParameterObject > formData
formData parameter; if defined for this operation, body parameter will be excluded
Definition Swagger.qm.dox.h:1521
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:1549
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:1510
bool deprec
Declares this operation to be deprecated.
Definition Swagger.qm.dox.h:1490
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:1935
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:1939
Common class for objects that have parameters.
Definition Swagger.qm.dox.h:588
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:598
items schema object for non-body parameters
Definition Swagger.qm.dox.h:2403
*string collectionFormat
Determines the format of the array if type array is used.
Definition Swagger.qm.dox.h:2420
static ParameterItemsSchemaObject newSchemaObject(string name, hash< auto > oh, SwaggerSchema swagger, *string inLoc)
returns a SchemaObject for the schema definition; resolves references
constructor(SchemaObject o)
Copy constructor.
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:1292
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:1309
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:1300
*PathComponent wildcard
if there is a wildcard to a PathComponent
Definition Swagger.qm.dox.h:1303
string pfx
path prefix
Definition Swagger.qm.dox.h:1297
*PathItemObject pio
the PathItemObject associated with this path (if any)
Definition Swagger.qm.dox.h:1306
Describes the operations available on a single path.
Definition Swagger.qm.dox.h:1395
softlist getMethods()
returns a list of HTTP methods supported by this object
const ObjType
This objet type.
Definition Swagger.qm.dox.h:1424
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:1404
hash< string, OperationObject > operations
A hash of OperationObjects correspoding to different methods.
Definition Swagger.qm.dox.h:1421
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:1407
constructor(string path, hash< auto > oh, SwaggerSchema swagger)
Constructor.
This class stores the path tree for URI path matching.
Definition Swagger.qm.dox.h:1349
*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:1354
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:1995
*SchemaObject schema
A definition of the response structure.
Definition Swagger.qm.dox.h:2008
string desc
Required. A short description of the response. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:1999
hash< auto > headers
A hash of headers that are (can be) sent with the response.
Definition Swagger.qm.dox.h:2014
hash examples
A hash of example response messages.
Definition Swagger.qm.dox.h:2024
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:1963
ResponseObject defaultResp
Definition Swagger.qm.dox.h:1970
constructor(string path, string method, hash< auto > oh, SwaggerSchema swagger)
Constructor.
hash< string, ResponseObject > responses
Definition Swagger.qm.dox.h:1977
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
constructor()
Private constructor.
*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
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
*softfloat maximum
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
Definition Swagger.qm.dox.h:377
*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
*softfloat 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:2138
auto additionalProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.4.
Definition Swagger.qm.dox.h:2192
bool readOnly
Relevant only for Schema "properties" definitions. Declares the property as "read only".
Definition Swagger.qm.dox.h:2229
bool nullable
extension that allows types to be nullable
Definition Swagger.qm.dox.h:2175
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:2182
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:2152
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:2167
string name
the name of this object for documentation and example purposes
Definition Swagger.qm.dox.h:2142
string type
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.2.
Definition Swagger.qm.dox.h:2149
*string discriminator
Adds support for polymorphism.
Definition Swagger.qm.dox.h:2219
*SchemaObject items
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.1.
Definition Swagger.qm.dox.h:2161
*XmlObject xml
This MAY be used only on properties schemas. It has no effect on root schemas.
Definition Swagger.qm.dox.h:2250
constructor(SchemaObject o)
Private copy constructor.
hash< string, bool > nullable_properties
extention to allow properties to be nullable
Definition Swagger.qm.dox.h:2185
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:2259
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:2253
const ScalarTypes
valid scalar types
Definition Swagger.qm.dox.h:2265
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:2158
*AbstractDataProviderType orNothingDataType
The data type of the schema (not required)
Definition Swagger.qm.dox.h:2262
auto defaultVal
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2.
Definition Swagger.qm.dox.h:2164
*string title
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.1.
Definition Swagger.qm.dox.h:2155
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:2198
auto example
A free-form property to include an example of an instance for this schema.
Definition Swagger.qm.dox.h:2256
const ReferenceTypes
valid reference types
Definition Swagger.qm.dox.h:2269
*int minProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.2.
Definition Swagger.qm.dox.h:2170
Lists the available scopes for an OAuth2 security scheme.
Definition Swagger.qm.dox.h:2586
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:2593
Allows the definition of a security scheme that can be used by the operations.
Definition Swagger.qm.dox.h:2520
*string flow
The flow used by the OAuth2 security scheme.
Definition Swagger.qm.dox.h:2547
*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:2553
string type
Required. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
Definition Swagger.qm.dox.h:2524
*string inLoc
The location of the API key. Valid values are "query" or "header".
Definition Swagger.qm.dox.h:2539
constructor(hash< auto > oh)
Constructor.
*string name
The name of the header or query parameter to be used.
Definition Swagger.qm.dox.h:2533
*ScopesObject scopes
The available scopes for the OAuth2 security scheme.
Definition Swagger.qm.dox.h:2569
*string desc
A short description for security scheme.
Definition Swagger.qm.dox.h:2527
*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:2559
Used for loading the Swagger definitions.
Definition Swagger.qm.dox.h:526
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:614
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:761
hash< string, bool > produces
A set of MIME types (strings) the APIs can produce.
Definition Swagger.qm.dox.h:667
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:758
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:767
*string def_path
the default path to use when retrieving external schema references
Definition Swagger.qm.dox.h:738
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:699
hash< string, ResponseObject > responses
Response definitions that can be used across operations. This property does not define global respons...
Definition Swagger.qm.dox.h:679
*ExternalDocumentationObject externalDocs
Additional external documentation.
Definition Swagger.qm.dox.h:717
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:743
*string basePath
The base path on which the API is served, which is relative to the host.
Definition Swagger.qm.dox.h:645
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:746
hash< string, SecuritySchemeObject > securityDefinitions
Security scheme definitions that can be used across the specification.
Definition Swagger.qm.dox.h:685
*int opt_flags
parse option flags
Definition Swagger.qm.dox.h:749
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:714
string swaggerSpec
Swagger Specification version being used.
Definition Swagger.qm.dox.h:622
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:625
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:752
hash< auto > getExternalReference(string refstr)
retrieves external references
*string query_date_format
Date format for serializing dates in queries.
Definition Swagger.qm.dox.h:755
bool compact_serialization
if serialized data should be subject to compact serialization (default: True)
Definition Swagger.qm.dox.h:735
const SwaggerOptions
SwaggerSchema options.
Definition Swagger.qm.dox.h:730
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:637
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:660
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:653
PathsObject paths
Required. The available paths and operations for the API.
Definition Swagger.qm.dox.h:628
list< TagObject > tags
A list of tags used by the specification with additional metadata.
Definition Swagger.qm.dox.h:711
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:2114
*ExternalDocumentationObject externalDocs
Additional external documentation for this tag.
Definition Swagger.qm.dox.h:2124
*string desc
A short description for the tag. GFM syntax can be used for rich text representation.
Definition Swagger.qm.dox.h:2121
string name
Required. The name of the tag.
Definition Swagger.qm.dox.h:2118
constructor(hash< auto > oh)
Constructor.
AbstractParameterObject specialization for parameters other than "body"
Definition Swagger.qm.dox.h:1832
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:1846
*SchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition Swagger.qm.dox.h:1860
*string collectionFormat
Determines the format of the array if type array is used.
Definition Swagger.qm.dox.h:1876
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition Swagger.qm.dox.h:1849
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:1857
auto defaultVal
Declares the value of the parameter that the server will use if none is provided.
Definition Swagger.qm.dox.h:1886
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:2471
bool wrapped
MAY be used only for an array definition.
Definition Swagger.qm.dox.h:2502
*string name
Replaces the name of the element/attribute used for the described schema property.
Definition Swagger.qm.dox.h:2482
bool attribute
Declares whether the property definition translates to an attribute instead of an element.
Definition Swagger.qm.dox.h:2493
constructor(hash< auto > oh)
Constructor.
*string prefix
The prefix to be used for the name.
Definition Swagger.qm.dox.h:2488
*string ns
The URL of the namespace definition. Value SHOULD be in the form of a URL.
Definition Swagger.qm.dox.h:2485
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