@swagger-api/apidom-ns-openapi-3-1 1.0.0-beta.9 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +187 -0
- package/README.md +371 -1
- package/dist/apidom-ns-openapi-3-1.browser.js +29414 -24750
- package/dist/apidom-ns-openapi-3-1.browser.min.js +1 -1
- package/package.json +10 -9
- package/src/elements/Schema.cjs +2 -427
- package/src/elements/Schema.mjs +2 -427
- package/src/index.cjs +3 -1
- package/src/index.mjs +1 -0
- package/src/refractor/plugins/normalize-discriminator-mapping.cjs +173 -0
- package/src/refractor/plugins/normalize-discriminator-mapping.mjs +167 -0
- package/src/refractor/plugins/replace-empty-element.cjs +2 -1
- package/src/refractor/plugins/replace-empty-element.mjs +3 -2
- package/src/refractor/specification.cjs +55 -157
- package/src/refractor/specification.mjs +13 -115
- package/src/refractor/toolbox.cjs +2 -2
- package/src/refractor/toolbox.mjs +1 -1
- package/src/refractor/visitors/open-api-3-1/components/SchemasVisitor.cjs +13 -0
- package/src/refractor/visitors/open-api-3-1/components/SchemasVisitor.mjs +13 -2
- package/src/refractor/visitors/open-api-3-1/schema/$defsVisitor.cjs +2 -10
- package/src/refractor/visitors/open-api-3-1/schema/$defsVisitor.mjs +4 -9
- package/src/refractor/visitors/open-api-3-1/schema/AllOfVisitor.cjs +2 -25
- package/src/refractor/visitors/open-api-3-1/schema/AllOfVisitor.mjs +2 -23
- package/src/refractor/visitors/open-api-3-1/schema/AnyOfVisitor.cjs +2 -25
- package/src/refractor/visitors/open-api-3-1/schema/AnyOfVisitor.mjs +2 -23
- package/src/refractor/visitors/open-api-3-1/schema/DependentSchemasVisitor.cjs +2 -14
- package/src/refractor/visitors/open-api-3-1/schema/DependentSchemasVisitor.mjs +2 -12
- package/src/refractor/visitors/open-api-3-1/schema/OneOfVisitor.cjs +2 -25
- package/src/refractor/visitors/open-api-3-1/schema/OneOfVisitor.mjs +2 -23
- package/src/refractor/visitors/open-api-3-1/schema/PatternPropertiesVisitor.cjs +2 -14
- package/src/refractor/visitors/open-api-3-1/schema/PatternPropertiesVisitor.mjs +2 -12
- package/src/refractor/visitors/open-api-3-1/schema/PrefixItemsVisitor.cjs +2 -25
- package/src/refractor/visitors/open-api-3-1/schema/PrefixItemsVisitor.mjs +2 -23
- package/src/refractor/visitors/open-api-3-1/schema/PropertiesVisitor.cjs +2 -14
- package/src/refractor/visitors/open-api-3-1/schema/PropertiesVisitor.mjs +2 -12
- package/src/refractor/visitors/open-api-3-1/schema/index.cjs +10 -31
- package/src/refractor/visitors/open-api-3-1/schema/index.mjs +12 -33
- package/types/apidom-ns-openapi-3-1.d.ts +183 -408
- package/src/refractor/visitors/open-api-3-1/schema/$refVisitor.cjs +0 -16
- package/src/refractor/visitors/open-api-3-1/schema/$refVisitor.mjs +0 -12
- package/src/refractor/visitors/open-api-3-1/schema/$vocabularyVisitor.cjs +0 -16
- package/src/refractor/visitors/open-api-3-1/schema/$vocabularyVisitor.mjs +0 -12
- package/src/refractor/visitors/open-api-3-1/schema/DependentRequiredVisitor.cjs +0 -16
- package/src/refractor/visitors/open-api-3-1/schema/DependentRequiredVisitor.mjs +0 -12
- package/src/refractor/visitors/open-api-3-1/schema/EnumVisitor.cjs +0 -16
- package/src/refractor/visitors/open-api-3-1/schema/EnumVisitor.mjs +0 -12
- package/src/refractor/visitors/open-api-3-1/schema/ExamplesVisitor.cjs +0 -16
- package/src/refractor/visitors/open-api-3-1/schema/ExamplesVisitor.mjs +0 -12
- package/src/refractor/visitors/open-api-3-1/schema/ParentSchemaAwareVisitor.cjs +0 -17
- package/src/refractor/visitors/open-api-3-1/schema/ParentSchemaAwareVisitor.mjs +0 -13
- package/src/refractor/visitors/open-api-3-1/schema/RequiredVisitor.cjs +0 -16
- package/src/refractor/visitors/open-api-3-1/schema/RequiredVisitor.mjs +0 -12
- package/src/refractor/visitors/open-api-3-1/schema/TypeVisitor.cjs +0 -21
- package/src/refractor/visitors/open-api-3-1/schema/TypeVisitor.mjs +0 -17
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { cloneShallow, isArrayElement, ObjectElement, StringElement, MemberElement, toValue, visit, isMemberElement, isStringElement } from '@swagger-api/apidom-core';
|
|
2
|
+
import { isReferenceLikeElement, isDiscriminatorElement } from '@swagger-api/apidom-ns-openapi-3-0';
|
|
3
|
+
import NormalizeStorage from "./normalize-header-examples/NormalizeStorage.mjs";
|
|
4
|
+
import { isSchemaElement } from "../../predicates.mjs";
|
|
5
|
+
import DiscriminatorElement from "../../elements/Discriminator.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Normalization of Discriminator.mapping field.
|
|
8
|
+
*
|
|
9
|
+
* Discriminator.mapping fields are normalized by adding missing mappings from oneOf/anyOf items
|
|
10
|
+
* of the parent Schema Object and transforming existing mappings to Schema Objects.
|
|
11
|
+
*
|
|
12
|
+
* In case of allOf discriminator, the plugin will add missing mappings based on
|
|
13
|
+
* allOf items of other Schema Objects.
|
|
14
|
+
*
|
|
15
|
+
* The normalized mapping is stored in the Schema.discriminator field as `x-normalized-mapping`.
|
|
16
|
+
*
|
|
17
|
+
* This plugin is designed to be used on dereferenced OpenAPI 3.1 documents.
|
|
18
|
+
*
|
|
19
|
+
* NOTE: this plugin is idempotent
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
const plugin = ({
|
|
26
|
+
storageField = 'x-normalized',
|
|
27
|
+
baseURI = ''
|
|
28
|
+
} = {}) => toolbox => {
|
|
29
|
+
const {
|
|
30
|
+
ancestorLineageToJSONPointer
|
|
31
|
+
} = toolbox;
|
|
32
|
+
let storage;
|
|
33
|
+
let allOfDiscriminatorMapping;
|
|
34
|
+
return {
|
|
35
|
+
visitor: {
|
|
36
|
+
OpenApi3_1Element: {
|
|
37
|
+
enter(element) {
|
|
38
|
+
var _element$getMetaPrope;
|
|
39
|
+
storage = new NormalizeStorage(element, storageField, 'discriminator-mapping');
|
|
40
|
+
allOfDiscriminatorMapping = (_element$getMetaPrope = element.getMetaProperty('allOfDiscriminatorMapping')) !== null && _element$getMetaPrope !== void 0 ? _element$getMetaPrope : new ObjectElement();
|
|
41
|
+
},
|
|
42
|
+
leave() {
|
|
43
|
+
storage = undefined;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
SchemaElement: {
|
|
47
|
+
leave(schemaElement, key, parent, path, ancestors) {
|
|
48
|
+
var _parentElement$classe, _schemaElement$discri;
|
|
49
|
+
// no Schema.discriminator field present
|
|
50
|
+
if (!isDiscriminatorElement(schemaElement.discriminator)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const schemaJSONPointer = ancestorLineageToJSONPointer([...ancestors, parent, schemaElement]);
|
|
54
|
+
|
|
55
|
+
// skip visiting this Schema Object if it's already normalized
|
|
56
|
+
if (storage.includes(schemaJSONPointer)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// skip if both oneOf and anyOf are present
|
|
61
|
+
if (isArrayElement(schemaElement.oneOf) && isArrayElement(schemaElement.anyOf)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const parentElement = ancestors[ancestors.length - 1];
|
|
65
|
+
const schemaName = schemaElement.getMetaProperty('schemaName');
|
|
66
|
+
const allOfMapping = allOfDiscriminatorMapping.getMember(toValue(schemaName));
|
|
67
|
+
const hasAllOfMapping =
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
allOfMapping && !(parentElement !== null && parentElement !== void 0 && (_parentElement$classe = parentElement.classes) !== null && _parentElement$classe !== void 0 && _parentElement$classe.contains('json-schema-allOf'));
|
|
70
|
+
|
|
71
|
+
// skip if neither oneOf, anyOf nor allOf is present
|
|
72
|
+
if (!isArrayElement(schemaElement.oneOf) && !isArrayElement(schemaElement.anyOf) && !hasAllOfMapping) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const mapping = (_schemaElement$discri = schemaElement.discriminator.get('mapping')) !== null && _schemaElement$discri !== void 0 ? _schemaElement$discri : new ObjectElement();
|
|
76
|
+
const normalizedMapping = new ObjectElement();
|
|
77
|
+
let isNormalized = true;
|
|
78
|
+
const items = isArrayElement(schemaElement.oneOf) ? schemaElement.oneOf : isArrayElement(schemaElement.anyOf) ? schemaElement.anyOf : allOfMapping.value;
|
|
79
|
+
items.forEach(item => {
|
|
80
|
+
if (!isSchemaElement(item)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (isReferenceLikeElement(item)) {
|
|
84
|
+
isNormalized = false;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const metaRefFields = toValue(item.getMetaProperty('ref-fields'));
|
|
88
|
+
const metaRefOrigin = toValue(item.getMetaProperty('ref-origin'));
|
|
89
|
+
const metaSchemaName = toValue(item.getMetaProperty('schemaName'));
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* handle external references and internal references
|
|
93
|
+
* that don't point to components/schemas/<SchemaName>
|
|
94
|
+
*/
|
|
95
|
+
if (!hasAllOfMapping && (metaRefOrigin !== baseURI || !metaSchemaName && metaRefFields)) {
|
|
96
|
+
let hasMatchingMapping = false;
|
|
97
|
+
mapping.forEach((mappingValue, mappingKey) => {
|
|
98
|
+
var _mappingValueSchema$g;
|
|
99
|
+
const mappingValueSchema = mappingValue.getMetaProperty('ref-schema');
|
|
100
|
+
const mappingValueSchemaRefBaseURI = mappingValueSchema === null || mappingValueSchema === void 0 || (_mappingValueSchema$g = mappingValueSchema.getMetaProperty('ref-fields')) === null || _mappingValueSchema$g === void 0 ? void 0 : _mappingValueSchema$g.get('$refBaseURI');
|
|
101
|
+
if (mappingValueSchemaRefBaseURI !== null && mappingValueSchemaRefBaseURI !== void 0 && mappingValueSchemaRefBaseURI.equals(metaRefFields === null || metaRefFields === void 0 ? void 0 : metaRefFields.$refBaseURI)) {
|
|
102
|
+
normalizedMapping.set(toValue(mappingKey), cloneShallow(item));
|
|
103
|
+
hasMatchingMapping = true;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
if (!hasMatchingMapping) {
|
|
107
|
+
isNormalized = false;
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// handle internal references that point to components/schemas/<SchemaName>
|
|
113
|
+
if (metaSchemaName) {
|
|
114
|
+
let hasMatchingMapping = false;
|
|
115
|
+
mapping.forEach((mappingValue, mappingKey) => {
|
|
116
|
+
var _mappingValueSchema$g2;
|
|
117
|
+
const mappingValueSchema = mappingValue.getMetaProperty('ref-schema');
|
|
118
|
+
const mappingValueSchemaName = mappingValueSchema === null || mappingValueSchema === void 0 ? void 0 : mappingValueSchema.getMetaProperty('schemaName');
|
|
119
|
+
const mappingValueSchemaRefBaseURI = mappingValueSchema === null || mappingValueSchema === void 0 || (_mappingValueSchema$g2 = mappingValueSchema.getMetaProperty('ref-fields')) === null || _mappingValueSchema$g2 === void 0 ? void 0 : _mappingValueSchema$g2.get('$refBaseURI');
|
|
120
|
+
if (mappingValueSchemaName !== null && mappingValueSchemaName !== void 0 && mappingValueSchemaName.equals(metaSchemaName) && (!hasAllOfMapping || mappingValueSchemaRefBaseURI !== null && mappingValueSchemaRefBaseURI !== void 0 && mappingValueSchemaRefBaseURI.equals(metaRefFields === null || metaRefFields === void 0 ? void 0 : metaRefFields.$refBaseURI))) {
|
|
121
|
+
normalizedMapping.set(toValue(mappingKey), cloneShallow(item));
|
|
122
|
+
hasMatchingMapping = true;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// add a new mapping if no matching mapping was found
|
|
127
|
+
if (!hasMatchingMapping) {
|
|
128
|
+
normalizedMapping.set(metaSchemaName, cloneShallow(item));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// check if any mapping is not a Schema Object or if any mapping was not normalized
|
|
134
|
+
const mappingKeys = mapping.keys();
|
|
135
|
+
const normalizedMappingKeys = normalizedMapping.keys();
|
|
136
|
+
isNormalized = isNormalized && normalizedMapping.filter(mappingValue => !isSchemaElement(mappingValue)).length === 0 && mappingKeys.every(mappingKey => normalizedMappingKeys.includes(mappingKey));
|
|
137
|
+
if (isNormalized) {
|
|
138
|
+
schemaElement.discriminator.set('x-normalized-mapping', normalizedMapping);
|
|
139
|
+
|
|
140
|
+
// dive in and eliminate cycles that might be created by normalization
|
|
141
|
+
visit(schemaElement, {}, {
|
|
142
|
+
// @ts-ignore
|
|
143
|
+
detectCyclesCallback: (node, nodeKey, nodeParent) => {
|
|
144
|
+
if (!nodeParent || !isMemberElement(node) || !isStringElement(node.key) || !node.key.equals('discriminator') || !isDiscriminatorElement(node.value)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const discriminator = cloneShallow(node.value);
|
|
148
|
+
const discriminatorCopy = new DiscriminatorElement();
|
|
149
|
+
if (discriminator.get('mapping')) {
|
|
150
|
+
discriminatorCopy.mapping = discriminator.get('mapping');
|
|
151
|
+
}
|
|
152
|
+
if (discriminator.get('propertyName')) {
|
|
153
|
+
discriminatorCopy.propertyName = discriminator.get('propertyName');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// eslint-disable-next-line no-param-reassign
|
|
157
|
+
nodeParent[nodeKey] = new MemberElement(new StringElement('discriminator'), discriminatorCopy);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
storage.append(schemaJSONPointer);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
export default plugin;
|
|
@@ -655,9 +655,10 @@ const plugin = () => ({
|
|
|
655
655
|
|
|
656
656
|
// no element factory found
|
|
657
657
|
if (typeof elementFactory !== 'function') return undefined;
|
|
658
|
-
|
|
658
|
+
const result = elementFactory.call({
|
|
659
659
|
context
|
|
660
660
|
}, undefined, (0, _apidomCore.cloneDeep)(element.meta), (0, _apidomCore.cloneDeep)(element.attributes));
|
|
661
|
+
return (0, _apidomCore.assignSourceMap)(result, element);
|
|
661
662
|
}
|
|
662
663
|
}
|
|
663
664
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayElement, ObjectElement, cloneDeep, toValue } from '@swagger-api/apidom-core';
|
|
1
|
+
import { ArrayElement, ObjectElement, assignSourceMap, cloneDeep, toValue } from '@swagger-api/apidom-core';
|
|
2
2
|
import { ServersElement, SecurityElement, TagsElement, ServerVariablesElement, ComponentsSchemasElement, ComponentsResponsesElement, ComponentsParametersElement, ComponentsExamplesElement, ComponentsRequestBodiesElement, ComponentsHeadersElement, ComponentsSecuritySchemesElement, ComponentsLinksElement, ComponentsCallbacksElement, PathItemServersElement, PathItemParametersElement, OperationParametersElement, ParameterExamplesElement, ParameterContentElement, HeaderExamplesElement, HeaderContentElement, OperationTagsElement, OperationCallbacksElement, OperationSecurityElement, OperationServersElement, RequestBodyContentElement, MediaTypeExamplesElement, MediaTypeEncodingElement, EncodingHeadersElement, ResponseHeadersElement, ResponseContentElement, ResponseLinksElement, DiscriminatorMappingElement, OAuthFlowScopesElement } from '@swagger-api/apidom-ns-openapi-3-0';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -648,9 +648,10 @@ const plugin = () => ({
|
|
|
648
648
|
|
|
649
649
|
// no element factory found
|
|
650
650
|
if (typeof elementFactory !== 'function') return undefined;
|
|
651
|
-
|
|
651
|
+
const result = elementFactory.call({
|
|
652
652
|
context
|
|
653
653
|
}, undefined, cloneDeep(element.meta), cloneDeep(element.attributes));
|
|
654
|
+
return assignSourceMap(result, element);
|
|
654
655
|
}
|
|
655
656
|
}
|
|
656
657
|
};
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
6
|
var _apidomNsOpenapi = require("@swagger-api/apidom-ns-openapi-3-0");
|
|
7
|
+
var _apidomNsJsonSchema = require("@swagger-api/apidom-ns-json-schema-2020-12");
|
|
7
8
|
var _index = _interopRequireDefault(require("./visitors/open-api-3-1/index.cjs"));
|
|
8
9
|
var _index2 = _interopRequireDefault(require("./visitors/open-api-3-1/info/index.cjs"));
|
|
9
10
|
var _index3 = _interopRequireDefault(require("./visitors/open-api-3-1/contact/index.cjs"));
|
|
@@ -14,14 +15,12 @@ var _index6 = _interopRequireDefault(require("./visitors/open-api-3-1/server/ind
|
|
|
14
15
|
var _index7 = _interopRequireDefault(require("./visitors/open-api-3-1/server-variable/index.cjs"));
|
|
15
16
|
var _index8 = _interopRequireDefault(require("./visitors/open-api-3-1/media-type/index.cjs"));
|
|
16
17
|
var _index9 = _interopRequireDefault(require("./visitors/open-api-3-1/security-requirement/index.cjs"));
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var _$vocabularyVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/$vocabularyVisitor.cjs"));
|
|
24
|
-
var _$refVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/$refVisitor.cjs"));
|
|
18
|
+
var _index0 = _interopRequireDefault(require("./visitors/open-api-3-1/components/index.cjs"));
|
|
19
|
+
var _index1 = _interopRequireDefault(require("./visitors/open-api-3-1/tag/index.cjs"));
|
|
20
|
+
var _index10 = _interopRequireDefault(require("./visitors/open-api-3-1/reference/index.cjs"));
|
|
21
|
+
var _index11 = _interopRequireDefault(require("./visitors/open-api-3-1/parameter/index.cjs"));
|
|
22
|
+
var _index12 = _interopRequireDefault(require("./visitors/open-api-3-1/header/index.cjs"));
|
|
23
|
+
var _index13 = _interopRequireDefault(require("./visitors/open-api-3-1/schema/index.cjs"));
|
|
25
24
|
var _$defsVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/$defsVisitor.cjs"));
|
|
26
25
|
var _AllOfVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/AllOfVisitor.cjs"));
|
|
27
26
|
var _AnyOfVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/AnyOfVisitor.cjs"));
|
|
@@ -30,28 +29,29 @@ var _DependentSchemasVisitor = _interopRequireDefault(require("./visitors/open-a
|
|
|
30
29
|
var _PrefixItemsVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/PrefixItemsVisitor.cjs"));
|
|
31
30
|
var _PropertiesVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/PropertiesVisitor.cjs"));
|
|
32
31
|
var _PatternPropertiesVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/PatternPropertiesVisitor.cjs"));
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var _DependentRequiredVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/DependentRequiredVisitor.cjs"));
|
|
36
|
-
var _ExamplesVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/schema/ExamplesVisitor.cjs"));
|
|
37
|
-
var _index16 = _interopRequireDefault(require("./visitors/open-api-3-1/distriminator/index.cjs"));
|
|
38
|
-
var _index17 = _interopRequireDefault(require("./visitors/open-api-3-1/xml/index.cjs"));
|
|
32
|
+
var _index14 = _interopRequireDefault(require("./visitors/open-api-3-1/distriminator/index.cjs"));
|
|
33
|
+
var _index15 = _interopRequireDefault(require("./visitors/open-api-3-1/xml/index.cjs"));
|
|
39
34
|
var _SchemasVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/components/SchemasVisitor.cjs"));
|
|
40
35
|
var _PathItemsVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/components/PathItemsVisitor.cjs"));
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
36
|
+
var _index16 = _interopRequireDefault(require("./visitors/open-api-3-1/example/index.cjs"));
|
|
37
|
+
var _index17 = _interopRequireDefault(require("./visitors/open-api-3-1/external-documentation/index.cjs"));
|
|
38
|
+
var _index18 = _interopRequireDefault(require("./visitors/open-api-3-1/encoding/index.cjs"));
|
|
39
|
+
var _index19 = _interopRequireDefault(require("./visitors/open-api-3-1/paths/index.cjs"));
|
|
40
|
+
var _index20 = _interopRequireDefault(require("./visitors/open-api-3-1/request-body/index.cjs"));
|
|
41
|
+
var _index21 = _interopRequireDefault(require("./visitors/open-api-3-1/callback/index.cjs"));
|
|
42
|
+
var _index22 = _interopRequireDefault(require("./visitors/open-api-3-1/response/index.cjs"));
|
|
43
|
+
var _index23 = _interopRequireDefault(require("./visitors/open-api-3-1/responses/index.cjs"));
|
|
44
|
+
var _index24 = _interopRequireDefault(require("./visitors/open-api-3-1/operation/index.cjs"));
|
|
45
|
+
var _index25 = _interopRequireDefault(require("./visitors/open-api-3-1/path-item/index.cjs"));
|
|
46
|
+
var _index26 = _interopRequireDefault(require("./visitors/open-api-3-1/security-scheme/index.cjs"));
|
|
47
|
+
var _index27 = _interopRequireDefault(require("./visitors/open-api-3-1/oauth-flows/index.cjs"));
|
|
48
|
+
var _index28 = _interopRequireDefault(require("./visitors/open-api-3-1/oauth-flow/index.cjs"));
|
|
54
49
|
var _WebhooksVisitor = _interopRequireDefault(require("./visitors/open-api-3-1/WebhooksVisitor.cjs"));
|
|
50
|
+
const {
|
|
51
|
+
JSONSchema: JSONSchemaVisitor,
|
|
52
|
+
LinkDescription: LinkDescriptionVisitor
|
|
53
|
+
} = _apidomNsJsonSchema.specificationObj.visitors.document.objects;
|
|
54
|
+
|
|
55
55
|
/**
|
|
56
56
|
* Specification object allows us to have complete control over visitors
|
|
57
57
|
* when traversing the ApiDOM.
|
|
@@ -142,7 +142,7 @@ const specification = {
|
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
Components: {
|
|
145
|
-
$visitor:
|
|
145
|
+
$visitor: _index0.default,
|
|
146
146
|
fixedFields: {
|
|
147
147
|
schemas: _SchemasVisitor.default,
|
|
148
148
|
responses: _apidomNsOpenapi.specificationObj.visitors.document.objects.Components.fixedFields.responses,
|
|
@@ -157,10 +157,10 @@ const specification = {
|
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
Paths: {
|
|
160
|
-
$visitor:
|
|
160
|
+
$visitor: _index19.default
|
|
161
161
|
},
|
|
162
162
|
PathItem: {
|
|
163
|
-
$visitor:
|
|
163
|
+
$visitor: _index25.default,
|
|
164
164
|
fixedFields: {
|
|
165
165
|
$ref: _apidomNsOpenapi.specificationObj.visitors.document.objects.PathItem.fixedFields.$ref,
|
|
166
166
|
summary: _apidomNsOpenapi.specificationObj.visitors.document.objects.PathItem.fixedFields.summary,
|
|
@@ -194,7 +194,7 @@ const specification = {
|
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
196
|
Operation: {
|
|
197
|
-
$visitor:
|
|
197
|
+
$visitor: _index24.default,
|
|
198
198
|
fixedFields: {
|
|
199
199
|
tags: _apidomNsOpenapi.specificationObj.visitors.document.objects.Operation.fixedFields.tags,
|
|
200
200
|
summary: _apidomNsOpenapi.specificationObj.visitors.document.objects.Operation.fixedFields.summary,
|
|
@@ -215,14 +215,14 @@ const specification = {
|
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
ExternalDocumentation: {
|
|
218
|
-
$visitor:
|
|
218
|
+
$visitor: _index17.default,
|
|
219
219
|
fixedFields: {
|
|
220
220
|
description: _apidomNsOpenapi.specificationObj.visitors.document.objects.ExternalDocumentation.fixedFields.description,
|
|
221
221
|
url: _apidomNsOpenapi.specificationObj.visitors.document.objects.ExternalDocumentation.fixedFields.url
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
224
|
Parameter: {
|
|
225
|
-
$visitor:
|
|
225
|
+
$visitor: _index11.default,
|
|
226
226
|
fixedFields: {
|
|
227
227
|
name: _apidomNsOpenapi.specificationObj.visitors.document.objects.Parameter.fixedFields.name,
|
|
228
228
|
in: _apidomNsOpenapi.specificationObj.visitors.document.objects.Parameter.fixedFields.in,
|
|
@@ -242,7 +242,7 @@ const specification = {
|
|
|
242
242
|
}
|
|
243
243
|
},
|
|
244
244
|
RequestBody: {
|
|
245
|
-
$visitor:
|
|
245
|
+
$visitor: _index20.default,
|
|
246
246
|
fixedFields: {
|
|
247
247
|
description: _apidomNsOpenapi.specificationObj.visitors.document.objects.RequestBody.fixedFields.description,
|
|
248
248
|
content: _apidomNsOpenapi.specificationObj.visitors.document.objects.RequestBody.fixedFields.content,
|
|
@@ -261,7 +261,7 @@ const specification = {
|
|
|
261
261
|
}
|
|
262
262
|
},
|
|
263
263
|
Encoding: {
|
|
264
|
-
$visitor:
|
|
264
|
+
$visitor: _index18.default,
|
|
265
265
|
fixedFields: {
|
|
266
266
|
contentType: _apidomNsOpenapi.specificationObj.visitors.document.objects.Encoding.fixedFields.contentType,
|
|
267
267
|
headers: _apidomNsOpenapi.specificationObj.visitors.document.objects.Encoding.fixedFields.headers,
|
|
@@ -271,13 +271,13 @@ const specification = {
|
|
|
271
271
|
}
|
|
272
272
|
},
|
|
273
273
|
Responses: {
|
|
274
|
-
$visitor:
|
|
274
|
+
$visitor: _index23.default,
|
|
275
275
|
fixedFields: {
|
|
276
276
|
default: _apidomNsOpenapi.specificationObj.visitors.document.objects.Responses.fixedFields.default
|
|
277
277
|
}
|
|
278
278
|
},
|
|
279
279
|
Response: {
|
|
280
|
-
$visitor:
|
|
280
|
+
$visitor: _index22.default,
|
|
281
281
|
fixedFields: {
|
|
282
282
|
description: _apidomNsOpenapi.specificationObj.visitors.document.objects.Response.fixedFields.description,
|
|
283
283
|
headers: _apidomNsOpenapi.specificationObj.visitors.document.objects.Response.fixedFields.headers,
|
|
@@ -286,10 +286,10 @@ const specification = {
|
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
Callback: {
|
|
289
|
-
$visitor:
|
|
289
|
+
$visitor: _index21.default
|
|
290
290
|
},
|
|
291
291
|
Example: {
|
|
292
|
-
$visitor:
|
|
292
|
+
$visitor: _index16.default,
|
|
293
293
|
fixedFields: {
|
|
294
294
|
summary: _apidomNsOpenapi.specificationObj.visitors.document.objects.Example.fixedFields.summary,
|
|
295
295
|
description: _apidomNsOpenapi.specificationObj.visitors.document.objects.Example.fixedFields.description,
|
|
@@ -311,7 +311,7 @@ const specification = {
|
|
|
311
311
|
}
|
|
312
312
|
},
|
|
313
313
|
Header: {
|
|
314
|
-
$visitor:
|
|
314
|
+
$visitor: _index12.default,
|
|
315
315
|
fixedFields: {
|
|
316
316
|
description: _apidomNsOpenapi.specificationObj.visitors.document.objects.Header.fixedFields.description,
|
|
317
317
|
required: _apidomNsOpenapi.specificationObj.visitors.document.objects.Header.fixedFields.required,
|
|
@@ -329,7 +329,7 @@ const specification = {
|
|
|
329
329
|
}
|
|
330
330
|
},
|
|
331
331
|
Tag: {
|
|
332
|
-
$visitor:
|
|
332
|
+
$visitor: _index1.default,
|
|
333
333
|
fixedFields: {
|
|
334
334
|
name: _apidomNsOpenapi.specificationObj.visitors.document.objects.Tag.fixedFields.name,
|
|
335
335
|
description: _apidomNsOpenapi.specificationObj.visitors.document.objects.Tag.fixedFields.description,
|
|
@@ -339,7 +339,7 @@ const specification = {
|
|
|
339
339
|
}
|
|
340
340
|
},
|
|
341
341
|
Reference: {
|
|
342
|
-
$visitor:
|
|
342
|
+
$visitor: _index10.default,
|
|
343
343
|
fixedFields: {
|
|
344
344
|
$ref: _apidomNsOpenapi.specificationObj.visitors.document.objects.Reference.fixedFields.$ref,
|
|
345
345
|
summary: {
|
|
@@ -350,31 +350,18 @@ const specification = {
|
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
},
|
|
353
|
+
JSONSchema: {
|
|
354
|
+
$ref: '#/visitors/document/objects/Schema'
|
|
355
|
+
},
|
|
356
|
+
LinkDescription: {
|
|
357
|
+
...LinkDescriptionVisitor
|
|
358
|
+
},
|
|
353
359
|
Schema: {
|
|
354
|
-
$visitor:
|
|
360
|
+
$visitor: _index13.default,
|
|
355
361
|
fixedFields: {
|
|
362
|
+
...JSONSchemaVisitor.fixedFields,
|
|
356
363
|
// core vocabulary
|
|
357
|
-
$schema: {
|
|
358
|
-
$ref: '#/visitors/value'
|
|
359
|
-
},
|
|
360
|
-
$vocabulary: _$vocabularyVisitor.default,
|
|
361
|
-
$id: {
|
|
362
|
-
$ref: '#/visitors/value'
|
|
363
|
-
},
|
|
364
|
-
$anchor: {
|
|
365
|
-
$ref: '#/visitors/value'
|
|
366
|
-
},
|
|
367
|
-
$dynamicAnchor: {
|
|
368
|
-
$ref: '#/visitors/value'
|
|
369
|
-
},
|
|
370
|
-
$dynamicRef: {
|
|
371
|
-
$ref: '#/visitors/value'
|
|
372
|
-
},
|
|
373
|
-
$ref: _$refVisitor.default,
|
|
374
364
|
$defs: _$defsVisitor.default,
|
|
375
|
-
$comment: {
|
|
376
|
-
$ref: '#/visitors/value'
|
|
377
|
-
},
|
|
378
365
|
// applicator vocabulary
|
|
379
366
|
allOf: _AllOfVisitor.default,
|
|
380
367
|
anyOf: _AnyOfVisitor.default,
|
|
@@ -415,96 +402,7 @@ const specification = {
|
|
|
415
402
|
$ref: '#/visitors/document/objects/Schema'
|
|
416
403
|
},
|
|
417
404
|
// validation vocabulary
|
|
418
|
-
// validation Keywords for Any Instance Type
|
|
419
|
-
type: _TypeVisitor.default,
|
|
420
|
-
enum: _EnumVisitor.default,
|
|
421
|
-
const: {
|
|
422
|
-
$ref: '#/visitors/value'
|
|
423
|
-
},
|
|
424
|
-
// validation Keywords for Numeric Instances (number and integer)
|
|
425
|
-
multipleOf: {
|
|
426
|
-
$ref: '#/visitors/value'
|
|
427
|
-
},
|
|
428
|
-
maximum: {
|
|
429
|
-
$ref: '#/visitors/value'
|
|
430
|
-
},
|
|
431
|
-
exclusiveMaximum: {
|
|
432
|
-
$ref: '#/visitors/value'
|
|
433
|
-
},
|
|
434
|
-
minimum: {
|
|
435
|
-
$ref: '#/visitors/value'
|
|
436
|
-
},
|
|
437
|
-
exclusiveMinimum: {
|
|
438
|
-
$ref: '#/visitors/value'
|
|
439
|
-
},
|
|
440
|
-
// validation Keywords for Strings
|
|
441
|
-
maxLength: {
|
|
442
|
-
$ref: '#/visitors/value'
|
|
443
|
-
},
|
|
444
|
-
minLength: {
|
|
445
|
-
$ref: '#/visitors/value'
|
|
446
|
-
},
|
|
447
|
-
pattern: {
|
|
448
|
-
$ref: '#/visitors/value'
|
|
449
|
-
},
|
|
450
|
-
// validation Keywords for Arrays
|
|
451
|
-
maxItems: {
|
|
452
|
-
$ref: '#/visitors/value'
|
|
453
|
-
},
|
|
454
|
-
minItems: {
|
|
455
|
-
$ref: '#/visitors/value'
|
|
456
|
-
},
|
|
457
|
-
uniqueItems: {
|
|
458
|
-
$ref: '#/visitors/value'
|
|
459
|
-
},
|
|
460
|
-
maxContains: {
|
|
461
|
-
$ref: '#/visitors/value'
|
|
462
|
-
},
|
|
463
|
-
minContains: {
|
|
464
|
-
$ref: '#/visitors/value'
|
|
465
|
-
},
|
|
466
|
-
// validation Keywords for Objects
|
|
467
|
-
maxProperties: {
|
|
468
|
-
$ref: '#/visitors/value'
|
|
469
|
-
},
|
|
470
|
-
minProperties: {
|
|
471
|
-
$ref: '#/visitors/value'
|
|
472
|
-
},
|
|
473
|
-
required: {
|
|
474
|
-
$ref: '#/visitors/value'
|
|
475
|
-
},
|
|
476
|
-
dependentRequired: _DependentRequiredVisitor.default,
|
|
477
|
-
// basic Meta-Data Annotations vocabulary
|
|
478
|
-
title: {
|
|
479
|
-
$ref: '#/visitors/value'
|
|
480
|
-
},
|
|
481
|
-
description: {
|
|
482
|
-
$ref: '#/visitors/value'
|
|
483
|
-
},
|
|
484
|
-
default: {
|
|
485
|
-
$ref: '#/visitors/value'
|
|
486
|
-
},
|
|
487
|
-
deprecated: {
|
|
488
|
-
$ref: '#/visitors/value'
|
|
489
|
-
},
|
|
490
|
-
readOnly: {
|
|
491
|
-
$ref: '#/visitors/value'
|
|
492
|
-
},
|
|
493
|
-
writeOnly: {
|
|
494
|
-
$ref: '#/visitors/value'
|
|
495
|
-
},
|
|
496
|
-
examples: _ExamplesVisitor.default,
|
|
497
|
-
// semantic Content With "format" vocabulary
|
|
498
|
-
format: {
|
|
499
|
-
$ref: '#/visitors/value'
|
|
500
|
-
},
|
|
501
405
|
// contents of String-Encoded Data vocabulary
|
|
502
|
-
contentEncoding: {
|
|
503
|
-
$ref: '#/visitors/value'
|
|
504
|
-
},
|
|
505
|
-
contentMediaType: {
|
|
506
|
-
$ref: '#/visitors/value'
|
|
507
|
-
},
|
|
508
406
|
contentSchema: {
|
|
509
407
|
$ref: '#/visitors/document/objects/Schema'
|
|
510
408
|
},
|
|
@@ -524,14 +422,14 @@ const specification = {
|
|
|
524
422
|
}
|
|
525
423
|
},
|
|
526
424
|
Discriminator: {
|
|
527
|
-
$visitor:
|
|
425
|
+
$visitor: _index14.default,
|
|
528
426
|
fixedFields: {
|
|
529
427
|
propertyName: _apidomNsOpenapi.specificationObj.visitors.document.objects.Discriminator.fixedFields.propertyName,
|
|
530
428
|
mapping: _apidomNsOpenapi.specificationObj.visitors.document.objects.Discriminator.fixedFields.mapping
|
|
531
429
|
}
|
|
532
430
|
},
|
|
533
431
|
XML: {
|
|
534
|
-
$visitor:
|
|
432
|
+
$visitor: _index15.default,
|
|
535
433
|
fixedFields: {
|
|
536
434
|
name: _apidomNsOpenapi.specificationObj.visitors.document.objects.XML.fixedFields.name,
|
|
537
435
|
namespace: _apidomNsOpenapi.specificationObj.visitors.document.objects.XML.fixedFields.namespace,
|
|
@@ -541,7 +439,7 @@ const specification = {
|
|
|
541
439
|
}
|
|
542
440
|
},
|
|
543
441
|
SecurityScheme: {
|
|
544
|
-
$visitor:
|
|
442
|
+
$visitor: _index26.default,
|
|
545
443
|
fixedFields: {
|
|
546
444
|
type: _apidomNsOpenapi.specificationObj.visitors.document.objects.SecurityScheme.fixedFields.type,
|
|
547
445
|
description: _apidomNsOpenapi.specificationObj.visitors.document.objects.SecurityScheme.fixedFields.description,
|
|
@@ -556,7 +454,7 @@ const specification = {
|
|
|
556
454
|
}
|
|
557
455
|
},
|
|
558
456
|
OAuthFlows: {
|
|
559
|
-
$visitor:
|
|
457
|
+
$visitor: _index27.default,
|
|
560
458
|
fixedFields: {
|
|
561
459
|
implicit: {
|
|
562
460
|
$ref: '#/visitors/document/objects/OAuthFlow'
|
|
@@ -573,7 +471,7 @@ const specification = {
|
|
|
573
471
|
}
|
|
574
472
|
},
|
|
575
473
|
OAuthFlow: {
|
|
576
|
-
$visitor:
|
|
474
|
+
$visitor: _index28.default,
|
|
577
475
|
fixedFields: {
|
|
578
476
|
authorizationUrl: _apidomNsOpenapi.specificationObj.visitors.document.objects.OAuthFlow.fixedFields.authorizationUrl,
|
|
579
477
|
tokenUrl: _apidomNsOpenapi.specificationObj.visitors.document.objects.OAuthFlow.fixedFields.tokenUrl,
|