Qore Swagger Module Reference 2.2.1
Loading...
Searching...
No Matches
Swagger.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* Swagger.qm Copyright (C) 2017 - 2023 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
243namespace Swagger {
250
252const LM_LAX_COLLECTIONFORMAT = (1 << 1);
253
256
259
261const LM_AUTO_FORM_DATA = (1 << 4);
262
264const LM_ALL = ...;
265
267
269const ValidIntFormats = ("int32", "int64");
271const ValidNumberFormats = ("double", "float");
273const ValidStringFormats = ("binary", "byte", "date", "date-time", "password");
274
277
278
281
282
284const ValidIntFormatsHash = map {$1: True}, ValidIntFormats;
289
292 "serialize": \make_yaml(),
293 "serialize_verbose": string sub (auto val) {return make_yaml(val, BlockStyle);},
294 "deserialize": \parse_yaml(),
295 "module": "yaml",
296};
297
300%ifndef NoJson
301 MimeTypeJson: (
302 "serialize": \make_json(),
303 "serialize_verbose": string sub (auto val) {return make_json(val, JGF_ADD_FORMATTING);},
304 "deserialize": \parse_json(),
305 "module": "json",
306 ),
307%endif
308%ifndef NoYaml
309 // issue #3699: more YAML MIME types must be supported
310 MimeTypeYaml: YamlSerialization,
311 MimeTypeYamlRpc: YamlSerialization,
312 "text/yaml": YamlSerialization,
313 "application/yaml": YamlSerialization,
314%endif
315%ifndef NoXml
316 MimeTypeXmlApp: (
317 "serialize": \make_xml(),
318 "serialize_verbose": string sub (auto val) {return make_xml(val, XGF_ADD_FORMATTING);},
319 "deserialize": \parse_xml(),
320 "module": "xml",
321 ),
322%endif
323 # Content-Type: application/x-www-form-urlencoded
324 MimeTypeFormUrlEncoded: (
325 "serialize": \mime_get_form_urlencoded_string(),
326 "serialize_verbose": \mime_get_form_urlencoded_string(),
327 "deserialize": \mime_parse_form_urlencoded_string(),
328 ),
329 # Content-Type: multipart/form-data (handled manually)
330 MimeTypeMultipartFormData: {},
331};
332
334const SerializationModules = keys (map {$1.module: True}, MimeDataTypes.iterator(), $1.module);
335
338
340const ValidSchemes = ("http", "https", "ws", "wss");
341const ValidSchemesHash = map {$1: True}, ValidSchemes;
342
345
346public:
348
353
356
357
359
362 constructor(hash<auto> oh);
363
364
367
368
370
373 initialize(hash<auto> oh);
374};
375
378
379public:
381 *float maximum;
382
384 *float minimum;
385
388
391
394
397
399 *string pattern;
400
403
406
409
411
414 hash<string, bool> enum;
415
418
420
423 constructor(string objType, hash<auto> oh);
424
425
428
429
431protected:
432 auto getExampleValue(string type, *string format);
433public:
434
435
437protected:
438 check(bool serialize, bool request, string type, *string format, *SchemaObject items, string path, string method, string name, reference<auto> value);
439public:
440
441
442protected:
443 checkStringIntern(string path, string method, string name, string value);
444public:
445
446
447protected:
448 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, list<auto> v, reference<list> value);
449public:
450
451
452protected:
453 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash<auto> v, reference<hash> value);
454public:
455
456
457protected:
458 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, int v, reference<auto> value);
459public:
460
461
462protected:
463 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, number v, reference<number> value);
464public:
465
466
467protected:
468 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, float v, reference<number> value);
469public:
470
471
472protected:
473 checkInternNumber(bool serialize, bool request, string type, *string format, string path, string method, string name, auto v, reference<auto> value);
474public:
475
476
478protected:
479 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, binary v, reference value);
480public:
481
482
484protected:
485 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, string v, reference<auto> value);
486public:
487
488
490protected:
491 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, date v, reference value);
492public:
493
494
495protected:
496 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, bool v, reference<bool> value);
497public:
498
499
500protected:
501 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
502public:
503
504
506protected:
507 checkArrayParam(bool serialize, bool request, SchemaObject items, string path, string method, string name, reference<softlist<auto>> value);
508public:
509
510
512protected:
513 static throwInvalidType(string name, string actual, string expected, auto value);
514public:
515
516
518
520 static bool checkValueType(reference<auto> value, string type);
521};
522
525
526public:
528
544 static SwaggerSchema fromString(string swaggerSpecification, *bool json, *hash<auto> opts);
545
547
563 static SwaggerSchema fromFile(string filepath, *hash<auto> opts);
564
566
585 static SwaggerSchema fromUrl(string url, *bool json, *hash<auto> opts);
586
588
597 static hash<auto> parseSchemaContent(string filepath, string str);
598
600 static hash<auto> parseSchemaSource(string str, string ser);
601
603 static string detectSourceEncoding(string str);
604};
605
607class SwaggerSchema : public ObjectBase, public AbstractRestSchemaValidator {
608
609public:
611
616
619
622
624
630 *string host;
631
633
638 *string basePath;
639
641
646 hash<string, bool> schemes;
647
649
653 hash<string, bool> consumes;
654
656
660 hash<string, bool> produces;
661
663
666 hash<string, SchemaObject> definitions();
667
669
672 hash<string, AbstractParameterObject> parameters();
673
675
678 hash<string, ResponseObject> responses;
679
681
684 hash<string, SecuritySchemeObject> securityDefinitions;
685
687
698 hash<string, softlist<string>> security;
699
701
710 list<TagObject> tags;
711
714
716 const SwaggerOptions = ...;
717
718
719protected:
722
724 *string def_path;
725
727
730
732 string hash_str;
733
736
738 hash<string, hash<string, SchemaObject>> so_map;
739
740public:
741
742private:
745
746public:
747
749
768 constructor(string schema_source, hash<auto> oh, *hash<auto> opts) ;
769
770
772
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 *SchemaObject tryGetSchemaObject(string name, hash<auto> oh, reference<string> hash_str);
804
805
806 cacheSchemaObject(string name, string hash_str, SchemaObject so);
807
808
810
812 SchemaObject resolveSchemaObject(string name, string refstr, hash<auto> oh);
813
814
816
818 ParameterItemsSchemaObject resolveParameterItemsSchemaObject(string name, string refstr, hash<auto> oh);
819
820
822
824 AbstractParameterObject resolveParameter(string name, string refstr, hash<auto> oh);
825
826
828
830 ResponseObject resolveResponse(string name, string refstr, hash<auto> oh);
831
832
834
838protected:
839 string getHashImpl();
840public:
841
842
844
848protected:
850public:
851
852
854
867protected:
868 hash<RestSchemaValidator::RestRequestClientInfo> processRequestImpl(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types);
869public:
870
871
873
884protected:
885 hash<RestSchemaValidator::RestRequestServerInfo> parseRequestImpl(string method, string path, *data http_body, reference<hash> headers);
886public:
887
888
890
909protected:
910 hash<HttpResponseInfo> processResponseImpl(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types);
911public:
912
913
915
925protected:
926 hash<RestSchemaValidator::RestResponseClientInfo> parseResponseImpl(string method, string path, int code, *data response_body, hash<auto> hdr);
927public:
928
929
931protected:
932 fixPath(reference<string> path);
933public:
934
935
937
939protected:
940 hash<string, list<string>> getPathOperationHashImpl();
941public:
942
943
945
949protected:
951public:
952
953
955
957protected:
959public:
960
961
963
968protected:
969 hash<RestQoreExampleCodeInfo> getQoreExampleRequestImpl(string method, string path);
970public:
971
972
974
980protected:
981 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequestImpl(string method, string path, *softlist<string> content_types);
982public:
983
984
986
992protected:
993 hash<RestQoreExampleCodeInfo> getQoreExampleResponseImpl(string method, string path, int code);
994public:
995
996
998
1005protected:
1006 hash<RestExampleResponseInfo> getExampleResponseImpl(string method, string path, int code, *softlist<string> content_types);
1007public:
1008
1009
1011
1013protected:
1014 hash<auto> getExternalReference(string refstr);
1015public:
1016
1017
1019
1023protected:
1024 AbstractDataProvider getDataProviderImpl(HTTPClient rest);
1025public:
1026
1027
1029
1033protected:
1035public:
1036
1037
1039
1043protected:
1045public:
1046
1047
1049
1063private:
1064 hash<RestSchemaValidator::RestRequestClientInfo> processRequestIntern(string method, string path, auto body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1065public:
1066
1067
1069
1089private:
1090 hash<HttpResponseInfo> processResponseIntern(string method, string path, int code, auto response_body, *hash<auto> headers, *softlist<string> content_types, bool compact_serialization);
1091public:
1092
1093
1095
1103private:
1104 bool checkRequestContentTypeHeader(reference<hash<RestRequestClientInfo>> req, auto body, *hash<auto> headers);
1105public:
1106
1107
1109
1117private:
1118 bool checkResponseContentTypeHeader(reference<hash<HttpResponseInfo>> resp, auto body, *hash<auto> headers);
1119public:
1120
1121
1123
1130private:
1131 bool checkResponseTextPlain(reference<hash<HttpResponseInfo>> resp, auto body, hash<string, bool> mime_types, *list<auto> content_types);
1132public:
1133
1134
1136private:
1137 SchemaObject processDefinition(string key, auto value);
1138public:
1139
1140};
1141
1143class InfoObject : public ObjectBase {
1144
1145public:
1147 string title;
1148
1150 *string desc;
1151
1154
1156 string version;
1157
1160
1163
1165
1171 constructor(hash<auto> oh) ;
1172
1173};
1174
1177
1178public:
1180 *string name;
1181
1183 *string url;
1184
1186 *string email;
1187
1189
1194 constructor(hash<auto> oh) ;
1195
1196};
1197
1200
1201public:
1203 string name;
1204
1206 *string url;
1207
1209
1215 constructor(hash<auto> oh) ;
1216
1217};
1218
1220
1227
1228public:
1229protected:
1231 string pfx;
1232
1234 string name;
1235
1238
1241
1243 hash<string, PathComponent> paths;
1244
1245public:
1246
1248 constructor(hash<auto> oh, string pfx, SwaggerSchema swagger);
1249
1250
1252protected:
1253 constructor(string full_path, list<auto> l, int offset, hash<auto> oh);
1254public:
1255
1256
1258protected:
1259 add(string full_path, list<auto> l, int offset, hash<auto> oh, SwaggerSchema swagger);
1260public:
1261
1262
1264
1266 PathItemObject match(list<auto> path);
1267
1268
1270
1272 *PathItemObject tryMatch(list<auto> path);
1273
1274
1276
1278 getPathOperationHash(reference<hash<string, list<string>>> h);
1279
1280};
1281
1283class PathsObject : public ObjectBase {
1284
1285public:
1286protected:
1289
1290public:
1291
1293
1301 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1302
1303
1305
1307 PathItemObject match(string path);
1308
1309
1311
1314
1315
1317
1319 hash<string, list<string>> getPathOperationHash();
1320
1321};
1322
1324
1330
1331public:
1333
1338 *string ref;
1339
1341
1350 hash<string, AbstractParameterObject> parameters();
1351
1354
1355protected:
1357
1367 hash<string, OperationObject> operations;
1368
1369public:
1370
1372
1381 constructor(string path, hash<auto> oh, SwaggerSchema swagger) ;
1382
1383
1385
1392 OperationObject getOperation(string method, string path);
1393
1394
1396
1398 softlist getMethods();
1399
1400};
1401
1404
1405public:
1407 string path;
1408
1410 string method;
1411
1413
1416 list tags;
1417
1419 *string summary;
1420
1422 *string desc;
1423
1425
1429 bool deprec = False;
1430
1433
1435
1442
1444
1449 hash<string, bool> consumes;
1450
1452
1457 hash<string, bool> produces;
1458
1460
1468 hash<string, AbstractParameterObject> parameters();
1469
1472
1474 hash<string, AbstractParameterObject> formData;
1475
1478
1480
1484 list<string> schemes;
1485
1487
1499 list<hash<string, list<string>>> security;
1500
1502
1511 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1512
1513
1515 *data getRequestBody(PathItemObject pio, auto body, reference<hash<auto>> headers);
1516
1517
1519
1529 validateRequest(bool serialize, PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers, *reference<hash<string, bool>> mime_types);
1530
1531
1533
1543 parseRequest(PathItemObject pio, reference<hash<UriQueryInfo>> h, reference<auto> body, reference<hash> headers);
1544
1545
1547 validateResponse(string method, string path, PathItemObject pio, int http_code, reference<auto> response_body, reference<hash<string, bool>> mime_types, bool deserialize = True);
1548
1549
1551
1558 hash<RestQoreExampleCodeInfo> getQoreExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger);
1559
1560
1562
1571 hash<RestSchemaValidator::RestExampleRequestInfo> getExampleRequest(string method, string path, PathItemObject pio, SwaggerSchema swagger, reference rbody);
1572
1573
1575
1582 hash<RestQoreExampleCodeInfo> getQoreExampleResponse(string method, string path, int code);
1583
1584
1586
1594 hash<RestExampleResponseInfo> getExampleResponse(string method, string path, int code, reference<auto> body);
1595
1596
1597protected:
1598 getQoreExampleParams(reference<hash<auto>> query, reference<hash<auto>> headers, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1599public:
1600
1601
1603protected:
1604 doDefaultParams(reference<hash<UriQueryInfo>> h, reference<hash> headers, reference<auto> body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1605public:
1606
1607
1609protected:
1610 checkMissingParams(hash<UriQueryInfo> h, *hash<auto> headers, auto body, hash<string, AbstractParameterObject> parameters, *hash<string, AbstractParameterObject> child_params);
1611public:
1612
1613
1615
1617protected:
1619public:
1620
1621
1623protected:
1624 error(string err, string fmt);
1625public:
1626
1627};
1628
1631
1632public:
1634 *string desc;
1635
1637 string url;
1638
1640
1646 constructor(hash<auto> oh) ;
1647
1648};
1649
1651
1688
1689public:
1691
1698 string name;
1699
1701
1705 string inLoc;
1706
1708 *string desc;
1709
1711
1716 bool required = False;
1717
1718protected:
1719 const OtherParameterMap = ...;
1720
1721
1722public:
1723
1725
1732 constructor(hash<auto> oh, *int opt_flags) ;
1733
1734
1736 abstract check(bool serialize, bool request, string path, string method, string name, reference value);
1737
1740
1741
1743 static AbstractParameterObject newParameter(string name, hash<auto> oh, SwaggerSchema swagger);
1744};
1745
1748
1749public:
1752
1754
1761 constructor(hash<auto> oh, SwaggerSchema swagger) ;
1762
1763
1765 check(bool serialize, bool request, string path, string method, string name, reference value);
1766
1767
1769 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv);
1770
1771
1772 // returns an example value for a REST API call
1773 auto getExampleValue();
1774
1775};
1776
1779
1780public:
1782
1791 string type;
1792
1794 *string format;
1795
1797
1802 bool allowEmptyValue = False;
1803
1806
1808
1822
1824
1832
1834 const ParameterTypes = ...;
1835
1836
1838
1848 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
1849
1850
1852 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
1853
1854
1857
1858
1861
1862
1864protected:
1865 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
1866public:
1867
1868};
1869
1872
1873public:
1874 // The documentation of responses other than the ones declared for specific HTTP response codes.
1879
1880 // A hash mapping HTTP status codes to @ref ResponseObject "ResponseObjects".
1885 hash<string, ResponseObject> responses;
1886
1888
1898 constructor(string path, string method, hash<auto> oh, SwaggerSchema swagger) ;
1899
1900};
1901
1904
1905public:
1907 string desc;
1908
1910
1917
1919
1922 hash<auto> headers;
1923
1925
1933
1935
1943protected:
1944 constructor(string key, hash<auto> oh, SwaggerSchema swagger) ;
1945public:
1946
1947
1949
1958 static ResponseObject newResponse(string key, hash<auto> oh, SwaggerSchema swagger);
1959};
1960
1962class HeaderObject : public ObjectBase, public SchemaBase {
1963
1964public:
1966 *string desc;
1967
1969
1973 string type;
1974
1976 *string format;
1977
1980
1982
1992
1994
2001
2003
2011 constructor(hash<auto> oh, SwaggerSchema swagger) ;
2012
2013
2015protected:
2016 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2017public:
2018
2019};
2020
2022class TagObject : public ObjectBase {
2023
2024public:
2026 string name;
2027
2029 *string desc;
2030
2033
2035
2041 constructor(hash<auto> oh) ;
2042
2043};
2044
2046class SchemaObject : public ObjectBase, public SchemaBase {
2047
2048public:
2050 string name;
2051
2053
2057 string type;
2058
2060 *string format;
2061
2063 *string title;
2064
2066 *string desc;
2067
2070
2073
2076
2079
2081
2083 bool nullable = False;
2084
2086
2090 hash<string, SchemaObject> properties;
2091
2093 hash<string, bool> nullable_properties;
2094
2096
2101
2103
2106 hash<string, bool> required;
2107
2109
2128
2130
2137 bool readOnly = False;
2138
2140
2148 list<SchemaObject> allOf();
2149
2151
2159
2162
2165
2167 const ScalarTypes = ...;
2168
2169
2171 const ReferenceTypes = ...;
2172
2173
2175
2188protected:
2189 constructor(string name, hash<auto> oh, SwaggerSchema swagger, *string hash_str, *bool require_items) ;
2190public:
2191
2192
2194 string getQoreExample(reference<hash<RestQoreExampleCodeInfo>> rv, string name, bool decl);
2195
2196
2197 // returns an example value for a REST API call
2198 auto getExampleValue();
2199
2200
2202 check(bool serialize, bool request, string path, string method, string name, reference<auto> value);
2203
2204
2205protected:
2206 checkObjectProperty(string name, string prop);
2207public:
2208
2209
2210protected:
2211 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, nothing v, reference<nothing> value);
2212public:
2213
2214
2216protected:
2217 checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash<auto> v, reference<hash<auto>> value);
2218public:
2219
2220
2222protected:
2223 static checkValueType(reference<auto> value, string type, *SchemaObject items, *string loc);
2224public:
2225
2226
2228
2239 static SchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger, *bool require_items);
2240
2242
2244 static SchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger);
2245};
2246
2249
2250public:
2252
2266
2268
2280protected:
2281 constructor(string name, hash<auto> oh, SwaggerSchema swagger) ;
2282public:
2283
2284
2286
2298 static ParameterItemsSchemaObject newSchemaObject(string name, hash<auto> oh, SwaggerSchema swagger);
2299
2301
2304};
2305
2307
2312class XmlObject : public ObjectBase {
2313
2314public:
2316
2323 *string name;
2324
2326 *string ns;
2327
2329 *string prefix;
2330
2332 bool attribute = False;
2333
2335
2339 bool wrapped = False;
2340
2342
2347 constructor(hash<auto> oh) ;
2348
2349};
2350
2352
2358
2359public:
2361 string type;
2362
2364 *string desc;
2365
2367
2370 *string name;
2371
2373
2376 *string inLoc;
2377
2379
2384 *string flow;
2385
2387
2391
2393
2396 *string tokenUrl;
2397
2399
2407
2409
2418 constructor(hash<auto> oh) ;
2419
2420};
2421
2423class ScopesObject : public ObjectBase {
2424
2425public:
2427
2430 hash<string, string> fields;
2431
2433
2438 constructor(hash<auto> oh) ;
2439
2440};
2441};
2442
2443// private namespace for internal definitions
2444namespace Priv {
2445 // a set of string values
2446 const SwaggerListToStringSet = -1;
2447 // a set of any type that can be converted to a string
2448 const SwaggerListToAnySet = -2;
2449 const SwaggerListToHashOfStrings = -3;
2450
2451 const TypeMap = ...;
2452
2453
2455
2465 required_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2466
2467
2469
2479 required_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2480
2481
2483
2494 bool optional_field(string objType, hash<auto> oh, string name, int typeCode, reference<auto> target, *int opt_flags);
2495
2496
2498
2509 bool optional_field(string objType, hash<auto> oh, string name, hash<string, bool> typeCodes, reference<auto> target);
2510
2511
2513 *bool check_type_code(string objType, hash<auto> oh, string name, auto val, int typeCode, *int opt_flags);
2514
2515
2517 get_value(string objType, string name, int typeCode, auto val, reference<auto> target);
2518
2519
2521 string get_qore_type(string name, string type, *string format, *SchemaObject items);
2522
2523};
Describes a single operation parameter.
Definition: Swagger.qm.dox.h:1687
bool required
Determines whether this parameter is mandatory.
Definition: Swagger.qm.dox.h:1716
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:1698
string inLoc
Required. The location of the parameter.
Definition: Swagger.qm.dox.h:1705
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:1708
AbstractParameterObject specialization for "body" parameters.
Definition: Swagger.qm.dox.h:1747
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:1751
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, SwaggerSchema swagger)
Constructor.
Contact information for the exposed API.
Definition: Swagger.qm.dox.h:1176
constructor(hash< auto > oh)
Constructor.
*string name
The identifying name of the contact person/organization.
Definition: Swagger.qm.dox.h:1180
*string url
The URL pointing to the contact information. MUST be in the format of a URL.
Definition: Swagger.qm.dox.h:1183
*string email
The email address of the contact person/organization. MUST be in the format of an email address.
Definition: Swagger.qm.dox.h:1186
Allows referencing an external resource for extended documentation.
Definition: Swagger.qm.dox.h:1630
*string desc
A short description of the target documentation. GFM syntax can be used for rich text representation.
Definition: Swagger.qm.dox.h:1634
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:1637
describes a single HTTP header
Definition: Swagger.qm.dox.h:1962
*string desc
A short description of the header.
Definition: Swagger.qm.dox.h:1966
*SchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition: Swagger.qm.dox.h:1979
auto defaultVal
Declares the value of the header that the server will use if none is provided.
Definition: Swagger.qm.dox.h:2000
string type
Required. The type of the object.
Definition: Swagger.qm.dox.h:1973
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition: Swagger.qm.dox.h:1976
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:1991
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:1143
string version
Required. Provides the version of the application API (not to be confused with the specification vers...
Definition: Swagger.qm.dox.h:1156
constructor(hash< auto > oh)
Constructor.
string title
Required. The title of the application.
Definition: Swagger.qm.dox.h:1147
*LicenseObject license
The license information for the exposed API.
Definition: Swagger.qm.dox.h:1162
*ContactObject contact
The contact information for the exposed API.
Definition: Swagger.qm.dox.h:1159
*string termsOfService
The Terms of Service for the API.
Definition: Swagger.qm.dox.h:1153
*string desc
A short description of the application. GFM syntax can be used for rich text representation.
Definition: Swagger.qm.dox.h:1150
License information for the exposed API.
Definition: Swagger.qm.dox.h:1199
constructor(hash< auto > oh)
Constructor.
string name
Required. The license name used for the API.
Definition: Swagger.qm.dox.h:1203
*string url
A URL to the license used for the API. MUST be in the format of a URL.
Definition: Swagger.qm.dox.h:1206
Base class for the Swagger specification objects, wrapping the vendor extensions.
Definition: Swagger.qm.dox.h:344
initialize(hash< auto > oh)
Initialize.
hash< auto > vendorExtensions
Allows extensions to the Swagger Schema.
Definition: Swagger.qm.dox.h:352
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:1403
list< string > schemes
The transfer protocol for the operation.
Definition: Swagger.qm.dox.h:1484
*string desc
A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
Definition: Swagger.qm.dox.h:1422
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:1457
*ExternalDocumentationObject externalDocs
Additional external documentation for this operation.
Definition: Swagger.qm.dox.h:1432
string path
the URI path for the operation
Definition: Swagger.qm.dox.h:1407
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:1419
hash< string, AbstractParameterObject > parameters()
A hash of parameters that are applicable for this operation.
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:1410
AbstractParameterObject body
body parameter; if defined for this operation, formData parameter will be excluded
Definition: Swagger.qm.dox.h:1471
hash< RestQoreExampleCodeInfo > getQoreExampleResponse(string method, string path, int code)
returns example Qore code for the given response
*data getRequestBody(PathItemObject pio, auto body, reference< hash< auto > > headers)
Processes a generated request.
validateRequest(bool serialize, PathItemObject pio, reference< hash< UriQueryInfo > > h, reference< auto > body, reference< hash > headers, *reference< hash< string, bool > > mime_types)
processes a REST API client-side request to the operation
hash< RestExampleResponseInfo > getExampleResponse(string method, string path, int code, reference< auto > body)
returns a hash of example message information for the given request
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:1477
error(string err, string fmt)
raises an exception with context information
list tags
A list of tags (strings or TagObjects) for API documentation control.
Definition: Swagger.qm.dox.h:1416
*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:1441
hash< string, AbstractParameterObject > formData
formData parameter; if defined for this operation, body parameter will be excluded
Definition: Swagger.qm.dox.h:1474
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:1499
hash< string, bool > consumes
A list of MIME types (strings) the operation can consume.
Definition: Swagger.qm.dox.h:1449
bool deprec
Declares this operation to be deprecated.
Definition: Swagger.qm.dox.h:1429
constructor(string path, string method, hash< auto > oh, SwaggerSchema swagger)
Constructor.
AbstractParameterObject specialization for parameters other than "body".
Definition: Swagger.qm.dox.h:1778
constructor(string name, hash< auto > oh, SwaggerSchema swagger)
Constructor.
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition: Swagger.qm.dox.h:1794
bool allowEmptyValue
Sets the ability to pass empty-valued parameters.
Definition: Swagger.qm.dox.h:1802
check(bool serialize, bool request, string path, string method, string name, reference< auto > value)
validates the value against the schema definition
const ParameterTypes
valid parameter types
Definition: Swagger.qm.dox.h:1834
auto defaultVal
Declares the value of the parameter that the server will use if none is provided.
Definition: Swagger.qm.dox.h:1831
auto getDefaultValue()
returns the default value of the parameter (default: NOTHING)
*ParameterItemsSchemaObject items
Required if type is "array". Describes the type of items in the array.
Definition: Swagger.qm.dox.h:1805
auto getExampleValue()
returns an example value of the parameter (default: NOTHING)
static checkValueType(reference< auto > value, string type, *SchemaObject items, *string loc)
validates default values
string type
Required. The type of the parameter.
Definition: Swagger.qm.dox.h:1791
*string collectionFormat
Determines the format of the array if type array is used.
Definition: Swagger.qm.dox.h:1821
items schema object for non-body parameters
Definition: Swagger.qm.dox.h:2248
*string collectionFormat
Determines the format of the array if type array is used.
Definition: Swagger.qm.dox.h:2265
constructor(string name, hash< auto > oh, SwaggerSchema swagger)
private constructor; use newSchemaObject() instead
static ParameterItemsSchemaObject newSchemaObject(string name, hash< auto > oh, SwaggerSchema swagger)
returns a SchemaObject for the schema definition; resolves references
static ParameterItemsSchemaObject newSchemaObject(string name, auto error, SwaggerSchema swagger)
throws an "INVALID-FIELD-TYPE" exception
Holds the relative paths to the individual endpoints.
Definition: Swagger.qm.dox.h:1226
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:1243
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:1234
*PathComponent wildcard
if there is a wildcard to a PathComponent
Definition: Swagger.qm.dox.h:1237
string pfx
path prefix
Definition: Swagger.qm.dox.h:1231
*PathItemObject pio
the PathItemObject associated with this path (if any)
Definition: Swagger.qm.dox.h:1240
Describes the operations available on a single path.
Definition: Swagger.qm.dox.h:1329
hash< string, AbstractParameterObject > parameters()
A hash of parameters that are applicable for all the operations described under this path.
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:1338
hash< string, OperationObject > operations
A hash of OperationObjects correspoding to different methods.
Definition: Swagger.qm.dox.h:1367
OperationObject getOperation(string method, string path)
returns the operation object for the given method
AbstractParameterObject body
The body parameter, if defined for this path.
Definition: Swagger.qm.dox.h:1353
constructor(string path, hash< auto > oh, SwaggerSchema swagger)
Constructor.
This class stores the path tree for URI path matching.
Definition: Swagger.qm.dox.h:1283
*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:1288
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:1903
*SchemaObject schema
A definition of the response structure.
Definition: Swagger.qm.dox.h:1916
string desc
Required. A short description of the response. GFM syntax can be used for rich text representation.
Definition: Swagger.qm.dox.h:1907
hash< auto > headers
A hash of headers that are (can be) sent with the response.
Definition: Swagger.qm.dox.h:1922
hash examples
A hash of example response messages.
Definition: Swagger.qm.dox.h:1932
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:1871
ResponseObject defaultResp
Definition: Swagger.qm.dox.h:1878
constructor(string path, string method, hash< auto > oh, SwaggerSchema swagger)
Constructor.
hash< string, ResponseObject > responses
Definition: Swagger.qm.dox.h:1885
Base used by OtherParameter, HeaderObject and SchemaObject.
Definition: Swagger.qm.dox.h:377
*bool exclusiveMin
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
Definition: Swagger.qm.dox.h:390
checkArrayParam(bool serialize, bool request, SchemaObject items, string path, string method, string name, reference< softlist< auto > > value)
validates the value against the schema definition
auto getExampleValue(string type, *string format)
returns an example value for the given type
*int minItems
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
Definition: Swagger.qm.dox.h:405
*float multipleOf
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
Definition: Swagger.qm.dox.h:417
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:402
*int minLength
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
Definition: Swagger.qm.dox.h:396
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:381
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:393
checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, date v, reference value)
converts strings to/from date/time values for supported formats
*bool exclusiveMax
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
Definition: Swagger.qm.dox.h:387
*bool uniqueItems
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
Definition: Swagger.qm.dox.h:408
static bool checkValueType(reference< auto > value, string type)
Checks the value against the type.
*float minimum
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
Definition: Swagger.qm.dox.h:384
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:399
defines an object in a schema
Definition: Swagger.qm.dox.h:2046
auto additionalProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.4.
Definition: Swagger.qm.dox.h:2100
bool readOnly
Relevant only for Schema "properties" definitions. Declares the property as "read only".
Definition: Swagger.qm.dox.h:2137
bool nullable
extension that allows types to be nullable
Definition: Swagger.qm.dox.h:2083
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:2090
*string format
The extending format for the previously mentioned type. See Data Type Formats for further details.
Definition: Swagger.qm.dox.h:2060
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
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:2075
string name
the name of this object for documentation and example purposes
Definition: Swagger.qm.dox.h:2050
string type
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.2.
Definition: Swagger.qm.dox.h:2057
*string discriminator
Adds support for polymorphism.
Definition: Swagger.qm.dox.h:2127
*SchemaObject items
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.1.
Definition: Swagger.qm.dox.h:2069
*XmlObject xml
This MAY be used only on properties schemas. It has no effect on root schemas.
Definition: Swagger.qm.dox.h:2158
hash< string, bool > nullable_properties
extention to allow properties to be nullable
Definition: Swagger.qm.dox.h:2093
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:2161
const ScalarTypes
valid scalar types
Definition: Swagger.qm.dox.h:2167
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:2066
auto defaultVal
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2.
Definition: Swagger.qm.dox.h:2072
*string title
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.1.
Definition: Swagger.qm.dox.h:2063
checkIntern(bool serialize, bool request, string type, *string format, string path, string method, string name, hash< auto > v, reference< hash< auto > > value)
validates a schema object against a value
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:2106
auto example
A free-form property to include an example of an instance for this schema.
Definition: Swagger.qm.dox.h:2164
const ReferenceTypes
valid reference types
Definition: Swagger.qm.dox.h:2171
*int minProperties
See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.2.
Definition: Swagger.qm.dox.h:2078
Lists the available scopes for an OAuth2 security scheme.
Definition: Swagger.qm.dox.h:2423
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:2430
Allows the definition of a security scheme that can be used by the operations.
Definition: Swagger.qm.dox.h:2357
*string flow
The flow used by the OAuth2 security scheme.
Definition: Swagger.qm.dox.h:2384
*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:2390
string type
Required. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
Definition: Swagger.qm.dox.h:2361
*string inLoc
The location of the API key. Valid values are "query" or "header".
Definition: Swagger.qm.dox.h:2376
constructor(hash< auto > oh)
Constructor.
*string name
The name of the header or query parameter to be used.
Definition: Swagger.qm.dox.h:2370
*ScopesObject scopes
The available scopes for the OAuth2 security scheme.
Definition: Swagger.qm.dox.h:2406
*string desc
A short description for security scheme.
Definition: Swagger.qm.dox.h:2364
*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:2396
Used for loading the Swagger definitions.
Definition: Swagger.qm.dox.h:524
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:607
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 ...
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.
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, bool > produces
A set of MIME types (strings) the APIs can produce.
Definition: Swagger.qm.dox.h:660
hash< RestQoreExampleCodeInfo > getQoreExampleRequestImpl(string method, string path)
returns example Qore code for the given request
string getTargetUrlImpl()
returns the target URL for the schema
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:738
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:744
*string def_path
the default path to use when retrieving external schema references
Definition: Swagger.qm.dox.h:724
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 ...
hash< string, softlist< string > > security
A declaration of which security schemes are applied for the API as a whole.
Definition: Swagger.qm.dox.h:698
hash< string, ResponseObject > responses
Response definitions that can be used across operations. This property does not define global respons...
Definition: Swagger.qm.dox.h:678
*ExternalDocumentationObject externalDocs
Additional external documentation.
Definition: Swagger.qm.dox.h:713
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:729
*string basePath
The base path on which the API is served, which is relative to the host.
Definition: Swagger.qm.dox.h:638
constructorIntern(string schema_source, hash< auto > oh, *hash< auto > opts)
common constructor implementation
string hash_str
the hash for the schema
Definition: Swagger.qm.dox.h:732
hash< string, SecuritySchemeObject > securityDefinitions
Security scheme definitions that can be used across the specification.
Definition: Swagger.qm.dox.h:684
ParameterItemsSchemaObject resolveParameterItemsSchemaObject(string name, string refstr, hash< auto > oh)
resolves a reference to a parameter items schema object
*int opt_flags
parse option flags
Definition: Swagger.qm.dox.h:735
SchemaObject processDefinition(string key, auto value)
Processes a schema definition.
string swaggerSpec
Swagger Specification version being used.
Definition: Swagger.qm.dox.h:615
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:618
string getHashImpl()
returns a unique hash for the schema that can be used to compare schemas
hash< auto > getExternalReference(string refstr)
retrieves external references
bool compact_serialization
if serialized data should be subject to compact serialization (default: True)
Definition: Swagger.qm.dox.h:721
const SwaggerOptions
SwaggerSchema options.
Definition: Swagger.qm.dox.h:716
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:630
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:653
hash< string, bool > schemes
The transfer protocol of the API.
Definition: Swagger.qm.dox.h:646
PathsObject paths
Required. The available paths and operations for the API.
Definition: Swagger.qm.dox.h:621
list< TagObject > tags
A list of tags used by the specification with additional metadata.
Definition: Swagger.qm.dox.h:710
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-...
hash< string, AbstractParameterObject > parameters()
Parameter definitions that can be used across operations. This property does not define global parame...
Allows adding metadata to a single tag that is used by the OperationObject. It is not mandatory to ha...
Definition: Swagger.qm.dox.h:2022
*ExternalDocumentationObject externalDocs
Additional external documentation for this tag.
Definition: Swagger.qm.dox.h:2032
*string desc
A short description for the tag. GFM syntax can be used for rich text representation.
Definition: Swagger.qm.dox.h:2029
string name
Required. The name of the tag.
Definition: Swagger.qm.dox.h:2026
constructor(hash< auto > oh)
Constructor.
A metadata object that allows for more fine-tuned XML model definitions.
Definition: Swagger.qm.dox.h:2312
bool wrapped
MAY be used only for an array definition. Signifies whether the array is wrapped (for example,...
Definition: Swagger.qm.dox.h:2339
*string name
Replaces the name of the element/attribute used for the described schema property.
Definition: Swagger.qm.dox.h:2323
bool attribute
Declares whether the property definition translates to an attribute instead of an element....
Definition: Swagger.qm.dox.h:2332
constructor(hash< auto > oh)
Constructor.
*string prefix
The prefix to be used for the name.
Definition: Swagger.qm.dox.h:2329
*string ns
The URL of the namespace definition. Value SHOULD be in the form of a URL.
Definition: Swagger.qm.dox.h:2326
const LM_IGNORE_INVALID_REQUIRED
parse option: ignore invalid "required" properties
Definition: Swagger.qm.dox.h:255
const LM_ALL
parse options: all options
Definition: Swagger.qm.dox.h:264
const LM_ACCEPT_INVALID_BODY_PARAMS
parse option: reconstruct invalid body parameters
Definition: Swagger.qm.dox.h:258
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:261
const LM_LAX_COLLECTIONFORMAT
parse option: allow collectionFormat on non-array types
Definition: Swagger.qm.dox.h:252
const LM_IGNORE_MISSING_REQUIRED
Definition: Swagger.qm.dox.h:249
main namespace for all public Swagger declarations
Definition: Swagger.qm.dox.h:243
const CollectionFormats
allowed collection formats
Definition: Swagger.qm.dox.h:276
const ValidNumberFormats
Valid number type formats.
Definition: Swagger.qm.dox.h:271
const ValidStringFormatsHash
A hash of valid string type formats.
Definition: Swagger.qm.dox.h:288
const ValidNumberFormatsHash
A hash of valid number type formats.
Definition: Swagger.qm.dox.h:286
const ParameterCollectionFormats
valid parameter collection formats
Definition: Swagger.qm.dox.h:280
const SerializationModules
modules available for data serialization and/or deserialization
Definition: Swagger.qm.dox.h:334
const ValidStringFormats
Valid string type formats.
Definition: Swagger.qm.dox.h:273
const ValidIntFormatsHash
A hash of valid integer type formats.
Definition: Swagger.qm.dox.h:284
const MimeDataTypes
supported mime types for de/serializing data
Definition: Swagger.qm.dox.h:299
const MimeContentTypes
MIME types for data serialization.
Definition: Swagger.qm.dox.h:337
const ValidIntFormats
Valid integer type formats.
Definition: Swagger.qm.dox.h:269
const YamlSerialization
Yaml serialization.
Definition: Swagger.qm.dox.h:291
const ValidSchemes
Valid transfer protocol schemes.
Definition: Swagger.qm.dox.h:340