swagger-client 3.27.8 → 3.28.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/dist/swagger-client.browser.js +2183 -2304
- package/dist/swagger-client.browser.min.js +1 -1
- package/dist/swagger-client.browser.min.js.map +1 -1
- package/es/index.js +2 -2
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js +107 -109
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/all-of.js +66 -69
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js +582 -582
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/parameters.js +31 -34
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/properties.js +25 -28
- package/es/resolver/apidom/reference/parse/parsers/json/index.js +43 -42
- package/es/resolver/apidom/reference/parse/parsers/openapi-json-3-1/index.js +46 -45
- package/es/resolver/apidom/reference/parse/parsers/openapi-yaml-3-1/index.js +46 -45
- package/es/resolver/apidom/reference/parse/parsers/yaml-1-2/index.js +44 -43
- package/es/resolver/apidom/reference/resolve/resolvers/http-swagger-client/index.js +62 -60
- package/es/resolver/strategies/openapi-3-1-apidom/resolve.js +18 -18
- package/lib/index.js +1 -1
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js +105 -107
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/all-of.js +66 -69
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js +581 -581
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/parameters.js +31 -34
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/properties.js +25 -28
- package/lib/resolver/apidom/reference/parse/parsers/json/index.js +43 -42
- package/lib/resolver/apidom/reference/parse/parsers/openapi-json-3-1/index.js +46 -45
- package/lib/resolver/apidom/reference/parse/parsers/openapi-yaml-3-1/index.js +46 -45
- package/lib/resolver/apidom/reference/parse/parsers/yaml-1-2/index.js +44 -43
- package/lib/resolver/apidom/reference/resolve/resolvers/http-swagger-client/index.js +61 -59
- package/lib/resolver/strategies/openapi-3-1-apidom/resolve.js +11 -11
- package/package.json +23 -22
- package/es/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/utils/compose.js +0 -5
- package/lib/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/utils/compose.js +0 -11
|
@@ -23,420 +23,463 @@ const {
|
|
|
23
23
|
const visitAsync = _apidomCore.visit[Symbol.for('nodejs.util.promisify.custom')];
|
|
24
24
|
|
|
25
25
|
// initialize element identity manager
|
|
26
|
-
const identityManager =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
basePath = this.basePath
|
|
26
|
+
const identityManager = new _apidomCore.IdentityManager();
|
|
27
|
+
class OpenAPI3_1SwaggerClientDereferenceVisitor extends _openapi.OpenAPI3_1DereferenceVisitor {
|
|
28
|
+
useCircularStructures;
|
|
29
|
+
allowMetaPatches;
|
|
30
|
+
basePath;
|
|
31
|
+
constructor({
|
|
32
|
+
allowMetaPatches = true,
|
|
33
|
+
useCircularStructures = false,
|
|
34
|
+
basePath = null,
|
|
35
|
+
...rest
|
|
37
36
|
}) {
|
|
37
|
+
super(rest);
|
|
38
38
|
this.allowMetaPatches = allowMetaPatches;
|
|
39
39
|
this.useCircularStructures = useCircularStructures;
|
|
40
40
|
this.basePath = basePath;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.refractCache.set(cacheKey, referencedElement);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// detect direct or indirect reference
|
|
91
|
-
if (referencingElement === referencedElement) {
|
|
92
|
-
throw new _apidomError.ApiDOMError('Recursive Reference Object detected');
|
|
41
|
+
}
|
|
42
|
+
async ReferenceElement(referencingElement, key, parent, path, ancestors) {
|
|
43
|
+
try {
|
|
44
|
+
// skip current referencing element as it's already been access
|
|
45
|
+
if (this.indirections.includes(referencingElement)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
49
|
+
const retrievalURI = this.toBaseURI((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
50
|
+
const isInternalReference = _empty.url.stripHash(this.reference.uri) === retrievalURI;
|
|
51
|
+
const isExternalReference = !isInternalReference;
|
|
52
|
+
|
|
53
|
+
// ignore resolving internal Reference Objects
|
|
54
|
+
if (!this.options.resolve.internal && isInternalReference) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
// ignore resolving external Reference Objects
|
|
58
|
+
if (!this.options.resolve.external && isExternalReference) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
const reference = await this.toReference((0, _apidomCore.toValue)(referencingElement.$ref));
|
|
62
|
+
const $refBaseURI = _empty.url.resolve(retrievalURI, (0, _apidomCore.toValue)(referencingElement.$ref));
|
|
63
|
+
this.indirections.push(referencingElement);
|
|
64
|
+
const jsonPointer = (0, _apidomJsonPointer.uriToPointer)($refBaseURI);
|
|
65
|
+
|
|
66
|
+
// possibly non-semantic fragment
|
|
67
|
+
let referencedElement = (0, _apidomJsonPointer.evaluate)(jsonPointer, reference.value.result);
|
|
68
|
+
referencedElement.id = identityManager.identify(referencedElement);
|
|
69
|
+
|
|
70
|
+
// applying semantics to a fragment
|
|
71
|
+
if ((0, _apidomCore.isPrimitiveElement)(referencedElement)) {
|
|
72
|
+
const referencedElementType = (0, _apidomCore.toValue)(referencingElement.meta.get('referenced-element'));
|
|
73
|
+
const cacheKey = `${referencedElementType}-${(0, _apidomCore.toValue)(identityManager.identify(referencedElement))}`;
|
|
74
|
+
if (this.refractCache.has(cacheKey)) {
|
|
75
|
+
referencedElement = this.refractCache.get(cacheKey);
|
|
76
|
+
} else if ((0, _apidomNsOpenapi.isReferenceLikeElement)(referencedElement)) {
|
|
77
|
+
// handling indirect references
|
|
78
|
+
referencedElement = _apidomNsOpenapi.ReferenceElement.refract(referencedElement);
|
|
79
|
+
referencedElement.setMetaProperty('referenced-element', referencedElementType);
|
|
80
|
+
this.refractCache.set(cacheKey, referencedElement);
|
|
81
|
+
} else {
|
|
82
|
+
// handling direct references
|
|
83
|
+
const ElementClass = this.namespace.getElementClass(referencedElementType);
|
|
84
|
+
referencedElement = ElementClass.refract(referencedElement);
|
|
85
|
+
this.refractCache.set(cacheKey, referencedElement);
|
|
93
86
|
}
|
|
87
|
+
}
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
89
|
+
// detect direct or indirect reference
|
|
90
|
+
if (referencingElement === referencedElement) {
|
|
91
|
+
throw new _apidomError.ApiDOMError('Recursive Reference Object detected');
|
|
92
|
+
}
|
|
99
93
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
throw new _apidomError.ApiDOMError('Circular reference detected');
|
|
105
|
-
} else if (this.options.dereference.circular === 'replace') {
|
|
106
|
-
var _this$options$derefer, _this$options$derefer2;
|
|
107
|
-
const refElement = new _apidomCore.RefElement(referencedElement.id, {
|
|
108
|
-
type: 'reference',
|
|
109
|
-
uri: reference.uri,
|
|
110
|
-
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
111
|
-
baseURI: $refBaseURI,
|
|
112
|
-
referencingElement
|
|
113
|
-
});
|
|
114
|
-
const replacer = (_this$options$derefer = (_this$options$derefer2 = this.options.dereference.strategyOpts['openapi-3-1']) == null ? void 0 : _this$options$derefer2.circularReplacer) != null ? _this$options$derefer : this.options.dereference.circularReplacer;
|
|
115
|
-
const replacement = replacer(refElement);
|
|
116
|
-
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
117
|
-
parent.value = replacement; // eslint-disable-line no-param-reassign
|
|
118
|
-
} else if (Array.isArray(parent)) {
|
|
119
|
-
parent[key] = replacement; // eslint-disable-line no-param-reassign
|
|
120
|
-
}
|
|
121
|
-
return !parent ? replacement : false;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
94
|
+
// detect maximum depth of dereferencing
|
|
95
|
+
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
96
|
+
throw new _empty.MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
97
|
+
}
|
|
124
98
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
// append referencing reference to ancestors lineage
|
|
139
|
-
directAncestors.add(referencingElement);
|
|
140
|
-
const visitor = OpenApi3_1SwaggerClientDereferenceVisitor({
|
|
141
|
-
reference,
|
|
142
|
-
namespace: this.namespace,
|
|
143
|
-
indirections: [...this.indirections],
|
|
144
|
-
options: this.options,
|
|
145
|
-
refractCache: this.refractCache,
|
|
146
|
-
ancestors: ancestorsLineage,
|
|
147
|
-
allowMetaPatches: this.allowMetaPatches,
|
|
148
|
-
useCircularStructures: this.useCircularStructures,
|
|
149
|
-
basePath: (_this$basePath = this.basePath) != null ? _this$basePath : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref']
|
|
99
|
+
// detect second deep dive into the same fragment and avoid it
|
|
100
|
+
if (ancestorsLineage.includes(referencedElement)) {
|
|
101
|
+
reference.refSet.circular = true;
|
|
102
|
+
if (this.options.dereference.circular === 'error') {
|
|
103
|
+
throw new _apidomError.ApiDOMError('Circular reference detected');
|
|
104
|
+
} else if (this.options.dereference.circular === 'replace') {
|
|
105
|
+
var _this$options$derefer, _this$options$derefer2;
|
|
106
|
+
const refElement = new _apidomCore.RefElement(referencedElement.id, {
|
|
107
|
+
type: 'reference',
|
|
108
|
+
uri: reference.uri,
|
|
109
|
+
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
110
|
+
baseURI: $refBaseURI,
|
|
111
|
+
referencingElement
|
|
150
112
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
113
|
+
const replacer = (_this$options$derefer = (_this$options$derefer2 = this.options.dereference.strategyOpts['openapi-3-1']) == null ? void 0 : _this$options$derefer2.circularReplacer) != null ? _this$options$derefer : this.options.dereference.circularReplacer;
|
|
114
|
+
const replacement = replacer(refElement);
|
|
115
|
+
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
116
|
+
parent.value = replacement; // eslint-disable-line no-param-reassign
|
|
117
|
+
} else if (Array.isArray(parent)) {
|
|
118
|
+
parent[key] = replacement; // eslint-disable-line no-param-reassign
|
|
119
|
+
}
|
|
120
|
+
return !parent ? replacement : false;
|
|
158
121
|
}
|
|
159
|
-
|
|
160
|
-
const mergedElement = (0, _apidomCore.cloneShallow)(referencedElement);
|
|
122
|
+
}
|
|
161
123
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Dive deep into the fragment.
|
|
126
|
+
*
|
|
127
|
+
* Cases to consider:
|
|
128
|
+
* 1. We're crossing document boundary
|
|
129
|
+
* 2. Fragment is from non-root document
|
|
130
|
+
* 3. Fragment is a Reference Object. We need to follow it to get the eventual value
|
|
131
|
+
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
132
|
+
*/
|
|
133
|
+
const isNonRootDocument = _empty.url.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
134
|
+
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
135
|
+
if ((isExternalReference || isNonRootDocument || (0, _apidomNsOpenapi.isReferenceElement)(referencedElement) || shouldDetectCircular) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
136
|
+
var _this$basePath;
|
|
137
|
+
// append referencing reference to ancestors lineage
|
|
138
|
+
directAncestors.add(referencingElement);
|
|
139
|
+
const visitor = new OpenAPI3_1SwaggerClientDereferenceVisitor({
|
|
140
|
+
reference,
|
|
141
|
+
namespace: this.namespace,
|
|
142
|
+
indirections: [...this.indirections],
|
|
143
|
+
options: this.options,
|
|
144
|
+
refractCache: this.refractCache,
|
|
145
|
+
ancestors: ancestorsLineage,
|
|
146
|
+
allowMetaPatches: this.allowMetaPatches,
|
|
147
|
+
useCircularStructures: this.useCircularStructures,
|
|
148
|
+
basePath: (_this$basePath = this.basePath) != null ? _this$basePath : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref']
|
|
149
|
+
});
|
|
150
|
+
referencedElement = await visitAsync(referencedElement, visitor, {
|
|
151
|
+
keyMap: _apidomNsOpenapi.keyMap,
|
|
152
|
+
nodeTypeGetter: _apidomNsOpenapi.getNodeType
|
|
167
153
|
});
|
|
168
|
-
// annotate fragment with info about origin
|
|
169
|
-
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
170
|
-
// annotate fragment with info about referencing element
|
|
171
|
-
mergedElement.setMetaProperty('ref-referencing-element-id', (0, _apidomCore.cloneDeep)(identityManager.identify(referencingElement)));
|
|
172
154
|
|
|
173
|
-
//
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
155
|
+
// remove referencing reference from ancestors lineage
|
|
156
|
+
directAncestors.delete(referencingElement);
|
|
157
|
+
}
|
|
158
|
+
this.indirections.pop();
|
|
159
|
+
const mergedElement = (0, _apidomCore.cloneShallow)(referencedElement);
|
|
160
|
+
|
|
161
|
+
// annotate fragment with info about original Reference element
|
|
162
|
+
mergedElement.setMetaProperty('ref-fields', {
|
|
163
|
+
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
164
|
+
description: (0, _apidomCore.toValue)(referencingElement.description),
|
|
165
|
+
summary: (0, _apidomCore.toValue)(referencingElement.summary)
|
|
166
|
+
});
|
|
167
|
+
// annotate fragment with info about origin
|
|
168
|
+
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
169
|
+
// annotate fragment with info about referencing element
|
|
170
|
+
mergedElement.setMetaProperty('ref-referencing-element-id', (0, _apidomCore.cloneDeep)(identityManager.identify(referencingElement)));
|
|
171
|
+
|
|
172
|
+
// override description and summary (outer has higher priority then inner)
|
|
173
|
+
if ((0, _apidomCore.isObjectElement)(referencedElement)) {
|
|
174
|
+
if (referencingElement.hasKey('description') && 'description' in referencedElement) {
|
|
175
|
+
mergedElement.remove('description');
|
|
176
|
+
mergedElement.set('description', referencingElement.get('description'));
|
|
177
|
+
}
|
|
178
|
+
if (referencingElement.hasKey('summary') && 'summary' in referencedElement) {
|
|
179
|
+
mergedElement.remove('summary');
|
|
180
|
+
mergedElement.set('summary', referencingElement.get('summary'));
|
|
183
181
|
}
|
|
182
|
+
}
|
|
184
183
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
184
|
+
// apply meta patches
|
|
185
|
+
if (this.allowMetaPatches && (0, _apidomCore.isObjectElement)(mergedElement)) {
|
|
186
|
+
// apply meta patch only when not already applied
|
|
187
|
+
if (!mergedElement.hasKey('$$ref')) {
|
|
188
|
+
const baseURI = _empty.url.resolve(retrievalURI, $refBaseURI);
|
|
189
|
+
mergedElement.set('$$ref', baseURI);
|
|
192
190
|
}
|
|
191
|
+
}
|
|
193
192
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Transclude referencing element with merged referenced element.
|
|
195
|
+
*/
|
|
196
|
+
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
197
|
+
parent.value = mergedElement; // eslint-disable-line no-param-reassign
|
|
198
|
+
} else if (Array.isArray(parent)) {
|
|
199
|
+
parent[key] = mergedElement; // eslint-disable-line no-param-reassign
|
|
200
|
+
}
|
|
202
201
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
202
|
+
/**
|
|
203
|
+
* We're at the root of the tree, so we're just replacing the entire tree.
|
|
204
|
+
*/
|
|
205
|
+
return !parent ? mergedElement : false;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
var _this$basePath2, _this$options$derefer3;
|
|
208
|
+
const rootCause = (0, _getRootCause.default)(error);
|
|
209
|
+
const wrappedError = wrapError(rootCause, {
|
|
210
|
+
baseDoc: this.reference.uri,
|
|
211
|
+
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
212
|
+
pointer: (0, _apidomJsonPointer.uriToPointer)((0, _apidomCore.toValue)(referencingElement.$ref)),
|
|
213
|
+
fullPath: (_this$basePath2 = this.basePath) != null ? _this$basePath2 : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref']
|
|
214
|
+
});
|
|
215
|
+
(_this$options$derefer3 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer3 = _this$options$derefer3.errors) == null || _this$options$derefer3.push == null || _this$options$derefer3.push(wrappedError);
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async PathItemElement(pathItemElement, key, parent, path, ancestors) {
|
|
220
|
+
try {
|
|
221
|
+
// ignore PathItemElement without $ref field
|
|
222
|
+
if (!(0, _apidomCore.isStringElement)(pathItemElement.$ref)) {
|
|
217
223
|
return undefined;
|
|
218
224
|
}
|
|
219
|
-
},
|
|
220
|
-
async PathItemElement(pathItemElement, key, parent, path, ancestors) {
|
|
221
|
-
try {
|
|
222
|
-
// ignore PathItemElement without $ref field
|
|
223
|
-
if (!(0, _apidomCore.isStringElement)(pathItemElement.$ref)) {
|
|
224
|
-
return undefined;
|
|
225
|
-
}
|
|
226
225
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
// skip current referencing element as it's already been access
|
|
227
|
+
if (this.indirections.includes(pathItemElement)) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
231
230
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
// ignore resolving internal Path Item Elements
|
|
242
|
-
if (!this.options.resolve.internal && isInternalReference) {
|
|
243
|
-
return undefined;
|
|
244
|
-
}
|
|
245
|
-
// ignore resolving external Path Item Elements
|
|
246
|
-
if (!this.options.resolve.external && isExternalReference) {
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
const reference = await this.toReference((0, _apidomCore.toValue)(pathItemElement.$ref));
|
|
250
|
-
const $refBaseURI = _empty.url.resolve(retrievalURI, (0, _apidomCore.toValue)(pathItemElement.$ref));
|
|
251
|
-
this.indirections.push(pathItemElement);
|
|
252
|
-
const jsonPointer = (0, _apidomJsonPointer.uriToPointer)($refBaseURI);
|
|
253
|
-
|
|
254
|
-
// possibly non-semantic referenced element
|
|
255
|
-
let referencedElement = (0, _apidomJsonPointer.evaluate)(jsonPointer, reference.value.result);
|
|
256
|
-
referencedElement.id = identityManager.identify(referencedElement);
|
|
257
|
-
|
|
258
|
-
// applying semantics to a referenced element
|
|
259
|
-
if ((0, _apidomCore.isPrimitiveElement)(referencedElement)) {
|
|
260
|
-
const cacheKey = `path-item-${(0, _apidomCore.toValue)(identityManager.identify(referencedElement))}`;
|
|
261
|
-
if (this.refractCache.has(cacheKey)) {
|
|
262
|
-
referencedElement = this.refractCache.get(cacheKey);
|
|
263
|
-
} else {
|
|
264
|
-
referencedElement = _apidomNsOpenapi.PathItemElement.refract(referencedElement);
|
|
265
|
-
this.refractCache.set(cacheKey, referencedElement);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
231
|
+
// skip already identified cycled Path Item Objects
|
|
232
|
+
if ((0, _apidomCore.includesClasses)(['cycle'], pathItemElement.$ref)) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
236
|
+
const retrievalURI = this.toBaseURI((0, _apidomCore.toValue)(pathItemElement.$ref));
|
|
237
|
+
const isInternalReference = _empty.url.stripHash(this.reference.uri) === retrievalURI;
|
|
238
|
+
const isExternalReference = !isInternalReference;
|
|
268
239
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
240
|
+
// ignore resolving internal Path Item Elements
|
|
241
|
+
if (!this.options.resolve.internal && isInternalReference) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
// ignore resolving external Path Item Elements
|
|
245
|
+
if (!this.options.resolve.external && isExternalReference) {
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
const reference = await this.toReference((0, _apidomCore.toValue)(pathItemElement.$ref));
|
|
249
|
+
const $refBaseURI = _empty.url.resolve(retrievalURI, (0, _apidomCore.toValue)(pathItemElement.$ref));
|
|
250
|
+
this.indirections.push(pathItemElement);
|
|
251
|
+
const jsonPointer = (0, _apidomJsonPointer.uriToPointer)($refBaseURI);
|
|
252
|
+
|
|
253
|
+
// possibly non-semantic referenced element
|
|
254
|
+
let referencedElement = (0, _apidomJsonPointer.evaluate)(jsonPointer, reference.value.result);
|
|
255
|
+
referencedElement.id = identityManager.identify(referencedElement);
|
|
256
|
+
|
|
257
|
+
// applying semantics to a referenced element
|
|
258
|
+
if ((0, _apidomCore.isPrimitiveElement)(referencedElement)) {
|
|
259
|
+
const cacheKey = `path-item-${(0, _apidomCore.toValue)(identityManager.identify(referencedElement))}`;
|
|
260
|
+
if (this.refractCache.has(cacheKey)) {
|
|
261
|
+
referencedElement = this.refractCache.get(cacheKey);
|
|
262
|
+
} else {
|
|
263
|
+
referencedElement = _apidomNsOpenapi.PathItemElement.refract(referencedElement);
|
|
264
|
+
this.refractCache.set(cacheKey, referencedElement);
|
|
272
265
|
}
|
|
266
|
+
}
|
|
273
267
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
268
|
+
// detect direct or indirect reference
|
|
269
|
+
if (pathItemElement === referencedElement) {
|
|
270
|
+
throw new _apidomError.ApiDOMError('Recursive Path Item Object reference detected');
|
|
271
|
+
}
|
|
278
272
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
273
|
+
// detect maximum depth of dereferencing
|
|
274
|
+
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
275
|
+
throw new _empty.MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// detect second deep dive into the same fragment and avoid it
|
|
279
|
+
if (ancestorsLineage.includes(referencedElement)) {
|
|
280
|
+
reference.refSet.circular = true;
|
|
281
|
+
if (this.options.dereference.circular === 'error') {
|
|
282
|
+
throw new _apidomError.ApiDOMError('Circular reference detected');
|
|
283
|
+
} else if (this.options.dereference.circular === 'replace') {
|
|
284
|
+
var _this$options$derefer4, _this$options$derefer5;
|
|
285
|
+
const refElement = new _apidomCore.RefElement(referencedElement.id, {
|
|
286
|
+
type: 'path-item',
|
|
287
|
+
uri: reference.uri,
|
|
288
|
+
$ref: (0, _apidomCore.toValue)(pathItemElement.$ref),
|
|
289
|
+
baseURI: $refBaseURI,
|
|
290
|
+
referencingElement: pathItemElement
|
|
291
|
+
});
|
|
292
|
+
const replacer = (_this$options$derefer4 = (_this$options$derefer5 = this.options.dereference.strategyOpts['openapi-3-1']) == null ? void 0 : _this$options$derefer5.circularReplacer) != null ? _this$options$derefer4 : this.options.dereference.circularReplacer;
|
|
293
|
+
const replacement = replacer(refElement);
|
|
294
|
+
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
295
|
+
parent.value = replacement; // eslint-disable-line no-param-reassign
|
|
296
|
+
} else if (Array.isArray(parent)) {
|
|
297
|
+
parent[key] = replacement; // eslint-disable-line no-param-reassign
|
|
301
298
|
}
|
|
299
|
+
return !parent ? replacement : false;
|
|
302
300
|
}
|
|
301
|
+
}
|
|
303
302
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
303
|
+
/**
|
|
304
|
+
* Dive deep into the fragment.
|
|
305
|
+
*
|
|
306
|
+
* Cases to consider:
|
|
307
|
+
* 1. We're crossing document boundary
|
|
308
|
+
* 2. Fragment is from non-root document
|
|
309
|
+
* 3. Fragment is a Path Item Object with $ref field. We need to follow it to get the eventual value
|
|
310
|
+
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
311
|
+
*/
|
|
312
|
+
const isNonRootDocument = _empty.url.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
313
|
+
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
314
|
+
if ((isExternalReference || isNonRootDocument || (0, _apidomNsOpenapi.isPathItemElement)(referencedElement) && (0, _apidomCore.isStringElement)(referencedElement.$ref) || shouldDetectCircular) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
315
|
+
var _this$basePath3;
|
|
316
|
+
// append referencing schema to ancestors lineage
|
|
317
|
+
directAncestors.add(pathItemElement);
|
|
318
|
+
|
|
319
|
+
// dive deep into the referenced element
|
|
320
|
+
const visitor = new OpenAPI3_1SwaggerClientDereferenceVisitor({
|
|
321
|
+
reference,
|
|
322
|
+
namespace: this.namespace,
|
|
323
|
+
indirections: [...this.indirections],
|
|
324
|
+
options: this.options,
|
|
325
|
+
ancestors: ancestorsLineage,
|
|
326
|
+
allowMetaPatches: this.allowMetaPatches,
|
|
327
|
+
useCircularStructures: this.useCircularStructures,
|
|
328
|
+
basePath: (_this$basePath3 = this.basePath) != null ? _this$basePath3 : [...(0, _toPath.default)([...ancestors, parent, pathItemElement]), '$ref']
|
|
329
|
+
});
|
|
330
|
+
referencedElement = await visitAsync(referencedElement, visitor, {
|
|
331
|
+
keyMap: _apidomNsOpenapi.keyMap,
|
|
332
|
+
nodeTypeGetter: _apidomNsOpenapi.getNodeType
|
|
333
|
+
});
|
|
335
334
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
335
|
+
// remove referencing schema from ancestors lineage
|
|
336
|
+
directAncestors.delete(pathItemElement);
|
|
337
|
+
}
|
|
338
|
+
this.indirections.pop();
|
|
340
339
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
340
|
+
/**
|
|
341
|
+
* Creating a new version of Path Item by merging fields from referenced Path Item with referencing one.
|
|
342
|
+
*/
|
|
343
|
+
if ((0, _apidomNsOpenapi.isPathItemElement)(referencedElement)) {
|
|
344
|
+
const mergedElement = new _apidomNsOpenapi.PathItemElement([...referencedElement.content], (0, _apidomCore.cloneDeep)(referencedElement.meta), (0, _apidomCore.cloneDeep)(referencedElement.attributes));
|
|
345
|
+
// existing keywords from referencing PathItemElement overrides ones from referenced element
|
|
346
|
+
pathItemElement.forEach((value, keyElement, item) => {
|
|
347
|
+
mergedElement.remove((0, _apidomCore.toValue)(keyElement));
|
|
348
|
+
mergedElement.content.push(item);
|
|
349
|
+
});
|
|
350
|
+
mergedElement.remove('$ref');
|
|
352
351
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
352
|
+
// annotate referenced element with info about original referencing element
|
|
353
|
+
mergedElement.setMetaProperty('ref-fields', {
|
|
354
|
+
$ref: (0, _apidomCore.toValue)(pathItemElement.$ref)
|
|
355
|
+
});
|
|
356
|
+
// annotate referenced element with info about origin
|
|
357
|
+
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
358
|
+
// annotate fragment with info about referencing element
|
|
359
|
+
mergedElement.setMetaProperty('ref-referencing-element-id', (0, _apidomCore.cloneDeep)(identityManager.identify(pathItemElement)));
|
|
360
|
+
|
|
361
|
+
// apply meta patches
|
|
362
|
+
if (this.allowMetaPatches) {
|
|
363
|
+
// apply meta patch only when not already applied
|
|
364
|
+
if (typeof mergedElement.get('$$ref') === 'undefined') {
|
|
365
|
+
const baseURI = _empty.url.resolve(retrievalURI, $refBaseURI);
|
|
366
|
+
mergedElement.set('$$ref', baseURI);
|
|
369
367
|
}
|
|
370
|
-
referencedElement = mergedElement;
|
|
371
368
|
}
|
|
369
|
+
referencedElement = mergedElement;
|
|
370
|
+
}
|
|
372
371
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
372
|
+
/**
|
|
373
|
+
* Transclude referencing element with merged referenced element.
|
|
374
|
+
*/
|
|
375
|
+
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
376
|
+
parent.value = referencedElement; // eslint-disable-line no-param-reassign
|
|
377
|
+
} else if (Array.isArray(parent)) {
|
|
378
|
+
parent[key] = referencedElement; // eslint-disable-line no-param-reassign
|
|
379
|
+
}
|
|
381
380
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
381
|
+
/**
|
|
382
|
+
* We're at the root of the tree, so we're just replacing the entire tree.
|
|
383
|
+
*/
|
|
384
|
+
return !parent ? referencedElement : undefined;
|
|
385
|
+
} catch (error) {
|
|
386
|
+
var _this$basePath4, _this$options$derefer6;
|
|
387
|
+
const rootCause = (0, _getRootCause.default)(error);
|
|
388
|
+
const wrappedError = wrapError(rootCause, {
|
|
389
|
+
baseDoc: this.reference.uri,
|
|
390
|
+
$ref: (0, _apidomCore.toValue)(pathItemElement.$ref),
|
|
391
|
+
pointer: (0, _apidomJsonPointer.uriToPointer)((0, _apidomCore.toValue)(pathItemElement.$ref)),
|
|
392
|
+
fullPath: (_this$basePath4 = this.basePath) != null ? _this$basePath4 : [...(0, _toPath.default)([...ancestors, parent, pathItemElement]), '$ref']
|
|
393
|
+
});
|
|
394
|
+
(_this$options$derefer6 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer6 = _this$options$derefer6.errors) == null || _this$options$derefer6.push == null || _this$options$derefer6.push(wrappedError);
|
|
395
|
+
return undefined;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
async SchemaElement(referencingElement, key, parent, path, ancestors) {
|
|
399
|
+
try {
|
|
400
|
+
// skip current referencing schema as $ref keyword was not defined
|
|
401
|
+
if (!(0, _apidomCore.isStringElement)(referencingElement.$ref)) {
|
|
402
|
+
// skip traversing this schema but traverse all it's child schemas
|
|
396
403
|
return undefined;
|
|
397
404
|
}
|
|
398
|
-
},
|
|
399
|
-
async SchemaElement(referencingElement, key, parent, path, ancestors) {
|
|
400
|
-
try {
|
|
401
|
-
// skip current referencing schema as $ref keyword was not defined
|
|
402
|
-
if (!(0, _apidomCore.isStringElement)(referencingElement.$ref)) {
|
|
403
|
-
// skip traversing this schema but traverse all it's child schemas
|
|
404
|
-
return undefined;
|
|
405
|
-
}
|
|
406
405
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
// skip current referencing element as it's already been access
|
|
407
|
+
if (this.indirections.includes(referencingElement)) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
const [ancestorsLineage, directAncestors] = this.toAncestorLineage([...ancestors, parent]);
|
|
411
|
+
|
|
412
|
+
// compute baseURI using rules around $id and $ref keywords
|
|
413
|
+
let reference = await this.toReference(_empty.url.unsanitize(this.reference.uri));
|
|
414
|
+
let {
|
|
415
|
+
uri: retrievalURI
|
|
416
|
+
} = reference;
|
|
417
|
+
const $refBaseURI = (0, _openapi.resolveSchema$refField)(retrievalURI, referencingElement);
|
|
418
|
+
const $refBaseURIStrippedHash = _empty.url.stripHash($refBaseURI);
|
|
419
|
+
const file = new _empty.File({
|
|
420
|
+
uri: $refBaseURIStrippedHash
|
|
421
|
+
});
|
|
422
|
+
const isUnknownURI = !this.options.resolve.resolvers.some(r => r.canRead(file));
|
|
423
|
+
const isURL = !isUnknownURI;
|
|
424
|
+
let isInternalReference = _empty.url.stripHash(this.reference.uri) === $refBaseURI;
|
|
425
|
+
let isExternalReference = !isInternalReference;
|
|
426
|
+
this.indirections.push(referencingElement);
|
|
427
|
+
|
|
428
|
+
// determining reference, proper evaluation and selection mechanism
|
|
429
|
+
let referencedElement;
|
|
430
|
+
try {
|
|
431
|
+
if (isUnknownURI || isURL) {
|
|
432
|
+
// we're dealing with canonical URI or URL with possible fragment
|
|
433
|
+
retrievalURI = this.toBaseURI($refBaseURI);
|
|
434
|
+
const selector = $refBaseURI;
|
|
435
|
+
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
436
|
+
referencedElement = (0, _uri.evaluate)(selector, referenceAsSchema);
|
|
437
|
+
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
438
|
+
referencedElement.id = identityManager.identify(referencedElement);
|
|
439
|
+
|
|
440
|
+
// ignore resolving internal Schema Objects
|
|
441
|
+
if (!this.options.resolve.internal && isInternalReference) {
|
|
442
|
+
// skip traversing this schema element but traverse all it's child elements
|
|
443
|
+
return undefined;
|
|
444
|
+
}
|
|
445
|
+
// ignore resolving external Schema Objects
|
|
446
|
+
if (!this.options.resolve.external && isExternalReference) {
|
|
447
|
+
// skip traversing this schema element but traverse all it's child elements
|
|
448
|
+
return undefined;
|
|
449
|
+
}
|
|
450
|
+
} else {
|
|
451
|
+
// we're assuming here that we're dealing with JSON Pointer here
|
|
452
|
+
retrievalURI = this.toBaseURI($refBaseURI);
|
|
453
|
+
isInternalReference = _empty.url.stripHash(this.reference.uri) === retrievalURI;
|
|
454
|
+
isExternalReference = !isInternalReference;
|
|
455
|
+
|
|
456
|
+
// ignore resolving internal Schema Objects
|
|
457
|
+
if (!this.options.resolve.internal && isInternalReference) {
|
|
458
|
+
// skip traversing this schema element but traverse all it's child elements
|
|
459
|
+
return undefined;
|
|
460
|
+
}
|
|
461
|
+
// ignore resolving external Schema Objects
|
|
462
|
+
if (!this.options.resolve.external && isExternalReference) {
|
|
463
|
+
// skip traversing this schema element but traverse all it's child elements
|
|
464
|
+
return undefined;
|
|
465
|
+
}
|
|
466
|
+
reference = await this.toReference(_empty.url.unsanitize($refBaseURI));
|
|
467
|
+
const selector = (0, _apidomJsonPointer.uriToPointer)($refBaseURI);
|
|
468
|
+
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
469
|
+
referencedElement = (0, _apidomJsonPointer.evaluate)(selector, referenceAsSchema);
|
|
470
|
+
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
471
|
+
referencedElement.id = identityManager.identify(referencedElement);
|
|
410
472
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
uri: $refBaseURIStrippedHash
|
|
422
|
-
});
|
|
423
|
-
const isUnknownURI = !this.options.resolve.resolvers.some(r => r.canRead(file));
|
|
424
|
-
const isURL = !isUnknownURI;
|
|
425
|
-
let isInternalReference = _empty.url.stripHash(this.reference.uri) === $refBaseURI;
|
|
426
|
-
let isExternalReference = !isInternalReference;
|
|
427
|
-
this.indirections.push(referencingElement);
|
|
428
|
-
|
|
429
|
-
// determining reference, proper evaluation and selection mechanism
|
|
430
|
-
let referencedElement;
|
|
431
|
-
try {
|
|
432
|
-
if (isUnknownURI || isURL) {
|
|
433
|
-
// we're dealing with canonical URI or URL with possible fragment
|
|
434
|
-
retrievalURI = this.toBaseURI($refBaseURI);
|
|
435
|
-
const selector = $refBaseURI;
|
|
436
|
-
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
437
|
-
referencedElement = (0, _uri.evaluate)(selector, referenceAsSchema);
|
|
438
|
-
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
439
|
-
referencedElement.id = identityManager.identify(referencedElement);
|
|
473
|
+
} catch (error) {
|
|
474
|
+
/**
|
|
475
|
+
* No SchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
476
|
+
* the URL and assume the returned response is a JSON Schema.
|
|
477
|
+
*/
|
|
478
|
+
if (isURL && error instanceof _uri.EvaluationJsonSchemaUriError) {
|
|
479
|
+
if ((0, _$anchor.isAnchor)((0, _$anchor.uriToAnchor)($refBaseURI))) {
|
|
480
|
+
// we're dealing with JSON Schema $anchor here
|
|
481
|
+
isInternalReference = _empty.url.stripHash(this.reference.uri) === retrievalURI;
|
|
482
|
+
isExternalReference = !isInternalReference;
|
|
440
483
|
|
|
441
484
|
// ignore resolving internal Schema Objects
|
|
442
485
|
if (!this.options.resolve.internal && isInternalReference) {
|
|
@@ -448,9 +491,15 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
|
|
|
448
491
|
// skip traversing this schema element but traverse all it's child elements
|
|
449
492
|
return undefined;
|
|
450
493
|
}
|
|
494
|
+
reference = await this.toReference(_empty.url.unsanitize($refBaseURI));
|
|
495
|
+
const selector = (0, _$anchor.uriToAnchor)($refBaseURI);
|
|
496
|
+
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
497
|
+
referencedElement = (0, _$anchor.evaluate)(selector, referenceAsSchema);
|
|
498
|
+
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
499
|
+
referencedElement.id = identityManager.identify(referencedElement);
|
|
451
500
|
} else {
|
|
452
501
|
// we're assuming here that we're dealing with JSON Pointer here
|
|
453
|
-
retrievalURI = this.toBaseURI($refBaseURI);
|
|
502
|
+
retrievalURI = this.toBaseURI((0, _apidomCore.toValue)($refBaseURI));
|
|
454
503
|
isInternalReference = _empty.url.stripHash(this.reference.uri) === retrievalURI;
|
|
455
504
|
isExternalReference = !isInternalReference;
|
|
456
505
|
|
|
@@ -471,232 +520,183 @@ const OpenApi3_1SwaggerClientDereferenceVisitor = _openapi.OpenApi3_1Dereference
|
|
|
471
520
|
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
472
521
|
referencedElement.id = identityManager.identify(referencedElement);
|
|
473
522
|
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
* No SchemaElement($id=URL) was not found, so we're going to try to resolve
|
|
477
|
-
* the URL and assume the returned response is a JSON Schema.
|
|
478
|
-
*/
|
|
479
|
-
if (isURL && error instanceof _uri.EvaluationJsonSchemaUriError) {
|
|
480
|
-
if ((0, _$anchor.isAnchor)((0, _$anchor.uriToAnchor)($refBaseURI))) {
|
|
481
|
-
// we're dealing with JSON Schema $anchor here
|
|
482
|
-
isInternalReference = _empty.url.stripHash(this.reference.uri) === retrievalURI;
|
|
483
|
-
isExternalReference = !isInternalReference;
|
|
484
|
-
|
|
485
|
-
// ignore resolving internal Schema Objects
|
|
486
|
-
if (!this.options.resolve.internal && isInternalReference) {
|
|
487
|
-
// skip traversing this schema element but traverse all it's child elements
|
|
488
|
-
return undefined;
|
|
489
|
-
}
|
|
490
|
-
// ignore resolving external Schema Objects
|
|
491
|
-
if (!this.options.resolve.external && isExternalReference) {
|
|
492
|
-
// skip traversing this schema element but traverse all it's child elements
|
|
493
|
-
return undefined;
|
|
494
|
-
}
|
|
495
|
-
reference = await this.toReference(_empty.url.unsanitize($refBaseURI));
|
|
496
|
-
const selector = (0, _$anchor.uriToAnchor)($refBaseURI);
|
|
497
|
-
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
498
|
-
referencedElement = (0, _$anchor.evaluate)(selector, referenceAsSchema);
|
|
499
|
-
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
500
|
-
referencedElement.id = identityManager.identify(referencedElement);
|
|
501
|
-
} else {
|
|
502
|
-
// we're assuming here that we're dealing with JSON Pointer here
|
|
503
|
-
retrievalURI = this.toBaseURI((0, _apidomCore.toValue)($refBaseURI));
|
|
504
|
-
isInternalReference = _empty.url.stripHash(this.reference.uri) === retrievalURI;
|
|
505
|
-
isExternalReference = !isInternalReference;
|
|
506
|
-
|
|
507
|
-
// ignore resolving internal Schema Objects
|
|
508
|
-
if (!this.options.resolve.internal && isInternalReference) {
|
|
509
|
-
// skip traversing this schema element but traverse all it's child elements
|
|
510
|
-
return undefined;
|
|
511
|
-
}
|
|
512
|
-
// ignore resolving external Schema Objects
|
|
513
|
-
if (!this.options.resolve.external && isExternalReference) {
|
|
514
|
-
// skip traversing this schema element but traverse all it's child elements
|
|
515
|
-
return undefined;
|
|
516
|
-
}
|
|
517
|
-
reference = await this.toReference(_empty.url.unsanitize($refBaseURI));
|
|
518
|
-
const selector = (0, _apidomJsonPointer.uriToPointer)($refBaseURI);
|
|
519
|
-
const referenceAsSchema = (0, _openapi.maybeRefractToSchemaElement)(reference.value.result);
|
|
520
|
-
referencedElement = (0, _apidomJsonPointer.evaluate)(selector, referenceAsSchema);
|
|
521
|
-
referencedElement = (0, _openapi.maybeRefractToSchemaElement)(referencedElement);
|
|
522
|
-
referencedElement.id = identityManager.identify(referencedElement);
|
|
523
|
-
}
|
|
524
|
-
} else {
|
|
525
|
-
throw error;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// detect direct or indirect reference
|
|
530
|
-
if (referencingElement === referencedElement) {
|
|
531
|
-
throw new _apidomError.ApiDOMError('Recursive Schema Object reference detected');
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
// detect maximum depth of dereferencing
|
|
535
|
-
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
536
|
-
throw new _empty.MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
523
|
+
} else {
|
|
524
|
+
throw error;
|
|
537
525
|
}
|
|
526
|
+
}
|
|
538
527
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
throw new _apidomError.ApiDOMError('Circular reference detected');
|
|
544
|
-
} else if (this.options.dereference.circular === 'replace') {
|
|
545
|
-
var _this$options$derefer7, _this$options$derefer8;
|
|
546
|
-
const refElement = new _apidomCore.RefElement(referencedElement.id, {
|
|
547
|
-
type: 'json-schema',
|
|
548
|
-
uri: reference.uri,
|
|
549
|
-
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
550
|
-
baseURI: _empty.url.resolve(retrievalURI, $refBaseURI),
|
|
551
|
-
referencingElement
|
|
552
|
-
});
|
|
553
|
-
const replacer = (_this$options$derefer7 = (_this$options$derefer8 = this.options.dereference.strategyOpts['openapi-3-1']) == null ? void 0 : _this$options$derefer8.circularReplacer) != null ? _this$options$derefer7 : this.options.dereference.circularReplacer;
|
|
554
|
-
const replacement = replacer(refElement);
|
|
555
|
-
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
556
|
-
parent.value = replacement; // eslint-disable-line no-param-reassign
|
|
557
|
-
} else if (Array.isArray(parent)) {
|
|
558
|
-
parent[key] = replacement; // eslint-disable-line no-param-reassign
|
|
559
|
-
}
|
|
560
|
-
return !parent ? replacement : false;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
528
|
+
// detect direct or indirect reference
|
|
529
|
+
if (referencingElement === referencedElement) {
|
|
530
|
+
throw new _apidomError.ApiDOMError('Recursive Schema Object reference detected');
|
|
531
|
+
}
|
|
563
532
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
* 1. We're crossing document boundary
|
|
569
|
-
* 2. Fragment is from non-root document
|
|
570
|
-
* 3. Fragment is a Schema Object with $ref field. We need to follow it to get the eventual value
|
|
571
|
-
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
572
|
-
*/
|
|
573
|
-
const isNonRootDocument = _empty.url.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
574
|
-
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
575
|
-
if ((isExternalReference || isNonRootDocument || (0, _apidomNsOpenapi.isSchemaElement)(referencedElement) && (0, _apidomCore.isStringElement)(referencedElement.$ref) || shouldDetectCircular) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
576
|
-
var _this$basePath5;
|
|
577
|
-
// append referencing schema to ancestors lineage
|
|
578
|
-
directAncestors.add(referencingElement);
|
|
579
|
-
|
|
580
|
-
// dive deep into the fragment
|
|
581
|
-
const mergeVisitor = OpenApi3_1SwaggerClientDereferenceVisitor({
|
|
582
|
-
reference,
|
|
583
|
-
namespace: this.namespace,
|
|
584
|
-
indirections: [...this.indirections],
|
|
585
|
-
options: this.options,
|
|
586
|
-
useCircularStructures: this.useCircularStructures,
|
|
587
|
-
allowMetaPatches: this.allowMetaPatches,
|
|
588
|
-
ancestors: ancestorsLineage,
|
|
589
|
-
basePath: (_this$basePath5 = this.basePath) != null ? _this$basePath5 : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref']
|
|
590
|
-
});
|
|
591
|
-
referencedElement = await visitAsync(referencedElement, mergeVisitor, {
|
|
592
|
-
keyMap: _apidomNsOpenapi.keyMap,
|
|
593
|
-
nodeTypeGetter: _apidomNsOpenapi.getNodeType
|
|
594
|
-
});
|
|
533
|
+
// detect maximum depth of dereferencing
|
|
534
|
+
if (this.indirections.length > this.options.dereference.maxDepth) {
|
|
535
|
+
throw new _empty.MaximumDereferenceDepthError(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);
|
|
536
|
+
}
|
|
595
537
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
this.
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
538
|
+
// detect second deep dive into the same fragment and avoid it
|
|
539
|
+
if (ancestorsLineage.includes(referencedElement)) {
|
|
540
|
+
reference.refSet.circular = true;
|
|
541
|
+
if (this.options.dereference.circular === 'error') {
|
|
542
|
+
throw new _apidomError.ApiDOMError('Circular reference detected');
|
|
543
|
+
} else if (this.options.dereference.circular === 'replace') {
|
|
544
|
+
var _this$options$derefer7, _this$options$derefer8;
|
|
545
|
+
const refElement = new _apidomCore.RefElement(referencedElement.id, {
|
|
546
|
+
type: 'json-schema',
|
|
547
|
+
uri: reference.uri,
|
|
548
|
+
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
549
|
+
baseURI: _empty.url.resolve(retrievalURI, $refBaseURI),
|
|
550
|
+
referencingElement
|
|
605
551
|
});
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
// annotate fragment with info about referencing element
|
|
609
|
-
booleanJsonSchemaElement.setMetaProperty('ref-referencing-element-id', (0, _apidomCore.cloneDeep)(identityManager.identify(referencingElement)));
|
|
552
|
+
const replacer = (_this$options$derefer7 = (_this$options$derefer8 = this.options.dereference.strategyOpts['openapi-3-1']) == null ? void 0 : _this$options$derefer8.circularReplacer) != null ? _this$options$derefer7 : this.options.dereference.circularReplacer;
|
|
553
|
+
const replacement = replacer(refElement);
|
|
610
554
|
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
611
|
-
parent.value =
|
|
555
|
+
parent.value = replacement; // eslint-disable-line no-param-reassign
|
|
612
556
|
} else if (Array.isArray(parent)) {
|
|
613
|
-
parent[key] =
|
|
557
|
+
parent[key] = replacement; // eslint-disable-line no-param-reassign
|
|
614
558
|
}
|
|
615
|
-
return !parent ?
|
|
559
|
+
return !parent ? replacement : false;
|
|
616
560
|
}
|
|
561
|
+
}
|
|
617
562
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
563
|
+
/**
|
|
564
|
+
* Dive deep into the fragment.
|
|
565
|
+
*
|
|
566
|
+
* Cases to consider:
|
|
567
|
+
* 1. We're crossing document boundary
|
|
568
|
+
* 2. Fragment is from non-root document
|
|
569
|
+
* 3. Fragment is a Schema Object with $ref field. We need to follow it to get the eventual value
|
|
570
|
+
* 4. We are dereferencing the fragment lazily/eagerly depending on circular mode
|
|
571
|
+
*/
|
|
572
|
+
const isNonRootDocument = _empty.url.stripHash(reference.refSet.rootRef.uri) !== reference.uri;
|
|
573
|
+
const shouldDetectCircular = ['error', 'replace'].includes(this.options.dereference.circular);
|
|
574
|
+
if ((isExternalReference || isNonRootDocument || (0, _apidomNsOpenapi.isSchemaElement)(referencedElement) && (0, _apidomCore.isStringElement)(referencedElement.$ref) || shouldDetectCircular) && !ancestorsLineage.includesCycle(referencedElement)) {
|
|
575
|
+
var _this$basePath5;
|
|
576
|
+
// append referencing schema to ancestors lineage
|
|
577
|
+
directAncestors.add(referencingElement);
|
|
578
|
+
|
|
579
|
+
// dive deep into the fragment
|
|
580
|
+
const mergeVisitor = new OpenAPI3_1SwaggerClientDereferenceVisitor({
|
|
581
|
+
reference,
|
|
582
|
+
namespace: this.namespace,
|
|
583
|
+
indirections: [...this.indirections],
|
|
584
|
+
options: this.options,
|
|
585
|
+
useCircularStructures: this.useCircularStructures,
|
|
586
|
+
allowMetaPatches: this.allowMetaPatches,
|
|
587
|
+
ancestors: ancestorsLineage,
|
|
588
|
+
basePath: (_this$basePath5 = this.basePath) != null ? _this$basePath5 : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref']
|
|
589
|
+
});
|
|
590
|
+
referencedElement = await visitAsync(referencedElement, mergeVisitor, {
|
|
591
|
+
keyMap: _apidomNsOpenapi.keyMap,
|
|
592
|
+
nodeTypeGetter: _apidomNsOpenapi.getNodeType
|
|
593
|
+
});
|
|
649
594
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
595
|
+
// remove referencing schema from ancestors lineage
|
|
596
|
+
directAncestors.delete(referencingElement);
|
|
597
|
+
}
|
|
598
|
+
this.indirections.pop();
|
|
599
|
+
if ((0, _apidomNsOpenapi.isBooleanJsonSchemaElement)(referencedElement)) {
|
|
600
|
+
const booleanJsonSchemaElement = (0, _apidomCore.cloneDeep)(referencedElement);
|
|
601
|
+
// annotate referenced element with info about original referencing element
|
|
602
|
+
booleanJsonSchemaElement.setMetaProperty('ref-fields', {
|
|
603
|
+
$ref: (0, _apidomCore.toValue)(referencingElement.$ref)
|
|
604
|
+
});
|
|
605
|
+
// annotate referenced element with info about origin
|
|
606
|
+
booleanJsonSchemaElement.setMetaProperty('ref-origin', reference.uri);
|
|
607
|
+
// annotate fragment with info about referencing element
|
|
608
|
+
booleanJsonSchemaElement.setMetaProperty('ref-referencing-element-id', (0, _apidomCore.cloneDeep)(identityManager.identify(referencingElement)));
|
|
653
609
|
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
654
|
-
parent.value =
|
|
610
|
+
parent.value = booleanJsonSchemaElement; // eslint-disable-line no-param-reassign
|
|
655
611
|
} else if (Array.isArray(parent)) {
|
|
656
|
-
parent[key] =
|
|
612
|
+
parent[key] = booleanJsonSchemaElement; // eslint-disable-line no-param-reassign
|
|
657
613
|
}
|
|
614
|
+
return !parent ? booleanJsonSchemaElement : false;
|
|
615
|
+
}
|
|
658
616
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
fullPath: (_this$basePath6 = this.basePath) != null ? _this$basePath6 : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref'],
|
|
670
|
-
cause: rootCause
|
|
617
|
+
/**
|
|
618
|
+
* Creating a new version of Schema Object by merging fields from referenced Schema Object with referencing one.
|
|
619
|
+
*/
|
|
620
|
+
if ((0, _apidomNsOpenapi.isSchemaElement)(referencedElement)) {
|
|
621
|
+
// Schema Object - merge keywords from referenced schema with referencing schema
|
|
622
|
+
const mergedElement = new _apidomNsOpenapi.SchemaElement([...referencedElement.content], (0, _apidomCore.cloneDeep)(referencedElement.meta), (0, _apidomCore.cloneDeep)(referencedElement.attributes));
|
|
623
|
+
// existing keywords from referencing schema overrides ones from referenced schema
|
|
624
|
+
referencingElement.forEach((value, keyElement, item) => {
|
|
625
|
+
mergedElement.remove((0, _apidomCore.toValue)(keyElement));
|
|
626
|
+
mergedElement.content.push(item);
|
|
671
627
|
});
|
|
672
|
-
|
|
673
|
-
|
|
628
|
+
mergedElement.remove('$ref');
|
|
629
|
+
// annotate referenced element with info about original referencing element
|
|
630
|
+
mergedElement.setMetaProperty('ref-fields', {
|
|
631
|
+
$ref: (0, _apidomCore.toValue)(referencingElement.$ref)
|
|
632
|
+
});
|
|
633
|
+
// annotate fragment with info about origin
|
|
634
|
+
mergedElement.setMetaProperty('ref-origin', reference.uri);
|
|
635
|
+
// annotate fragment with info about referencing element
|
|
636
|
+
mergedElement.setMetaProperty('ref-referencing-element-id', (0, _apidomCore.cloneDeep)(identityManager.identify(referencingElement)));
|
|
637
|
+
|
|
638
|
+
// allowMetaPatches option processing
|
|
639
|
+
if (this.allowMetaPatches) {
|
|
640
|
+
// apply meta patch only when not already applied
|
|
641
|
+
if (typeof mergedElement.get('$$ref') === 'undefined') {
|
|
642
|
+
const baseURI = _empty.url.resolve(retrievalURI, $refBaseURI);
|
|
643
|
+
mergedElement.set('$$ref', baseURI);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
referencedElement = mergedElement;
|
|
674
647
|
}
|
|
675
|
-
|
|
676
|
-
async LinkElement() {
|
|
648
|
+
|
|
677
649
|
/**
|
|
678
|
-
*
|
|
679
|
-
* and assigns them to Link Object metadata. This is not needed in
|
|
680
|
-
* swagger-client context, so we're disabling it here.
|
|
650
|
+
* Transclude referencing element with merged referenced element.
|
|
681
651
|
*/
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
return await _openapi.OpenApi3_1DereferenceVisitor.compose.methods.ExampleElement.call(this, exampleElement, key, parent, path, ancestors);
|
|
687
|
-
} catch (error) {
|
|
688
|
-
var _this$basePath7, _this$options$derefer10;
|
|
689
|
-
const rootCause = (0, _getRootCause.default)(error);
|
|
690
|
-
const wrappedError = wrapError(rootCause, {
|
|
691
|
-
baseDoc: this.reference.uri,
|
|
692
|
-
externalValue: (0, _apidomCore.toValue)(exampleElement.externalValue),
|
|
693
|
-
fullPath: (_this$basePath7 = this.basePath) != null ? _this$basePath7 : [...(0, _toPath.default)([...ancestors, parent, exampleElement]), 'externalValue']
|
|
694
|
-
});
|
|
695
|
-
(_this$options$derefer10 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer10 = _this$options$derefer10.errors) == null || _this$options$derefer10.push == null || _this$options$derefer10.push(wrappedError);
|
|
696
|
-
return undefined;
|
|
652
|
+
if ((0, _apidomCore.isMemberElement)(parent)) {
|
|
653
|
+
parent.value = referencedElement; // eslint-disable-line no-param-reassign
|
|
654
|
+
} else if (Array.isArray(parent)) {
|
|
655
|
+
parent[key] = referencedElement; // eslint-disable-line no-param-reassign
|
|
697
656
|
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* We're at the root of the tree, so we're just replacing the entire tree.
|
|
660
|
+
*/
|
|
661
|
+
return !parent ? referencedElement : undefined;
|
|
662
|
+
} catch (error) {
|
|
663
|
+
var _this$basePath6, _this$options$derefer9;
|
|
664
|
+
const rootCause = (0, _getRootCause.default)(error);
|
|
665
|
+
const wrappedError = new _SchemaRefError.default(`Could not resolve reference: ${rootCause.message}`, {
|
|
666
|
+
baseDoc: this.reference.uri,
|
|
667
|
+
$ref: (0, _apidomCore.toValue)(referencingElement.$ref),
|
|
668
|
+
fullPath: (_this$basePath6 = this.basePath) != null ? _this$basePath6 : [...(0, _toPath.default)([...ancestors, parent, referencingElement]), '$ref'],
|
|
669
|
+
cause: rootCause
|
|
670
|
+
});
|
|
671
|
+
(_this$options$derefer9 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer9 = _this$options$derefer9.errors) == null || _this$options$derefer9.push == null || _this$options$derefer9.push(wrappedError);
|
|
672
|
+
return undefined;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// eslint-disable-next-line class-methods-use-this
|
|
677
|
+
async LinkElement() {
|
|
678
|
+
/**
|
|
679
|
+
* OpenApi3_1DereferenceVisitor is doing lookup of Operation Objects
|
|
680
|
+
* and assigns them to Link Object metadata. This is not needed in
|
|
681
|
+
* swagger-client context, so we're disabling it here.
|
|
682
|
+
*/
|
|
683
|
+
return undefined;
|
|
684
|
+
}
|
|
685
|
+
async ExampleElement(exampleElement, key, parent, path, ancestors) {
|
|
686
|
+
try {
|
|
687
|
+
return await super.ExampleElement(exampleElement, key, parent, path, ancestors);
|
|
688
|
+
} catch (error) {
|
|
689
|
+
var _this$basePath7, _this$options$derefer10;
|
|
690
|
+
const rootCause = (0, _getRootCause.default)(error);
|
|
691
|
+
const wrappedError = wrapError(rootCause, {
|
|
692
|
+
baseDoc: this.reference.uri,
|
|
693
|
+
externalValue: (0, _apidomCore.toValue)(exampleElement.externalValue),
|
|
694
|
+
fullPath: (_this$basePath7 = this.basePath) != null ? _this$basePath7 : [...(0, _toPath.default)([...ancestors, parent, exampleElement]), 'externalValue']
|
|
695
|
+
});
|
|
696
|
+
(_this$options$derefer10 = this.options.dereference.dereferenceOpts) == null || (_this$options$derefer10 = _this$options$derefer10.errors) == null || _this$options$derefer10.push == null || _this$options$derefer10.push(wrappedError);
|
|
697
|
+
return undefined;
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
}
|
|
701
|
-
var _default = exports.default =
|
|
700
|
+
}
|
|
701
|
+
var _default = exports.default = OpenAPI3_1SwaggerClientDereferenceVisitor;
|
|
702
702
|
/* eslint-enable camelcase */
|