From e28eb2f3f1a761d51c580e09053dae43570b7461 Mon Sep 17 00:00:00 2001 From: frantuma Date: Fri, 30 Jul 2021 08:28:05 +0200 Subject: [PATCH 1/3] feat: add reference related metadata to namespaces --- .../async-api-2-0/channel-item/$RefVisitor.ts | 14 +- .../async-api-2-0/reference/$RefVisitor.ts | 14 +- .../visitors/async-api-2-0/servers/index.ts | 1 + .../refractor/__snapshots__/index.ts.snap | 242 ++++++++++++++++ .../src/refractor/specification.ts | 2 +- .../example/ExaternalValueVisitor.ts | 5 - .../example/ExternalValueVisitor.ts | 17 ++ .../open-api-3-1/link/OperationRefVisitor.ts | 14 +- .../open-api-3-1/path-item/$RefVisitor.ts | 14 +- .../open-api-3-1/reference/$RefVisitor.ts | 14 +- .../open-api-3-1/schema/$refVisitor.ts | 14 +- .../visitors/open-api-3-1/schema/index.ts | 9 + .../refractor/__snapshots__/index.ts.snap | 273 ++++++++++++++++++ 13 files changed, 621 insertions(+), 12 deletions(-) delete mode 100644 apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExaternalValueVisitor.ts create mode 100644 apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExternalValueVisitor.ts diff --git a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/$RefVisitor.ts b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/$RefVisitor.ts index 89bcfcfd81..7d0e7425c2 100644 --- a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/$RefVisitor.ts +++ b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/$RefVisitor.ts @@ -1,5 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + import FallbackVisitor from '../../FallbackVisitor'; -const $RefVisitor = FallbackVisitor; +const $RefVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); export default $RefVisitor; diff --git a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/$RefVisitor.ts b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/$RefVisitor.ts index 89bcfcfd81..7d0e7425c2 100644 --- a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/$RefVisitor.ts +++ b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/$RefVisitor.ts @@ -1,5 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + import FallbackVisitor from '../../FallbackVisitor'; -const $RefVisitor = FallbackVisitor; +const $RefVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); export default $RefVisitor; diff --git a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/servers/index.ts b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/servers/index.ts index 84d4b82c89..0bab3d6279 100644 --- a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/servers/index.ts +++ b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/servers/index.ts @@ -13,6 +13,7 @@ const ServersVisitor = stampit(PatternedFieldsVisitor, FallbackVisitor, { }, init() { this.element = new ServersElement(); + this.element.classes.push('servers'); }, }); diff --git a/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap b/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap index 5f3eb3e87d..30f1eaecf4 100644 --- a/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap +++ b/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap @@ -396,6 +396,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "servers", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "servers" + } + ] + } + }, "content": [ { "element": "member", @@ -974,6 +985,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/serverBindings/ServerBinding1" } } @@ -2127,6 +2149,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/schemas/user" } } @@ -2195,6 +2228,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/schemas/signup" } } @@ -3912,6 +3956,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/parameters/userId" } } @@ -4017,6 +4072,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "https://outside.com/#/path/to/channelItem" } } @@ -4459,6 +4525,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/operationTraits/OperationTrait1" } } @@ -4543,6 +4620,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/messages/Message1" } } @@ -4613,6 +4701,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/operationBindings/OperationBinding1" } } @@ -4828,6 +4927,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/parameters/userId" } } @@ -4900,6 +5010,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/channelBindings/ChannelBinding1" } } @@ -5078,6 +5199,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/schemas/Schema1" } } @@ -5205,6 +5337,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/messages/Message1" } } @@ -5332,6 +5475,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/securitySchemes/SecurityScheme1" } } @@ -5558,6 +5712,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/parameters/Parameter1" } } @@ -5685,6 +5850,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/correlationIds/CorrelationID1" } } @@ -5812,6 +5988,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/operationTraits/OperationTrait1" } } @@ -5939,6 +6126,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/messageTraits/MessageTrait1" } } @@ -6091,6 +6289,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/serverBindings/ServerBinding1" } } @@ -6243,6 +6452,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/channelBindings/ChannelBinding1" } } @@ -6395,6 +6615,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/operationBindings/OperationBinding1" } } @@ -6547,6 +6778,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/messageBindings/MessageBinding1" } } diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/specification.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/specification.ts index 2a90119793..989ed044aa 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/specification.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/specification.ts @@ -136,7 +136,7 @@ import ExampleVisitor from './visitors/open-api-3-1/example'; import ExampleSummaryVisitor from './visitors/open-api-3-1/example/SummaryVisitor'; import ExampleDescriptionVisitor from './visitors/open-api-3-1/example/DescriptionVisitor'; import ExampleValueVisitor from './visitors/open-api-3-1/example/ValueVisitor'; -import ExampleExternalValueVisitor from './visitors/open-api-3-1/example/ExaternalValueVisitor'; +import ExampleExternalValueVisitor from './visitors/open-api-3-1/example/ExternalValueVisitor'; import ExternalDocumentationVisitor from './visitors/open-api-3-1/external-documentation'; import ExternalDocumentationDescriptionVisitor from './visitors/open-api-3-1/external-documentation/DescriptionVisitor'; import ExternalDocumentationUrlVisitor from './visitors/open-api-3-1/external-documentation/UrlVisitor'; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExaternalValueVisitor.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExaternalValueVisitor.ts deleted file mode 100644 index 7ab03dfcf7..0000000000 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExaternalValueVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import FallbackVisitor from '../../FallbackVisitor'; - -const ExternalValueVisitor = FallbackVisitor; - -export default ExternalValueVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExternalValueVisitor.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExternalValueVisitor.ts new file mode 100644 index 0000000000..ca3f2b2972 --- /dev/null +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/ExternalValueVisitor.ts @@ -0,0 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + +import FallbackVisitor from '../../FallbackVisitor'; + +const ExternalValueVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); + +export default ExternalValueVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationRefVisitor.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationRefVisitor.ts index f0da3483e4..f1aae5f439 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationRefVisitor.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationRefVisitor.ts @@ -1,5 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + import FallbackVisitor from '../../FallbackVisitor'; -const OperationRefVisitor = FallbackVisitor; +const OperationRefVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); export default OperationRefVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/$RefVisitor.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/$RefVisitor.ts index 89bcfcfd81..7d0e7425c2 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/$RefVisitor.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/$RefVisitor.ts @@ -1,5 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + import FallbackVisitor from '../../FallbackVisitor'; -const $RefVisitor = FallbackVisitor; +const $RefVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); export default $RefVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/$RefVisitor.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/$RefVisitor.ts index 89bcfcfd81..7d0e7425c2 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/$RefVisitor.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/$RefVisitor.ts @@ -1,5 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + import FallbackVisitor from '../../FallbackVisitor'; -const $RefVisitor = FallbackVisitor; +const $RefVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); export default $RefVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/$refVisitor.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/$refVisitor.ts index 851788ae2d..4ccafd6642 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/$refVisitor.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/$refVisitor.ts @@ -1,5 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + import FallbackVisitor from '../../FallbackVisitor'; -const $refVisitor = FallbackVisitor; +const $refVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); export default $refVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts index a4817798ed..6c01b01769 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts @@ -79,6 +79,14 @@ const SchemaVisitor = stampit(FixedFieldsVisitor, ParentSchemaAwareVisitor, Fall this.element.setMetaProperty('inherited$id', inherited$id); }; + const appendReferenceMetadata = (objectElement: ObjectElement) => { + const $ref = objectElement.get('$ref')?.toValue(); + + if (isNonEmptyString($ref)) { + this.element.classes.push('reference-element'); + } + }; + /** * Public Api. */ @@ -86,6 +94,7 @@ const SchemaVisitor = stampit(FixedFieldsVisitor, ParentSchemaAwareVisitor, Fall this.element = new SchemaElement(); handle$schema(objectElement); handle$id(objectElement); + appendReferenceMetadata(objectElement); // for further processing consider this Schema Element as parent for all embedded Schema Elements this.parent = this.element; diff --git a/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap b/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap index 4ccf9e3fba..abc2ce0c41 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap +++ b/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap @@ -1230,6 +1230,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/parameters/parameter2" } } @@ -1585,6 +1596,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "https://example1.com/" } } @@ -1649,6 +1671,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/examples/example3" } } @@ -1943,6 +1976,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/headers/Content-Type" } } @@ -2281,6 +2325,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "https://example.com/external-link" } } @@ -2500,6 +2555,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/links/link3" } } @@ -2572,6 +2638,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/responses/201" } } @@ -3013,6 +3090,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/callbacks/callback1" } } @@ -3456,6 +3544,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/requestBodies/requestBody1" } } @@ -3541,6 +3640,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/responses/201" } } @@ -4167,6 +4277,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/parameters/parameter2" } } @@ -4276,6 +4397,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/pathItems/path2" } } @@ -4530,6 +4662,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/pathItems/path2" } } @@ -4680,6 +4823,15 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "inherited$id": { "element": "array" + }, + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-element" + } + ] } }, "content": [ @@ -4703,6 +4855,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/schemas/schema1" } } @@ -5011,6 +5174,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/responses/201" } } @@ -5345,6 +5519,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/parameters/parameter2" } } @@ -5502,6 +5687,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "https://example3.com/" } } @@ -5566,6 +5762,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/examples/example3" } } @@ -5739,6 +5946,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/requestBodies/requestBody1" } } @@ -5952,6 +6170,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/headers/Content-Type" } } @@ -6271,6 +6500,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/securitySchemes/securityScheme1" } } @@ -6420,6 +6660,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/links/link4" } } @@ -6861,6 +7112,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/callbacks/callback1" } } @@ -7109,6 +7371,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "#/components/pathItems/path2" } } From 2c73fd4c19c1b4ec761d4e93afb9bc0c6b00332d Mon Sep 17 00:00:00 2001 From: Vladimir Gorej Date: Mon, 2 Aug 2021 15:51:05 +0200 Subject: [PATCH 2/3] feat(ns-openapi-3-1): add reference metadata Refs https://github.com/swagger-api/oss-planning/issues/265 --- .../visitors/open-api-3-1/example/index.ts | 14 ++ .../open-api-3-1/link/OperationIdVisitor.ts | 14 +- .../visitors/open-api-3-1/link/index.ts | 14 ++ .../visitors/open-api-3-1/path-item/index.ts | 7 +- .../visitors/open-api-3-1/reference/index.ts | 14 ++ .../visitors/open-api-3-1/schema/index.ts | 18 ++- .../refractor/__snapshots__/index.ts.snap | 129 ++++++++++++++++++ 7 files changed, 198 insertions(+), 12 deletions(-) diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/index.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/index.ts index 4977f960f8..b923fa55b6 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/index.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/example/index.ts @@ -1,5 +1,6 @@ import stampit from 'stampit'; import { always } from 'ramda'; +import { ObjectElement, isStringElement } from 'apidom'; import ExampleElement from '../../../../elements/Example'; import FallbackVisitor from '../../FallbackVisitor'; @@ -13,6 +14,19 @@ const ExampleVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { init() { this.element = new ExampleElement(); }, + methods: { + ObjectElement(objectElement: ObjectElement) { + // @ts-ignore + const result = FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement); + + // mark this ExampleElement with reference metadata + if (isStringElement(this.element.externalValue)) { + this.element.classes.push('reference-element'); + } + + return result; + }, + }, }); export default ExampleVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationIdVisitor.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationIdVisitor.ts index 2f69218814..e89edb4d24 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationIdVisitor.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/OperationIdVisitor.ts @@ -1,5 +1,17 @@ +import stampit from 'stampit'; +import { StringElement, BREAK } from 'apidom'; + import FallbackVisitor from '../../FallbackVisitor'; -const OperationIdVisitor = FallbackVisitor; +const OperationIdVisitor = stampit(FallbackVisitor, { + methods: { + StringElement(stringElement: StringElement) { + this.element = stringElement.clone(); + this.element.classes.push('reference-value'); + + return BREAK; + }, + }, +}); export default OperationIdVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/index.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/index.ts index 07766ae30c..8599c9cf49 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/index.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/link/index.ts @@ -1,5 +1,6 @@ import stampit from 'stampit'; import { always } from 'ramda'; +import { isStringElement, ObjectElement } from 'apidom'; import LinkElement from '../../../../elements/Link'; import FallbackVisitor from '../../FallbackVisitor'; @@ -13,6 +14,19 @@ const LinkVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { init() { this.element = new LinkElement(); }, + methods: { + ObjectElement(objectElement: ObjectElement) { + // @ts-ignore + const result = FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement); + + // mark this LinkElement with reference metadata + if (isStringElement(this.element.operationId) || isStringElement(this.element.operationRef)) { + this.element.classes.push('reference-element'); + } + + return result; + }, + }, }); export default LinkVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/index.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/index.ts index 473b87df0c..7f4f3b3445 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/index.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/path-item/index.ts @@ -1,6 +1,6 @@ import stampit from 'stampit'; import { always } from 'ramda'; -import { StringElement, ObjectElement } from 'apidom'; +import { StringElement, ObjectElement, isStringElement } from 'apidom'; import PathItemElement from '../../../../elements/PathItem'; import OperationElement from '../../../../elements/Operation'; @@ -29,6 +29,11 @@ const PathItemVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { operationElement.setMetaProperty('httpMethod', httpMethodElementCS); }); + // mark this PathItemElement with reference metadata + if (isStringElement(this.element.$ref)) { + this.element.classes.push('reference-element'); + } + return result; }, }, diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/index.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/index.ts index 7ecc3f7d0e..0aac88ba6d 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/index.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/reference/index.ts @@ -1,5 +1,6 @@ import stampit from 'stampit'; import { always } from 'ramda'; +import { ObjectElement, isStringElement } from 'apidom'; import ReferenceElement from '../../../../elements/Reference'; import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor'; @@ -13,6 +14,19 @@ const ReferenceVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { init() { this.element = new ReferenceElement(); }, + methods: { + ObjectElement(objectElement: ObjectElement) { + // @ts-ignore + const result = FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement); + + // mark this ReferenceElement with reference metadata + if (isStringElement(this.element.$ref)) { + this.element.classes.push('reference-element'); + } + + return result; + }, + }, }); export default ReferenceVisitor; diff --git a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts index 6c01b01769..6460e09385 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts +++ b/apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/schema/index.ts @@ -79,14 +79,6 @@ const SchemaVisitor = stampit(FixedFieldsVisitor, ParentSchemaAwareVisitor, Fall this.element.setMetaProperty('inherited$id', inherited$id); }; - const appendReferenceMetadata = (objectElement: ObjectElement) => { - const $ref = objectElement.get('$ref')?.toValue(); - - if (isNonEmptyString($ref)) { - this.element.classes.push('reference-element'); - } - }; - /** * Public Api. */ @@ -94,12 +86,18 @@ const SchemaVisitor = stampit(FixedFieldsVisitor, ParentSchemaAwareVisitor, Fall this.element = new SchemaElement(); handle$schema(objectElement); handle$id(objectElement); - appendReferenceMetadata(objectElement); // for further processing consider this Schema Element as parent for all embedded Schema Elements this.parent = this.element; // @ts-ignore - return FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement); + const result = FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement); + + // mark this SchemaElement with reference metadata + if (isStringElement(this.element.$ref)) { + this.element.classes.push('reference-element'); + } + + return result; }; this.BooleanElement = function _BooleanElement(booleanElement: BooleanElement) { diff --git a/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap b/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap index abc2ce0c41..abb19eaea9 100644 --- a/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap +++ b/apidom/packages/apidom-ns-openapi-3-1/test/refractor/__snapshots__/index.ts.snap @@ -1201,6 +1201,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -1503,6 +1507,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "example", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-element" + } + ] + } + }, "content": [ { "element": "member", @@ -1642,6 +1657,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -1947,6 +1966,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -2304,6 +2327,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "link", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-element" + } + ] + } + }, "content": [ { "element": "member", @@ -2360,6 +2394,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, "content": "operationId-1" } } @@ -2526,6 +2571,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -2609,6 +2658,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -3061,6 +3114,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -3515,6 +3572,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -3611,6 +3672,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -4248,6 +4313,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -4323,6 +4392,15 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra "value": { "element": "pathItem", "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-element" + } + ] + }, "path": { "element": "string", "content": "/path2" @@ -4633,6 +4711,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5145,6 +5227,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5490,6 +5576,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5594,6 +5684,17 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra }, "value": { "element": "example", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-element" + } + ] + } + }, "content": [ { "element": "member", @@ -5733,6 +5834,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5917,6 +6022,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6141,6 +6250,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6471,6 +6584,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6631,6 +6748,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -7083,6 +7204,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -7342,6 +7467,10 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.1 shape should refra { "element": "string", "content": "openapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, From 207fe3ac4f3d3960727140bd0a4a5896db9d3f33 Mon Sep 17 00:00:00 2001 From: Vladimir Gorej Date: Mon, 2 Aug 2021 16:04:25 +0200 Subject: [PATCH 3/3] feat(ns-asyncapi-2): add reference metadata Refs https://github.com/swagger-api/oss-planning/issues/265 --- .../async-api-2-0/channel-item/index.ts | 14 +++ .../visitors/async-api-2-0/reference/index.ts | 14 +++ .../refractor/__snapshots__/index.ts.snap | 91 +++++++++++++++++++ 3 files changed, 119 insertions(+) diff --git a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/index.ts b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/index.ts index 3f0721e815..a1060febf2 100644 --- a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/index.ts +++ b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/channel-item/index.ts @@ -1,5 +1,6 @@ import stampit from 'stampit'; import { always } from 'ramda'; +import { ObjectElement, isStringElement } from 'apidom'; import ChannelItemElement from '../../../../elements/ChannelItem'; import FallbackVisitor from '../../FallbackVisitor'; @@ -13,6 +14,19 @@ const ChannelItemVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { init() { this.element = new ChannelItemElement(); }, + methods: { + ObjectElement(objectElement: ObjectElement) { + // @ts-ignore + const result = FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement); + + // mark this ChannelItemElement with reference metadata + if (isStringElement(this.element.$ref)) { + this.element.classes.push('reference-element'); + } + + return result; + }, + }, }); export default ChannelItemVisitor; diff --git a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/index.ts b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/index.ts index 7ecc3f7d0e..0aac88ba6d 100644 --- a/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/index.ts +++ b/apidom/packages/apidom-ns-asyncapi-2-0/src/refractor/visitors/async-api-2-0/reference/index.ts @@ -1,5 +1,6 @@ import stampit from 'stampit'; import { always } from 'ramda'; +import { ObjectElement, isStringElement } from 'apidom'; import ReferenceElement from '../../../../elements/Reference'; import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor'; @@ -13,6 +14,19 @@ const ReferenceVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { init() { this.element = new ReferenceElement(); }, + methods: { + ObjectElement(objectElement: ObjectElement) { + // @ts-ignore + const result = FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement); + + // mark this ReferenceElement with reference metadata + if (isStringElement(this.element.$ref)) { + this.element.classes.push('reference-element'); + } + + return result; + }, + }, }); export default ReferenceVisitor; diff --git a/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap b/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap index 30f1eaecf4..9e016e337d 100644 --- a/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap +++ b/apidom/packages/apidom-ns-asyncapi-2-0/test/refractor/__snapshots__/index.ts.snap @@ -956,6 +956,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -2120,6 +2124,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -2199,6 +2207,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -3927,6 +3939,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -4051,6 +4067,17 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr }, "value": { "element": "channelItem", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-element" + } + ] + } + }, "content": [ { "element": "member", @@ -4496,6 +4523,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -4591,6 +4622,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -4672,6 +4707,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -4898,6 +4937,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -4981,6 +5024,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5170,6 +5217,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5308,6 +5359,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5446,6 +5501,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5683,6 +5742,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5821,6 +5884,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -5959,6 +6026,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6097,6 +6168,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6260,6 +6335,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6423,6 +6502,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6586,6 +6669,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] }, @@ -6749,6 +6836,10 @@ exports[`refractor given generic ApiDOM object in AsyncApi 2.0 shape should refr { "element": "string", "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" } ] },