@speclynx/apidom-reference 2.13.1 → 3.0.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 +10 -0
- package/README.md +5 -5
- package/dist/apidom-reference.browser.js +577 -334
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +25 -25
- package/src/dereference/strategies/apidom/selectors/element-id.cjs +11 -2
- package/src/dereference/strategies/apidom/selectors/element-id.mjs +12 -3
- package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +2 -2
- package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +3 -3
- package/src/dereference/strategies/arazzo-1/visitor.cjs +2 -2
- package/src/dereference/strategies/arazzo-1/visitor.mjs +2 -2
- package/src/dereference/strategies/asyncapi-2/visitor.cjs +6 -6
- package/src/dereference/strategies/asyncapi-2/visitor.mjs +6 -6
- package/src/dereference/strategies/openapi-2/visitor.cjs +8 -8
- package/src/dereference/strategies/openapi-2/visitor.mjs +8 -8
- package/src/dereference/strategies/openapi-3-0/visitor.cjs +6 -6
- package/src/dereference/strategies/openapi-3-0/visitor.mjs +6 -6
- package/src/dereference/strategies/openapi-3-1/util.cjs +2 -2
- package/src/dereference/strategies/openapi-3-1/util.mjs +2 -2
- package/src/dereference/strategies/openapi-3-1/visitor.cjs +8 -8
- package/src/dereference/strategies/openapi-3-1/visitor.mjs +8 -8
- package/src/parse/parsers/arazzo-json-1/source-descriptions.cjs +2 -2
- package/src/parse/parsers/arazzo-json-1/source-descriptions.mjs +3 -3
|
@@ -138,8 +138,8 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
138
138
|
|
|
139
139
|
// applying semantics to a fragment
|
|
140
140
|
if (isPrimitiveElement(referencedElement)) {
|
|
141
|
-
const referencedElementType =
|
|
142
|
-
const cacheKey = `${referencedElementType}-${
|
|
141
|
+
const referencedElementType = referencingElement.meta.get('referenced-element');
|
|
142
|
+
const cacheKey = `${referencedElementType}-${identityManager.identify(referencedElement)}`;
|
|
143
143
|
if (this.refractCache.has(cacheKey)) {
|
|
144
144
|
referencedElement = this.refractCache.get(cacheKey);
|
|
145
145
|
} else if (isReferenceLikeElement(referencedElement)) {
|
|
@@ -233,7 +233,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
233
233
|
// annotate fragment with info about origin
|
|
234
234
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
235
235
|
// annotate fragment with info about referencing element
|
|
236
|
-
mergedElement.meta.set('ref-referencing-element-id',
|
|
236
|
+
mergedElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
|
|
237
237
|
|
|
238
238
|
// override description and summary (outer has higher priority then inner)
|
|
239
239
|
if (isObjectElement(referencedElement) && isObjectElement(mergedElement)) {
|
|
@@ -296,7 +296,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
296
296
|
* Applying semantics to a referenced element if semantics are missing.
|
|
297
297
|
*/
|
|
298
298
|
if (isPrimitiveElement(referencedElement)) {
|
|
299
|
-
const cacheKey = `path-item-${
|
|
299
|
+
const cacheKey = `path-item-${identityManager.identify(referencedElement)}`;
|
|
300
300
|
if (this.refractCache.has(cacheKey)) {
|
|
301
301
|
referencedElement = this.refractCache.get(cacheKey);
|
|
302
302
|
} else {
|
|
@@ -386,7 +386,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
386
386
|
// annotate referenced element with info about origin
|
|
387
387
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
388
388
|
// annotate fragment with info about referencing element
|
|
389
|
-
mergedElement.meta.set('ref-referencing-element-id',
|
|
389
|
+
mergedElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
|
|
390
390
|
referencedElement = mergedElement;
|
|
391
391
|
}
|
|
392
392
|
|
|
@@ -429,7 +429,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
429
429
|
operationElement = jsonPointerEvaluate(reference.value.result, jsonPointer);
|
|
430
430
|
// applying semantics to a referenced element
|
|
431
431
|
if (isPrimitiveElement(operationElement)) {
|
|
432
|
-
const cacheKey = `operation-${
|
|
432
|
+
const cacheKey = `operation-${identityManager.identify(operationElement)}`;
|
|
433
433
|
if (this.refractCache.has(cacheKey)) {
|
|
434
434
|
operationElement = this.refractCache.get(cacheKey);
|
|
435
435
|
} else {
|
|
@@ -710,7 +710,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
710
710
|
// annotate referenced element with info about origin
|
|
711
711
|
booleanJsonSchemaElement.meta.set('ref-origin', reference.uri);
|
|
712
712
|
// annotate fragment with info about referencing element
|
|
713
|
-
booleanJsonSchemaElement.meta.set('ref-referencing-element-id',
|
|
713
|
+
booleanJsonSchemaElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
|
|
714
714
|
path.replaceWith(booleanJsonSchemaElement);
|
|
715
715
|
return;
|
|
716
716
|
}
|
|
@@ -735,7 +735,7 @@ class OpenAPI3_1DereferenceVisitor {
|
|
|
735
735
|
// annotate fragment with info about origin
|
|
736
736
|
mergedElement.meta.set('ref-origin', reference.uri);
|
|
737
737
|
// annotate fragment with info about referencing element
|
|
738
|
-
mergedElement.meta.set('ref-referencing-element-id',
|
|
738
|
+
mergedElement.meta.set('ref-referencing-element-id', identityManager.identify(referencingElement));
|
|
739
739
|
referencedElement = mergedElement;
|
|
740
740
|
}
|
|
741
741
|
/**
|
|
@@ -31,8 +31,8 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
31
31
|
|
|
32
32
|
// set class and metadata from source description element
|
|
33
33
|
parseResult.classes.push('source-description');
|
|
34
|
-
if ((0, _apidomDatamodel.isStringElement)(sourceDescription.name)) parseResult.setMetaProperty('name', (0,
|
|
35
|
-
if ((0, _apidomDatamodel.isStringElement)(sourceDescription.type)) parseResult.setMetaProperty('type', (0,
|
|
34
|
+
if ((0, _apidomDatamodel.isStringElement)(sourceDescription.name)) parseResult.setMetaProperty('name', (0, _apidomCore.toValue)(sourceDescription.name));
|
|
35
|
+
if ((0, _apidomDatamodel.isStringElement)(sourceDescription.type)) parseResult.setMetaProperty('type', (0, _apidomCore.toValue)(sourceDescription.type));
|
|
36
36
|
const sourceDescriptionURI = (0, _apidomCore.toValue)(sourceDescription.url);
|
|
37
37
|
if (typeof sourceDescriptionURI !== 'string') {
|
|
38
38
|
const annotation = new _apidomDatamodel.AnnotationElement('Source description URL is missing or not a string. Skipping');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement, AnnotationElement, isArrayElement, isStringElement
|
|
1
|
+
import { ParseResultElement, AnnotationElement, isArrayElement, isStringElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import { isArazzoSpecification1Element, isSourceDescriptionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
3
3
|
import { isSwaggerElement } from '@speclynx/apidom-ns-openapi-2';
|
|
4
4
|
import { isOpenApi3_0Element } from '@speclynx/apidom-ns-openapi-3-0';
|
|
@@ -24,8 +24,8 @@ async function parseSourceDescription(sourceDescription, ctx) {
|
|
|
24
24
|
|
|
25
25
|
// set class and metadata from source description element
|
|
26
26
|
parseResult.classes.push('source-description');
|
|
27
|
-
if (isStringElement(sourceDescription.name)) parseResult.setMetaProperty('name',
|
|
28
|
-
if (isStringElement(sourceDescription.type)) parseResult.setMetaProperty('type',
|
|
27
|
+
if (isStringElement(sourceDescription.name)) parseResult.setMetaProperty('name', toValue(sourceDescription.name));
|
|
28
|
+
if (isStringElement(sourceDescription.type)) parseResult.setMetaProperty('type', toValue(sourceDescription.type));
|
|
29
29
|
const sourceDescriptionURI = toValue(sourceDescription.url);
|
|
30
30
|
if (typeof sourceDescriptionURI !== 'string') {
|
|
31
31
|
const annotation = new AnnotationElement('Source description URL is missing or not a string. Skipping');
|