From ca0487f57cf8bbf8b21615493a5cc9dda1c8cf7b Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Sun, 19 Oct 2025 13:03:53 +0530 Subject: [PATCH 01/27] feat: add package for apidom-ns-async-api-3 --- packages/apidom-ns-asyncapi-3/README.md | 5 + .../config/api-extractor/api-extractor.json | 4 + .../config/webpack/browser.config.js | 74 ++++++++ .../config/webpack/traits.config.js | 32 ++++ packages/apidom-ns-asyncapi-3/package.json | 53 ++++++ .../src/elements/AsyncApi3.ts | 49 ++++++ .../src/elements/AsyncApiVersion.ts | 8 + .../src/elements/Channel.ts | 95 ++++++++++ .../src/elements/ChannelBindings.ts | 8 + .../src/elements/Channels.ts | 31 ++++ .../src/elements/Components.ts | 166 ++++++++++++++++++ .../src/elements/Contact.ts | 8 + .../src/elements/CorrelationID.ts | 8 + .../src/elements/DefaultContentType.ts | 8 + .../src/elements/ExternalDocumentation.ts | 8 + .../src/elements/Identifier.ts | 8 + .../apidom-ns-asyncapi-3/src/elements/Info.ts | 33 ++++ .../src/elements/License.ts | 8 + .../src/elements/Message.ts | 124 +++++++++++++ .../src/elements/MessageBindings.ts | 8 + .../src/elements/MessageExample.ts | 8 + .../src/elements/MessageTrait.ts | 115 ++++++++++++ .../src/elements/Messages.ts | 13 ++ .../src/elements/MultiFormatSchema.ts | 29 +++ .../src/elements/OauthFlow.ts | 32 ++++ .../src/elements/OauthFlows.ts | 5 + .../src/elements/Operation.ts | 86 +++++++++ .../src/elements/OperationBindings.ts | 8 + .../src/elements/OperationReply.ts | 39 ++++ .../src/elements/OperationReplyAddress.ts | 29 +++ .../src/elements/OperationTrait.ts | 80 +++++++++ .../src/elements/Operations.ts | 13 ++ .../src/elements/Parameter.ts | 53 ++++++ .../src/elements/Parameters.ts | 8 + .../src/elements/Reference.ts | 8 + .../src/elements/Schema.ts | 85 +++++++++ .../src/elements/SecurityScheme.ts | 21 +++ .../src/elements/Server.ts | 114 ++++++++++++ .../src/elements/ServerBindings.ts | 5 + .../src/elements/ServerVariable.ts | 8 + .../src/elements/Servers.ts | 5 + .../apidom-ns-asyncapi-3/src/elements/Tag.ts | 36 ++++ .../apidom-ns-asyncapi-3/src/elements/Tags.ts | 8 + packages/apidom-ns-asyncapi-3/src/index.ts | 7 + .../apidom-ns-asyncapi-3/src/media-types.ts | 44 +++++ .../apidom-ns-asyncapi-3/src/namespace.ts | 38 ++++ .../apidom-ns-asyncapi-3/src/predicates.ts | 9 + .../src/refractor/index.ts | 25 +++ .../src/refractor/predicates.ts | 9 + .../src/refractor/specification.ts | 133 ++++++++++++++ .../src/refractor/toolbox.ts | 3 + .../refractor/visitors/AsyncApi3Visitor.ts | 7 + .../src/refractor/visitors/BindingsVisitor.ts | 7 + .../visitors/ExternalDocumentationVisitor.ts | 6 + .../src/refractor/visitors/FallbackVisitor.ts | 11 ++ .../refractor/visitors/ParametersVisitor.ts | 6 + .../visitors/SecuritySchemesVisitor.ts | 6 + .../src/refractor/visitors/TagsVisitor.ts | 7 + .../src/refractor/visitors/Visitor.ts | 18 ++ .../visitors/channel/ChanneVisitor.ts | 12 ++ .../visitors/channels/ChannelsVisitor.ts | 6 + .../visitors/components/ComponentsVisitor.ts | 13 ++ .../refractor/visitors/info/InfoVisitor.ts | 15 ++ .../visitors/message/MessageVisitor.ts | 5 + .../operation/OperationMessageVisitor.ts | 6 + .../visitors/operation/OperationVisitor.ts | 5 + .../visitors/reference/ReferenceVisitor.ts | 13 ++ .../visitors/schema/SchemaVisitor.ts | 5 + .../visitors/server/ServerVariableVisitor.ts | 29 +++ .../visitors/server/ServerVisitor.ts | 26 +++ .../visitors/server/ServersVisitor.ts | 29 +++ .../test/fixtures/simple-asyncapi-3.json | 32 ++++ packages/apidom-ns-asyncapi-3/test/index.ts | 72 ++++++++ packages/apidom-ns-asyncapi-3/tsconfig.json | 9 + .../types/apidom-ns-asyncapi-3.d.ts | 2 + 75 files changed, 2161 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/README.md create mode 100644 packages/apidom-ns-asyncapi-3/config/api-extractor/api-extractor.json create mode 100644 packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js create mode 100644 packages/apidom-ns-asyncapi-3/config/webpack/traits.config.js create mode 100644 packages/apidom-ns-asyncapi-3/package.json create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/AsyncApiVersion.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Channel.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Channels.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Components.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Contact.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/CorrelationID.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/ExternalDocumentation.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Identifier.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Info.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/License.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Message.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Messages.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Operation.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Operations.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Reference.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Schema.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Server.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/ServerVariable.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Servers.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Tag.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/Tags.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/media-types.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/namespace.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/predicates.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/specification.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/channel/ChanneVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/components/ComponentsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/info/InfoVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/message/MessageVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/reference/ReferenceVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/schema/SchemaVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json create mode 100644 packages/apidom-ns-asyncapi-3/test/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/tsconfig.json create mode 100644 packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts diff --git a/packages/apidom-ns-asyncapi-3/README.md b/packages/apidom-ns-asyncapi-3/README.md new file mode 100644 index 0000000000..b91ea77d3c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/README.md @@ -0,0 +1,5 @@ +# apidom-ns-asyncapi-3 + +AsyncAPI 3.x.y namespace for ApiDOM. + +This is a starter scaffold. Implement element classes, predicates and refractor visitors following the pattern from `apidom-ns-asyncapi-2`. diff --git a/packages/apidom-ns-asyncapi-3/config/api-extractor/api-extractor.json b/packages/apidom-ns-asyncapi-3/config/api-extractor/api-extractor.json new file mode 100644 index 0000000000..7de0d99447 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/config/api-extractor/api-extractor.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../../../api-extractor.json" +} diff --git a/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js b/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js new file mode 100644 index 0000000000..78f6c65dbc --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js @@ -0,0 +1,74 @@ +import path from 'node:path'; +import { nonMinimizeTrait, minimizeTrait } from './traits.config.js'; + +const browser = { + mode: 'production', + entry: ['./src/index.ts'], + target: 'web', + performance: { + maxEntrypointSize: 2200000, + maxAssetSize: 2200000, + }, + output: { + path: path.resolve('./dist'), + filename: 'apidom-ns-asyncapi-3.browser.js', + libraryTarget: 'umd', + library: 'apidomNsAsyncApi3', + }, + resolve: { + extensions: ['.ts', '.mjs', '.js', '.json'], + }, + module: { + rules: [ + { + test: /\.(ts|js)?$/, + exclude: /node_modules/, + use: { + loader: 'babel-loader', + options: { + babelrc: true, + rootMode: 'upward', + }, + }, + }, + ], + }, + ...nonMinimizeTrait, +}; + +const browserMin = { + mode: 'production', + entry: ['./src/index.ts'], + target: 'web', + performance: { + maxEntrypointSize: 310000, + maxAssetSize: 310000, + }, + output: { + path: path.resolve('./dist'), + filename: 'apidom-ns-asyncapi-3.browser.min.js', + libraryTarget: 'umd', + library: 'apidomNsAsyncApi3', + }, + resolve: { + extensions: ['.ts', '.mjs', '.js', '.json'], + }, + module: { + rules: [ + { + test: /\.(ts|js)?$/, + exclude: /node_modules/, + use: { + loader: 'babel-loader', + options: { + babelrc: true, + rootMode: 'upward', + }, + }, + }, + ], + }, + ...minimizeTrait, +}; + +export default [browser, browserMin]; diff --git a/packages/apidom-ns-asyncapi-3/config/webpack/traits.config.js b/packages/apidom-ns-asyncapi-3/config/webpack/traits.config.js new file mode 100644 index 0000000000..9043521175 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/config/webpack/traits.config.js @@ -0,0 +1,32 @@ +import webpack from 'webpack'; +import TerserPlugin from 'terser-webpack-plugin'; + +export const nonMinimizeTrait = { + optimization: { + minimize: false, + usedExports: false, + concatenateModules: false, + }, +}; + +export const minimizeTrait = { + plugins: [ + new webpack.LoaderOptionsPlugin({ + minimize: true, + }), + ], + optimization: { + minimizer: [ + new TerserPlugin({ + terserOptions: { + compress: { + warnings: false, + }, + output: { + comments: false, + }, + }, + }), + ], + }, +}; diff --git a/packages/apidom-ns-asyncapi-3/package.json b/packages/apidom-ns-asyncapi-3/package.json new file mode 100644 index 0000000000..fcf172f50a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/package.json @@ -0,0 +1,53 @@ +{ + "name": "@swagger-api/apidom-ns-asyncapi-3", + "version": "1.0.0-beta.0", + "description": "AsyncAPI 3.x.y namespace for ApiDOM.", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org" + }, + "type": "module", + "sideEffects": [], + "main": "./src/index.cjs", + "exports": { + "types": "./types/apidom-ns-asyncapi-3.d.ts", + "import": "./src/index.mjs", + "require": "./src/index.cjs" + }, + "types": "./types/apidom-ns-asyncapi-3.d.ts", + "scripts": { + "build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs", + "build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'", + "build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'", + "lint": "eslint ./", + "lint:fix": "eslint ./ --fix", + "clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types", + "test": "NODE_ENV=test ts-mocha --project tsconfig.json --exit \"test/**/*.ts\"", + "typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json 2>&1 | shx grep -v 'Visitor_base'" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/swagger-api/apidom.git" + }, + "author": "apidom team", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.0.0-beta.51", + "@swagger-api/apidom-ns-asyncapi-2": "workspace:^1.0.0-beta.51", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + }, + "files": [ + "src/**/*.mjs", + "src/**/*.cjs", + "dist/", + "types/apidom-ns-asyncapi-3.d.ts", + "LICENSES", + "NOTICE", + "README.md", + "CHANGELOG.md" + ] +} diff --git a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts new file mode 100644 index 0000000000..33b93f25da --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts @@ -0,0 +1,49 @@ +import { Attributes, Meta } from '@swagger-api/apidom-core'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; +import { ExternalDocumentationElement, AsyncApi2Element, TagsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import OperationElement from './Operation.ts'; + +/** + * @public + */ +class AsyncApi3 extends AsyncApi2Element { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'asyncApi3'; + this.classes.push('api'); + } + + get tags(): TagsElement | undefined { + throw new UnsupportedOperationError( + 'TagsElement keyword from Core vocabulary has been moved to Info.', + ); + } + + set tags(tags: TagsElement | undefined) { + throw new UnsupportedOperationError( + 'TagsElement keyword from Core vocabulary has been moved to Info.', + ); + } + + get externalDocs(): ExternalDocumentationElement | undefined { + throw new UnsupportedOperationError( + 'ExternalDocsElement keyword from Core vocabulary has been moved to Info.', + ); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | undefined) { + throw new UnsupportedOperationError( + 'ExternalDocsElement keyword from Core vocabulary has been moved to Info.', + ); + } + + get operations(): OperationElement { + return this.get('operations'); + } + + set operations(val) { + this.set('operations', val); + } +} + +export default AsyncApi3; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApiVersion.ts b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApiVersion.ts new file mode 100644 index 0000000000..cd63833b9f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApiVersion.ts @@ -0,0 +1,8 @@ +import { AsyncApiVersionElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class AsyncApiVersion extends AsyncApiVersionElement {} + +export default AsyncApiVersion; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts b/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts new file mode 100644 index 0000000000..bb188100b1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts @@ -0,0 +1,95 @@ +import { ObjectElement, Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; +import MessagesElement from './Messages.ts'; +import type { ArrayElement } from '@swagger-api/apidom-core'; +import ParametersElement from './Parameters.ts'; +import TagsElement from './Tags.ts'; +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import ReferenceElement from './Reference.ts'; +import ChannelBindingsElement from './ChannelBindings.ts'; + +/** + * @public + */ +class Channel extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'channel'; + } + + get address(): StringElement | null { + return this.get('address'); + } + + set address(address: StringElement | null) { + this.set('address', address); + } + + get messages(): MessagesElement | undefined { + return this.get('messages'); + } + + set messages(messages: MessagesElement | undefined) { + this.set('messages', messages); + } + + get title(): StringElement | undefined { + return this.get('title'); + } + set title(title: StringElement | undefined) { + this.set('title', title); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + set description(description: StringElement | undefined) { + this.set('description', description); + } + + get summary(): StringElement | undefined { + return this.get('summary'); + } + set summary(summary: StringElement | undefined) { + this.set('summary', summary); + } + + get servers(): ArrayElement | undefined { + return this.get('servers'); + } + + set servers(servers: import('@swagger-api/apidom-core').ArrayElement | undefined) { + this.set('servers', servers); + } + + get parameters(): ParametersElement | undefined { + return this.get('parameters'); + } + set parameters(parameters: ParametersElement | undefined) { + this.set('parameters', parameters); + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } + + get bindings(): ChannelBindingsElement | undefined { + return this.get('bindings'); + } + + set bindings(bindings: ChannelBindingsElement | undefined) { + this.set('bindings', bindings); + } + +} + +export default Channel; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts new file mode 100644 index 0000000000..6800e64fd2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts @@ -0,0 +1,8 @@ +import { ChannelBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; + +/** + * @public + */ +class ChannelBindings extends ChannelBindingsElement {} + +export default ChannelBindings; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts b/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts new file mode 100644 index 0000000000..ac7f9fa352 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts @@ -0,0 +1,31 @@ +import { Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; +import {ChannelsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import ChannelElement from './Channel.ts'; + +/** + * @public + */ +class Channels extends ChannelsElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'channels'; + } + + get channel(): ChannelElement | undefined { + return this.get('channel'); + } + + set channel(channel: ChannelElement | undefined) { + this.set('channel', channel); + } + + get $ref(): StringElement | undefined { + return this.get('$ref'); + } + + set $ref($ref: StringElement | undefined) { + this.set('$ref', $ref); + } +} + +export default Channels; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Components.ts b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts new file mode 100644 index 0000000000..7e6091d815 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts @@ -0,0 +1,166 @@ +import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; +import TagsElement from './Tags.ts'; + +/** + * @public + */ +class Components extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'components'; + } + + get schemas(): ObjectElement | undefined { + return this.get('schemas'); + } + + set schemas(schemas: ObjectElement | undefined) { + this.set('schemas', schemas); + } + + get servers(): ObjectElement | undefined { + return this.get('servers'); + } + + set servers(servers: ObjectElement | undefined) { + this.set('servers', servers); + } + + get channels(): ObjectElement | undefined { + return this.get('channnels'); + } + + set channels(channels: ObjectElement | undefined) { + this.set('channels', channels); + } + + get operations(): ObjectElement | undefined { + return this.get('operations'); + } + + set operations(operations: ObjectElement | undefined) { + this.set('operations', operations); + } + + get messages(): ObjectElement | undefined { + return this.get('messages'); + } + + set messages(messages: ObjectElement | undefined) { + this.set('messages', messages); + } + + get securitySchemes(): ObjectElement | undefined { + return this.get('securitySchemes'); + } + + set securitySchemes(securitySchemes: ObjectElement | undefined) { + this.set('securitySchemes', securitySchemes); + } + + get serverVariables(): ObjectElement | undefined { + return this.get('serverVariables'); + } + + set serverVariables(serverVariables: ObjectElement | undefined) { + this.set('serverVariables', serverVariables); + } + + get parameters(): ObjectElement | undefined { + return this.get('parameters'); + } + + set parameters(parameters: ObjectElement | undefined) { + this.set('parameters', parameters); + } + + get correlationIds(): ObjectElement | undefined { + return this.get('correlationIds'); + } + + set correlationIds(correlationIds: ObjectElement | undefined) { + this.set('correlationIds', correlationIds); + } + + get replies(): ObjectElement | undefined { + return this.get('reply'); + } + + set replies(replies: ObjectElement | undefined) { + this.set('reply', replies); + } + + get replyAddresses(): ObjectElement | undefined { + return this.get('replyAddresses'); + } + + set replyAddresses(replyAddresses: ObjectElement | undefined) { + this.set('replyAddresses', replyAddresses); + } + + get externalDocs(): ObjectElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ObjectElement | undefined) { + this.set('externalDocs', externalDocs); + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + get operationTraits(): ObjectElement | undefined { + return this.get('operationTraits'); + } + + set operationTraits(operationTraits: ObjectElement | undefined) { + this.set('operationTraits', operationTraits); + } + + get messageTraits(): ObjectElement | undefined { + return this.get('messageTraits'); + } + + set messageTraits(messageTraits: ObjectElement | undefined) { + this.set('messageTraits', messageTraits); + } + + get serverBindings(): ObjectElement | undefined { + return this.get('serverBindings'); + } + + set serverBindings(serverBindings: ObjectElement | undefined) { + this.set('serverBindings', serverBindings); + } + + get channelBindings(): ObjectElement | undefined { + return this.get('channelBindings'); + } + + set channelBindings(channelBindings: ObjectElement | undefined) { + this.set('channelBindings', channelBindings); + } + + get operationBindings(): ObjectElement | undefined { + return this.get('operationBindings'); + } + + set operationBindings(operationBindings: ObjectElement | undefined) { + this.set('operationBindings', operationBindings); + } + + get messageBindings(): ObjectElement | undefined { + return this.get('messageBindings'); + } + + set messageBindings(messageBindings: ObjectElement | undefined) { + this.set('messageBindings', messageBindings); + } +} + +export default Components; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Contact.ts b/packages/apidom-ns-asyncapi-3/src/elements/Contact.ts new file mode 100644 index 0000000000..db91317900 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Contact.ts @@ -0,0 +1,8 @@ +import { ContactElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class Contact extends ContactElement {} + +export default Contact; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/CorrelationID.ts b/packages/apidom-ns-asyncapi-3/src/elements/CorrelationID.ts new file mode 100644 index 0000000000..8c93052579 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/CorrelationID.ts @@ -0,0 +1,8 @@ +import { CorrelationIDElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class CorrelationID extends CorrelationIDElement {} + +export default CorrelationID; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts b/packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts new file mode 100644 index 0000000000..d54947691f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts @@ -0,0 +1,8 @@ +import { DefaultContentTypeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class DefaultContentType extends DefaultContentTypeElement {} + +export default DefaultContentType; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ExternalDocumentation.ts b/packages/apidom-ns-asyncapi-3/src/elements/ExternalDocumentation.ts new file mode 100644 index 0000000000..b2174b500b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/ExternalDocumentation.ts @@ -0,0 +1,8 @@ +import { ExternalDocumentationElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class ExternalDocumentation extends ExternalDocumentationElement {} + +export default ExternalDocumentation; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Identifier.ts b/packages/apidom-ns-asyncapi-3/src/elements/Identifier.ts new file mode 100644 index 0000000000..b19b608e37 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Identifier.ts @@ -0,0 +1,8 @@ +import { IdentifierElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class Identifier extends IdentifierElement {} + +export default Identifier; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Info.ts b/packages/apidom-ns-asyncapi-3/src/elements/Info.ts new file mode 100644 index 0000000000..c07506815f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Info.ts @@ -0,0 +1,33 @@ +import { Attributes, Meta } from '@swagger-api/apidom-core'; +import { InfoElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import TagsElement from './Tags.ts'; +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import ReferenceElement from './Reference.ts'; + +/** + * @public + */ +class Info extends InfoElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'info'; + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } +} + +export default Info; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/License.ts b/packages/apidom-ns-asyncapi-3/src/elements/License.ts new file mode 100644 index 0000000000..cb898a8fb1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/License.ts @@ -0,0 +1,8 @@ +import { LicenseElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class License extends LicenseElement {} + +export default License; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Message.ts b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts new file mode 100644 index 0000000000..3a3745bde7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts @@ -0,0 +1,124 @@ +import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; +import { CorrelationIDElement, ExternalDocumentationElement, MessageBindingsElement, MessageElement, TagsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import MultiformatSchemaElement from './MultiFormatSchema.ts'; +import SchemaElement from './Schema.ts'; +import ReferenceElement from './Reference.ts'; +import MessageExampleElement from './MessageExample.ts'; +import MessageTrait from './MessageTrait.ts'; + +/** + * @public + */ +class Message extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'message'; + } + + get headers(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined { + return this.get('headers') + } + + set headers(headers: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined ) { + this.set('headers', headers) + } + + get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined { + return this.get('payload'); + } + + set payload(payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined ) { + this.set('payload', payload); + } + + get correlationId(): CorrelationIDElement | ReferenceElement | undefined { + return this.get('correlationId'); + } + + set correlationId(correlationId: CorrelationIDElement | ReferenceElement | undefined) { + this.set('correlationId', correlationId); + } + + get contentType(): StringElement { + return this.get('contentType'); + } + + set contentType(contentType: StringElement) { + this.set('contentType', contentType); + } + + get name(): StringElement { + return this.get('name'); + } + + set name(name: StringElement) { + this.set('name', name); + } + + get title(): StringElement { + return this.get('title'); + } + + set title(title: StringElement) { + this.set('title', title); + } + + get summary(): StringElement { + return this.get('summary'); + } + + set summary(summary: StringElement) { + this.set('summary', summary); + } + + get description(): StringElement { + return this.get('description'); + } + + set description(description: StringElement) { + this.set('description', description); + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement |ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } + + get bindings(): MessageBindingsElement | ReferenceElement | undefined { + return this.get('bindings'); + } + + set bindings(bindings: MessageBindingsElement | ReferenceElement | undefined) { + this.set('bindings', bindings); + } + + get examples(): MessageExampleElement[] | undefined { + return this.get('examples'); + } + + set examples(examples: [MessageExampleElement] | undefined) { + this.set('examples', examples); + } + + get traits(): [MessageTrait] | [ReferenceElement] | undefined { + return this.get('traits'); + } + + set traits(traits: [MessageTrait] | [ReferenceElement] | undefined) { + this.set('traits', traits); + } +} + +export default Message; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts new file mode 100644 index 0000000000..5b95bc3283 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts @@ -0,0 +1,8 @@ +import { MessageBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; + +/** + * @public + */ +class MessageBindings extends MessageBindingsElement {} + +export default MessageBindings; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts b/packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts new file mode 100644 index 0000000000..f29da61607 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts @@ -0,0 +1,8 @@ +import { MessageExampleElement } from "@swagger-api/apidom-ns-asyncapi-2"; + +/** + * @public + */ +class MessageExample extends MessageExampleElement {} + +export default MessageExample; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts b/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts new file mode 100644 index 0000000000..de087d7307 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts @@ -0,0 +1,115 @@ +import { + ObjectElement, + StringElement, + Attributes, + Meta, +} from '@swagger-api/apidom-core'; + +import CorrelationIDElement from './CorrelationID.ts'; +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import MessageBindingsElement from './MessageBindings.ts'; +import ReferenceElement from './Reference.ts'; +import SchemaElement from './Schema.ts'; +import TagsElement from './Tag.ts'; +import MultiFormatSchema from './MultiFormatSchema.ts'; +import MessageExampleElement from './MessageExample.ts'; + +/** + * @public + */ +class MessageTrait extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'messageTrait'; + } + + get headers(): MultiFormatSchema| SchemaElement | ReferenceElement | undefined { + return this.get('headers'); + } + + set headers(headers: MultiFormatSchema | SchemaElement | ReferenceElement | undefined) { + this.set('headers', headers); + } + + get correlationId(): CorrelationIDElement | ReferenceElement | undefined { + return this.get('correlationId'); + } + + set correlationId(correlationId: CorrelationIDElement | ReferenceElement | undefined) { + this.set('correlationId', correlationId); + } + + get contentType(): StringElement | undefined { + return this.get('contentType'); + } + + set contentType(contentType: StringElement | undefined) { + this.set('contentType', contentType); + } + + get name(): StringElement | undefined { + return this.get('name'); + } + + set name(name: StringElement | undefined) { + this.set('name', name); + } + + get title(): StringElement | undefined { + return this.get('title'); + } + + set title(title: StringElement | undefined) { + this.set('title', title); + } + + get summary(): StringElement | undefined { + return this.get('summary'); + } + + set summary(summary: StringElement | undefined) { + this.set('summary', summary); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(description: StringElement | undefined) { + this.set('description', description); + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } + + get bindings(): MessageBindingsElement | ReferenceElement | undefined { + return this.get('bindings'); + } + + set bindings(bindings: MessageBindingsElement | ReferenceElement | undefined) { + this.set('bindings', bindings); + } + + get examples(): MessageExampleElement[] | undefined { + return this.get('examples'); + } + + set examples(examples: MessageExampleElement[] | undefined) { + this.set('examples', examples); + } +} + +export default MessageTrait; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Messages.ts b/packages/apidom-ns-asyncapi-3/src/elements/Messages.ts new file mode 100644 index 0000000000..8c4c1a97eb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Messages.ts @@ -0,0 +1,13 @@ +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class Messages extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'messages'; + } +} + +export default Messages; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts new file mode 100644 index 0000000000..101be5f70b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts @@ -0,0 +1,29 @@ +import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class MultiFormatSchema extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'MultiformatSchema'; + } + + get schemaForamt(): StringElement | undefined { + return this.get('schemaForamt') + } + + set schemaForamt(schemaForamt: StringElement | undefined ) { + this.set('schemaFormat', schemaForamt); + } + + get schema() { + return this.get('schema') + } + + set schema(schema) { + this.set('schema', schema); + } +} + +export default MultiFormatSchema; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts new file mode 100644 index 0000000000..8a4b3c213b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts @@ -0,0 +1,32 @@ +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; +import { OAuthFlowElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class OauthFlow extends OAuthFlowElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'oauthFlow'; + } + + get scopes(): ObjectElement | undefined { + throw new UnsupportedOperationError( + 'scopes keyword from Core vocabulary has been renamed to availableScopes.', + ); + } + + set scopes(scopes: ObjectElement | undefined) { + throw new UnsupportedOperationError( + 'scopes keyword from Core vocabulary has been renamed to availableScopes.', + ); + } + + get availableScopes(): ObjectElement | undefined { + return this.get('availableScopes'); + } + + set availableScopes(availableScopes: ObjectElement | undefined) { + this.set('availableScopes', availableScopes); + } +} + +export default OauthFlow; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts new file mode 100644 index 0000000000..7ceb9da3ed --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts @@ -0,0 +1,5 @@ +import { OAuthFlowElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class OauthFlows extends OAuthFlowElement {} + +export default OauthFlows; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts new file mode 100644 index 0000000000..3c58b4fa37 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts @@ -0,0 +1,86 @@ +import { + ArrayElement, + Attributes, + Meta, + ObjectElement, + StringElement, +} from '@swagger-api/apidom-core'; +import ReferenceElement from './Reference.ts'; +import OperationTraitElement from './OperationTrait.ts'; + +/** + * @public + */ +class Operation extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operation'; + } + + get action(): 'send' | 'receive' | undefined { + return this.get('action'); + } + + set action(value: 'send' | 'receive' | undefined) { + this.set('action', value); + } + + get channel(): ReferenceElement | undefined { + return this.get('channel'); + } + + set channel(channel: ReferenceElement | undefined) { + this.set('channel', channel); + } + + get title(): StringElement | undefined { + return this.get('title'); + } + + set title(title: StringElement | undefined) { + this.set('title', title); + } + + get summary(): StringElement | undefined { + return this.get('summary'); + } + + set summary(summary: StringElement | undefined) { + this.set('summary', summary); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(description: StringElement | undefined) { + this.set('description', description); + } + + get security(): ArrayElement | undefined { + return this.get('security'); + } + + set security(security: ArrayElement | undefined) { + this.set('security', security); + } + + get messages(): ArrayElement | undefined { + return this.get('messages'); + } + + set messages(message: ArrayElement | undefined) { + this.set('messages', message); + } + + get traits(): OperationTraitElement | undefined { + return this.get('traits'); + } + + set traits(OperationTrait: OperationTraitElement | undefined) { + this.set('traits', OperationTrait); + } + +} + +export default Operation; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts new file mode 100644 index 0000000000..2b6f5ca131 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts @@ -0,0 +1,8 @@ +import { OperationBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; + +/** + * @public + */ +class OperationBindings extends OperationBindingsElement {} + +export default OperationBindings; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts new file mode 100644 index 0000000000..657b4e7dc0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts @@ -0,0 +1,39 @@ +import { ObjectElement, Attributes, Meta, ArrayElement } from '@swagger-api/apidom-core'; +import OperationReplyAddress from './OperationReplyAddress.ts'; +import ReferenceElement from './Reference.ts'; + +/** + * @public + */ +class OperationReply extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operationReply'; + } + + get address(): OperationReplyAddress | ReferenceElement | undefined { + return this.get('address'); + } + + set address(address: OperationReplyAddress | ReferenceElement | undefined) { + this.set('address', address); + } + + get channel(): ReferenceElement | undefined { + return this.get('channel'); + } + + set channel(channel: ReferenceElement | undefined) { + this.set('channel', channel); + } + + get message(): ArrayElement | undefined { + return this.get('message'); + } + + set message(message: ArrayElement | undefined) { + this.set('message', message); + } +} + +export default OperationReply; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts new file mode 100644 index 0000000000..a0123f7d4b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts @@ -0,0 +1,29 @@ +import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class OperationReplyAddress extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operationReplyAddress'; + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(value: StringElement | undefined) { + this.set('description', value); + } + + get location(): StringElement | undefined { + return this.get('location'); + } + + set location(value: StringElement | undefined) { + this.set('location', value); + } +} + +export default OperationReplyAddress; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts new file mode 100644 index 0000000000..fd922c4855 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts @@ -0,0 +1,80 @@ +import { + StringElement, + ObjectElement, + ArrayElement, + Attributes, + Meta, +} from '@swagger-api/apidom-core'; + +import TagsElement from './Tags.ts'; +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import OperationBindingsElement from './OperationBindings.ts'; +import ReferenceElement from './Reference.ts'; + +/** + * @public + */ +class OperationTrait extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operationTrait'; + } + + get operationId(): StringElement | undefined { + return this.get('operationId'); + } + + set operationId(operationId: StringElement | undefined) { + this.set('operationId', operationId); + } + + get summary(): StringElement | undefined { + return this.get('summary'); + } + + set summary(summary: StringElement | undefined) { + this.set('summary', summary); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(description: StringElement | undefined) { + this.set('description', description); + } + + get security(): ArrayElement | undefined { + return this.get('security'); + } + + set security(security: ArrayElement | undefined) { + this.set('security', security); + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } + + get bindings(): OperationBindingsElement | ReferenceElement | undefined { + return this.get('bindings'); + } + + set bindings(bindings: OperationBindingsElement | ReferenceElement | undefined) { + this.set('bindings', bindings); + } +} + +export default OperationTrait; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Operations.ts b/packages/apidom-ns-asyncapi-3/src/elements/Operations.ts new file mode 100644 index 0000000000..e28653667d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Operations.ts @@ -0,0 +1,13 @@ +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class Operations extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operations'; + } +} + +export default Operations; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts b/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts new file mode 100644 index 0000000000..d3d131c2bf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts @@ -0,0 +1,53 @@ +import { ObjectElement, StringElement, ArrayElement } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class Parameter extends ObjectElement { + constructor(content: any = {}, meta?: any, attributes?: any) { + super(content, meta, attributes); + this.element = 'parameter'; + } + + get enum(): ArrayElement| undefined { + return this.get('enum'); + } + + set enum(value: ArrayElement | undefined) { + this.set('enum', value); + } + + get default(): StringElement | undefined { + return this.get('default'); + } + + set default(value: StringElement | undefined) { + this.set('default', value); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(value: StringElement | undefined) { + this.set('description', value); + } + + get examples(): ArrayElement | undefined { + return this.get('examples'); + } + + set examples(value: ArrayElement | undefined) { + this.set('examples', value); + } + + get location(): StringElement | undefined { + return this.get('location'); + } + + set location(value: StringElement | undefined) { + this.set('location', value); + } + +} + export default Parameter; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts b/packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts new file mode 100644 index 0000000000..0fdcab0709 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts @@ -0,0 +1,8 @@ +import { ParametersElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class Parameters extends ParametersElement {} + +export default Parameters; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Reference.ts b/packages/apidom-ns-asyncapi-3/src/elements/Reference.ts new file mode 100644 index 0000000000..b77e771ca1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Reference.ts @@ -0,0 +1,8 @@ +import { ReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class Reference extends ReferenceElement {} + +export default Reference; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts new file mode 100644 index 0000000000..cc4f4cf8c3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts @@ -0,0 +1,85 @@ +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; +import AsyncApi3Element from './AsyncApi3.ts'; +import ComponentsElement from './Components.ts'; +import ChannelsElement from './Channels.ts'; +import DefaultContentTypeElement from './DefaultContentType.ts'; +import InfoElement from './Info.ts'; +import OperationsElement from './Operations.ts'; +import ServersElement from './Servers.ts'; + + +/** + * @public + */ +class Schema extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'schema'; + } + + get asyncapi(): AsyncApi3Element | undefined { + return this.get('asyncapi'); + } + + set asyncapi(asyncapi: AsyncApi3Element | undefined) { + this.set('asyncapi', asyncapi); + } + + get idProp(): string | undefined { + return this.get('idProp'); + } + + set idProp(idProp: string | undefined) { + this.set('idProp', idProp); + } + + get info(): InfoElement | undefined { + return this.get('info'); + } + + set info(info: InfoElement | undefined) { + this.set('info', info); + } + + get servers(): ServersElement | undefined { + return this.get('servers'); + } + + set servers(servers: ServersElement | undefined) { + this.set('servers', servers); + } + + get defaultContentType(): DefaultContentTypeElement | undefined { + return this.get('defaultContentType'); + } + + set defaultContentType(defaultContentType: DefaultContentTypeElement | undefined) { + this.set('defaultContentType', defaultContentType); + } + + get channels(): ChannelsElement | undefined { + return this.get('channels'); + } + + set channels(channels: ChannelsElement | undefined) { + this.set('channels', channels); + } + + get operations(): OperationsElement | undefined { + return this.get('operations'); + } + + set operations(operations: OperationsElement | undefined) { + this.set('operations', operations); + } + + get components(): ComponentsElement | undefined { + return this.get('components'); + } + + set components(components: ComponentsElement | undefined) { + this.set('components', components); + } +} + +export default Schema; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts new file mode 100644 index 0000000000..b5385fbf17 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts @@ -0,0 +1,21 @@ +import { Attributes, Meta } from '@swagger-api/apidom-core'; +import { SecuritySchemeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import type { ArrayElement } from '@swagger-api/apidom-core'; + +class SecurityScheme extends SecuritySchemeElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'securityScheme'; + } + + get scopes(): ArrayElement | undefined { + return this.get('scopes'); + } + + set scopes(scopes: ArrayElement | undefined) { + this.set('scopes', scopes); + } + +} + +export default SecurityScheme; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts new file mode 100644 index 0000000000..1aaa807ea4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -0,0 +1,114 @@ +import { ArrayElement, Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; +import { ServerBindingsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import TagsElement from './Tags.ts'; +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import ReferenceElement from './Reference.ts'; + +/** + * @public + */ +class Server extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'server'; + } + + get host(): StringElement | undefined { + return this.get('host'); + } + + set host(host: StringElement | undefined) { + this.set('host', host); + } + + get protocol(): StringElement | undefined { + return this.get('protocol'); + } + + set protocol(protocol: StringElement | undefined) { + this.set('protocol', protocol); + } + + get protocolVersion(): StringElement | undefined { + return this.get('protocolVersion'); + } + + set protocolVersion(protocolVersion: StringElement | undefined) { + this.set('protocolVersion', protocolVersion); + } + + get pathName(): StringElement | undefined { + return this.get('pathName'); + } + + set pathName(pathName: StringElement | undefined) { + this.set('pathName', pathName); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(description: StringElement | undefined) { + this.set('description', description); + } + + get title(): StringElement | undefined { + return this.get('title'); + } + + set title(title: StringElement | undefined) { + this.set('title', title); + } + + get summary(): StringElement | undefined { + return this.get('summary'); + } + + set summary(summary: StringElement | undefined) { + this.set('summary', summary); + } + + get variables(): ObjectElement | undefined { + return this.get('variables'); + } + + set variables(variables: ObjectElement | undefined) { + this.set('variables', variables); + } + + get security(): ArrayElement | undefined { + return this.get('security'); + } + + set security(security: ArrayElement | undefined) { + this.set('security', security); + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } + + get bindings(): ServerBindingsElement | undefined { + return this.get('bindings'); + } + + set bindings(bindings: ServerBindingsElement | undefined) { + this.set('bindings', bindings); + } + +} + +export default Server; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts new file mode 100644 index 0000000000..ff258683f4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts @@ -0,0 +1,5 @@ +import { ServerBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; + +class ServerBindings extends ServerBindingsElement {} + +export default ServerBindings; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ServerVariable.ts b/packages/apidom-ns-asyncapi-3/src/elements/ServerVariable.ts new file mode 100644 index 0000000000..3379995832 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/ServerVariable.ts @@ -0,0 +1,8 @@ +import { ServerVariableElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class ServerVariable extends ServerVariableElement {} + +export default ServerVariable; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts new file mode 100644 index 0000000000..acc6b1aa92 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts @@ -0,0 +1,5 @@ +import { ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Servers extends ServerElement {} + +export default Servers; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts new file mode 100644 index 0000000000..3d9343475e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts @@ -0,0 +1,36 @@ +import { ObjectElement, Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import ReferenceElement from './Reference.ts'; + +class Tag extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'tag'; + } + + get name(): StringElement | undefined { + return this.get('name'); + } + + set name(name: StringElement | undefined) { + this.set('name', name); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(description: StringElement | undefined) { + this.set('description', description); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } +} + +export default Tag; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Tags.ts b/packages/apidom-ns-asyncapi-3/src/elements/Tags.ts new file mode 100644 index 0000000000..90bb1307e2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Tags.ts @@ -0,0 +1,8 @@ +import { TagsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class Tags extends TagsElement {} + +export default Tags; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/index.ts b/packages/apidom-ns-asyncapi-3/src/index.ts new file mode 100644 index 0000000000..ef1acea475 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/index.ts @@ -0,0 +1,7 @@ +export { default as mediaTypes, AsyncAPIMediaTypes } from './media-types.ts'; +export type { Format } from './media-types.ts'; + +// eslint-disable-next-line no-restricted-exports +export { default } from './namespace.ts'; + +// Re-exports and placeholders for predicates/refractor can be added as implementation progresses. diff --git a/packages/apidom-ns-asyncapi-3/src/media-types.ts b/packages/apidom-ns-asyncapi-3/src/media-types.ts new file mode 100644 index 0000000000..e72c915892 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/media-types.ts @@ -0,0 +1,44 @@ +import { last } from 'ramda'; +import { MediaTypes } from '@swagger-api/apidom-core'; + +export type Format = 'generic' | 'json' | 'yaml'; + +export class AsyncAPIMediaTypes extends MediaTypes { + filterByFormat(format: Format = 'generic') { + const effectiveFormat = format === 'generic' ? 'asyncapi;version' : format; + return this.filter((mediaType) => mediaType.includes(effectiveFormat)); + } + + findBy(version = '3.0.0', format: Format = 'generic') { + const search = + format === 'generic' + ? `vnd.asyncapi;version=${version}` + : `vnd.asyncapi+${format};version=${version}`; + const found = this.find((mediaType) => mediaType.includes(search)); + + return found || this.unknownMediaType; + } + + latest(format: Format = 'generic') { + return last(this.filterByFormat(format)) as string; + } +} + +const mediaTypes = new AsyncAPIMediaTypes( + // Official AsyncAPI v3 vendor media types + 'application/vnd.asyncapi;version=3.0.0', + 'application/vnd.asyncapi+json;version=3.0.0', + 'application/vnd.asyncapi+yaml;version=3.0.0', + 'application/vnd.asyncapi;version=3.0.1', + 'application/vnd.asyncapi+json;version=3.0.1', + 'application/vnd.asyncapi+yaml;version=3.0.1', + // Add legacy vendor prefix aliases similar to v2 to aid content negotiation + 'application/vnd.aai.asyncapi;version=3.0.0', + 'application/vnd.aai.asyncapi+json;version=3.0.0', + 'application/vnd.aai.asyncapi+yaml;version=3.0.0', + 'application/vnd.aai.asyncapi;version=3.0.1', + 'application/vnd.aai.asyncapi+json;version=3.0.1', + 'application/vnd.aai.asyncapi+yaml;version=3.0.1' +); + +export default mediaTypes; diff --git a/packages/apidom-ns-asyncapi-3/src/namespace.ts b/packages/apidom-ns-asyncapi-3/src/namespace.ts new file mode 100644 index 0000000000..80bb1368fe --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/namespace.ts @@ -0,0 +1,38 @@ +import { NamespacePluginOptions } from '@swagger-api/apidom-core'; + +import AsyncApi3Element from './elements/AsyncApi3.ts'; +import InfoElement from './elements/Info.ts'; +import ServersElement from './elements/Servers.ts'; +import ChannelsElement from './elements/Channels.ts'; +import ComponentsElement from './elements/Components.ts'; +import MessageElement from './elements/Message.ts'; +import TagElement from './elements/Tag.ts'; +import ExternalDocumentationElement from './elements/ExternalDocumentation.ts'; +import IdentifierElement from './elements/Identifier.ts'; +import SchemaElement from './elements/Schema.ts'; +import ReferenceElement from './elements/Reference.ts'; +import SecuritySchemeElement from './elements/SecurityScheme.ts'; + +const asyncApi3 = { + namespace: (options: NamespacePluginOptions) => { + const { base } = options; + + // Register top-level AsyncAPI 3 elements. Add more as implemented. + base.register('asyncApi3', AsyncApi3Element); + base.register('info', InfoElement); + base.register('servers', ServersElement); + base.register('channels', ChannelsElement); + base.register('components', ComponentsElement); + base.register('message', MessageElement); + base.register('tag', TagElement); + base.register('externalDocs', ExternalDocumentationElement); + base.register('identifier', IdentifierElement); + base.register('schema', SchemaElement); + base.register('reference', ReferenceElement); + base.register('securityScheme', SecuritySchemeElement); + + return base; + }, +}; + +export default asyncApi3; diff --git a/packages/apidom-ns-asyncapi-3/src/predicates.ts b/packages/apidom-ns-asyncapi-3/src/predicates.ts new file mode 100644 index 0000000000..4d4f9858c5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/predicates.ts @@ -0,0 +1,9 @@ +import { isElement } from '@swagger-api/apidom-core'; + +export const isAsyncApi3Element = (node: unknown) => isElement(node) && node.element === 'asyncApi3'; +export const isInfoElement = (node: unknown) => isElement(node) && node.element === 'info'; +export const isChannelsElement = (node: unknown) => isElement(node) && node.element === 'channels'; +export const isComponentsElement = (node: unknown) => isElement(node) && node.element === 'components'; +export const isMessageElement = (node: unknown) => isElement(node) && node.element === 'message'; + +export default {}; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/index.ts new file mode 100644 index 0000000000..565678aa17 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/index.ts @@ -0,0 +1,25 @@ +import { path } from 'ramda'; +import { + Element, + dereference, + refract as baseRefract, +} from '@swagger-api/apidom-core'; + +import specification from './specification.ts'; + +const refract = (value: unknown, { specPath = ['visitors','document','objects','AsyncApi','$visitor'], plugins = [], specificationObj = specification } = {}): T => { + const element = baseRefract(value); + const resolvedSpec = dereference(specificationObj); + + const RootVisitorClass = path(specPath, resolvedSpec) as any; + const rootVisitor = new RootVisitorClass({ specObj: resolvedSpec }); + + // Our visitor implementations currently expect direct invocation on ApiDOM elements + // (they manually call child visitors). Call enter() directly to populate rootVisitor.element. + rootVisitor.enter(element); + + // Return the populated element directly (skip plugin dispatch for now). + return rootVisitor.element as unknown as T; +}; + +export default refract; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts new file mode 100644 index 0000000000..6ea4e9a1f5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts @@ -0,0 +1,9 @@ +export const isReferenceObject = (node: any) => { + if (!node || typeof node !== 'object') return false; + // ApiDOM value may expose $ref directly + return typeof node.$ref === 'string' || (typeof node.get === 'function' && node.get('$ref')); +}; + +export default { + isReferenceObject, +}; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts new file mode 100644 index 0000000000..23cd59e704 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -0,0 +1,133 @@ +import FallbackVisitor from './visitors/FallbackVisitor.ts'; + +import AsyncApi3Visitor from './visitors/AsyncApi3Visitor.ts'; +import InfoVisitor from './visitors/info/InfoVisitor.ts'; +import ChannelsVisitor from './visitors/channels/ChannelsVisitor.ts'; +import ComponentsVisitor from './visitors/components/ComponentsVisitor.ts'; +import SecuritySchemesVisitor from './visitors/SecuritySchemesVisitor.ts'; +import MessageVisitor from './visitors/message/MessageVisitor.ts'; +import ServerVisitor from './visitors/server/ServerVisitor.ts'; +import ServerVariableVisitor from './visitors/server/ServerVariableVisitor.ts'; +import ParametersVisitor from './visitors/ParametersVisitor.ts'; +import BindingsVisitor from './visitors/BindingsVisitor.ts'; +import TagsVisitor from './visitors/TagsVisitor.ts'; +import ExternalDocumentationVisitor from './visitors/ExternalDocumentationVisitor.ts'; +import ChannelItemVisitor from './visitors/channel/ChanneVisitor.ts'; +import OperationVisitor from './visitors/operation/OperationVisitor.ts'; +import OperationMessageVisitor from './visitors/operation/OperationMessageVisitor.ts'; +import SchemaVisitor from './visitors/schema/SchemaVisitor.ts'; +import ReferenceVisitor from './visitors/reference/ReferenceVisitor.ts'; + +const specification = { + visitors: { + value: FallbackVisitor, + document: { + objects: { + AsyncApi: { + $visitor: AsyncApi3Visitor, + fixedFields: { + asyncapi: { $ref: '#/visitors/value' }, + id: { $ref: '#/visitors/value' }, + info: { $ref: '#/visitors/document/objects/Info' }, + servers: { $ref: '#/visitors/document/objects/Servers' }, + defaultContentType: { $ref: '#/visitors/value' }, + channels: { $ref: '#/visitors/document/objects/Channels' }, + components: { $ref: '#/visitors/document/objects/Components' }, + tags: { $ref: '#/visitors/document/objects/Tags' }, + externalDocs: { $ref: '#/visitors/document/objects/ExternalDocumentation' }, + }, + }, + Info: { + $visitor: InfoVisitor, + fixedFields: { + title: { $ref: '#/visitors/value' }, + version: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + }, + }, + Servers: { + $visitor: ServerVisitor, + fixedFields: { + // server entries are dynamic keys - handled by ChannelsVisitor/ServersVisitor in full impl + }, + }, + ServerVariable: { + $visitor: ServerVariableVisitor, + }, + Channels: { + $visitor: ChannelsVisitor, + }, + Tags: { + $visitor: TagsVisitor, + }, + ExternalDocumentation: { + $visitor: ExternalDocumentationVisitor, + }, + Parameters: { + $visitor: ParametersVisitor, + }, + Bindings: { + $visitor: BindingsVisitor, + }, + ChannelItem: { + $visitor: ChannelItemVisitor, + fixedFields: { + description: { $ref: '#/visitors/value' }, + subscribe: { $ref: '#/visitors/document/objects/Operation' }, + publish: { $ref: '#/visitors/document/objects/Operation' }, + parameters: { $ref: '#/visitors/document/objects/Parameters' }, + bindings: { $ref: '#/visitors/document/objects/Bindings' }, + }, + }, + Components: { + $visitor: ComponentsVisitor, + fixedFields: { + securitySchemes: { $ref: '#/visitors/document/objects/SecuritySchemes' }, + }, + }, + + SecuritySchemes: { + $visitor: SecuritySchemesVisitor, + }, + Operation: { + $visitor: OperationVisitor, + fixedFields: { + operationId: { $ref: '#/visitors/value' }, + summary: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + message: { $ref: '#/visitors/document/objects/OperationMessage' }, + tags: { $ref: '#/visitors/document/objects/Tags' }, + bindings: { $ref: '#/visitors/document/objects/Bindings' }, + }, + }, + OperationMessage: { + $visitor: OperationMessageVisitor, + }, + Message: { + $visitor: MessageVisitor, + fixedFields: { + payload: { $ref: '#/visitors/document/objects/Schema' }, + headers: { $ref: '#/visitors/document/objects/Schema' }, + examples: { $ref: '#/visitors/value' }, + }, + }, + Schema: { + $visitor: SchemaVisitor, + fixedFields: { + $ref: { $ref: '#/visitors/document/objects/Reference' }, + type: { $ref: '#/visitors/value' }, + properties: { $ref: '#/visitors/document/objects/Schema' }, + }, + }, + Reference: { + $visitor: ReferenceVisitor, + fixedFields: { + $ref: { $ref: '#/visitors/value' }, + }, + }, + }, + }, + }, +}; + +export default specification; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts b/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts new file mode 100644 index 0000000000..517865e16f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts @@ -0,0 +1,3 @@ +const createToolbox = () => ({ /* minimal toolbox placeholder */ }); + +export default createToolbox; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts new file mode 100644 index 0000000000..533b3e42f2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts @@ -0,0 +1,7 @@ +import Visitor from './Visitor.ts'; + +class AsyncApi3Visitor extends Visitor { + +} + +export default AsyncApi3Visitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts new file mode 100644 index 0000000000..ae46e84f6a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts @@ -0,0 +1,7 @@ +import Visitor from './Visitor.ts'; + +class BindingsVisitor extends Visitor { + +} + +export default BindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts new file mode 100644 index 0000000000..1b35acfac5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts @@ -0,0 +1,6 @@ +import Visitor from './Visitor.ts'; + +class ExternalDocumentationVisitor extends Visitor { +} + +export default ExternalDocumentationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts new file mode 100644 index 0000000000..e328615781 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts @@ -0,0 +1,11 @@ +import { Element, BREAK, cloneDeep } from '@swagger-api/apidom-core'; +import Visitor from './Visitor.ts'; + +class FallbackVisitor extends Visitor { + enter(element: Element) { + this.element = cloneDeep(element); + return BREAK; + } +} + +export default FallbackVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts new file mode 100644 index 0000000000..60699d4a9d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts @@ -0,0 +1,6 @@ +import Visitor from './Visitor.ts'; + +class ParametersVisitor extends Visitor { +} + +export default ParametersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts new file mode 100644 index 0000000000..69a0c9568e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts @@ -0,0 +1,6 @@ +import Visitor from './Visitor.ts'; + +class SecuritySchemesVisitor extends Visitor { +} + +export default SecuritySchemesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts new file mode 100644 index 0000000000..86d2b41fe4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts @@ -0,0 +1,7 @@ +import Visitor from './Visitor.ts'; + +class TagsVisitor extends Visitor { + +} + +export default TagsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts new file mode 100644 index 0000000000..d65f7622b8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts @@ -0,0 +1,18 @@ +import { Element } from '@swagger-api/apidom-core'; + +export type VisitorOptions = unknown; + +class Visitor { + element?: Element; + constructor(options?: VisitorOptions) { + // placeholder + } + enter(_node: unknown): void { + // default no-op + } + leave() { + return this.element; + } +} + +export default Visitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channel/ChanneVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channel/ChanneVisitor.ts new file mode 100644 index 0000000000..0fe78e4b08 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channel/ChanneVisitor.ts @@ -0,0 +1,12 @@ +import Visitor from '../Visitor.ts'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +class ChannelVisitor extends Visitor { + enter(node: any) { + const el = new ObjectElement(); + el.element = 'channelItem'; + this.element = el; + } +} + +export default ChannelVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts new file mode 100644 index 0000000000..c8dc280eea --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts @@ -0,0 +1,6 @@ +import Visitor from '../Visitor.ts'; + +class ChannelsVisitor extends Visitor { +} + +export default ChannelsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/components/ComponentsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/components/ComponentsVisitor.ts new file mode 100644 index 0000000000..777f5addd2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/components/ComponentsVisitor.ts @@ -0,0 +1,13 @@ +import Visitor from '../Visitor.ts'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +class ComponentsVisitor extends Visitor { + enter(node: any) { + const el = new ObjectElement(); + el.element = 'components'; + + this.element = el; + } +} + +export default ComponentsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/info/InfoVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/info/InfoVisitor.ts new file mode 100644 index 0000000000..df12d79147 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/info/InfoVisitor.ts @@ -0,0 +1,15 @@ +import Visitor from '../Visitor.ts'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +class InfoVisitor extends Visitor { + enter(node: any) { + const el = new ObjectElement(); + el.element = 'info'; + if (node.title) el.set('title', node.title); + if (node.version) el.set('version', node.version); + if (node.description) el.set('description', node.description); + this.element = el; + } +} + +export default InfoVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/message/MessageVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/message/MessageVisitor.ts new file mode 100644 index 0000000000..7b24273c31 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/message/MessageVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class MessageVisitor extends Visitor {} + +export default MessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts new file mode 100644 index 0000000000..a7e4dc7f3a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts @@ -0,0 +1,6 @@ +import Visitor from '../Visitor.ts'; + +class OperationMessageVisitor extends Visitor { +} + +export default OperationMessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationVisitor.ts new file mode 100644 index 0000000000..df92ce094b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class OperationVisitor extends Visitor {} + +export default OperationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/reference/ReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/reference/ReferenceVisitor.ts new file mode 100644 index 0000000000..d5f745ddb5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/reference/ReferenceVisitor.ts @@ -0,0 +1,13 @@ +import Visitor from '../Visitor.ts'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +class ReferenceVisitor extends Visitor { + enter(node: any) { + const el = new ObjectElement(); + el.element = 'reference'; + if (node.$ref) el.set('$ref', node.$ref); + this.element = el; + } +} + +export default ReferenceVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/schema/SchemaVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/schema/SchemaVisitor.ts new file mode 100644 index 0000000000..1de1620647 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/schema/SchemaVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class SchemaVisitor extends Visitor {} + +export default SchemaVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts new file mode 100644 index 0000000000..cbae2fa504 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + ServerVariableVisitor as ServerVariableVisitorType, + ServerVariableVisitorOptions, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServerVariableElement from '../../../elements/ServerVariable.ts'; + +/** + * @public + */ +export const BaseServerVariableVisitor: typeof ServerVariableVisitorType = + AsyncApi2Specification.visitors.document.objects.ServerVariable.$visitor; + +export type { ServerVariableVisitorOptions }; + +/** + * @public + */ +class ServerVariableVisitor extends BaseServerVariableVisitor { + declare public readonly element: ServerVariableElement; + + constructor(options: ServerVariableVisitorOptions) { + super(options); + this.element = new ServerVariableElement(); + } +} + +export default ServerVariableVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts new file mode 100644 index 0000000000..4c00a6e330 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts @@ -0,0 +1,26 @@ +import { + ServerVisitorOptions, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServerElement from '../../../elements/Server.ts'; +import Visitor from '../Visitor.ts'; + +/** + * @public + */ + +export type { ServerVisitorOptions }; + +/** + * @public + */ +class ServerVisitor extends Visitor { + declare public readonly element: ServerElement; + + constructor(options: ServerVisitorOptions) { + super(options); + this.element = new ServerElement(); + } +} + +export default ServerVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts new file mode 100644 index 0000000000..70a121b913 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + ServersVisitor as ServersVisitorType, + ServersVisitorOptions, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServersElement from '../../../elements/Servers.ts'; + +/** + * @public + */ +export const BaseServersVisitor: typeof ServersVisitorType = + AsyncApi2Specification.visitors.document.objects.Servers.$visitor; + +export type { ServersVisitorOptions }; + +/** + * @public + */ +class ServersVisitor extends BaseServersVisitor { + declare public readonly element: ServersElement; + + constructor(options: ServersVisitorOptions) { + super(options); + this.element = new ServersElement(); + } +} + +export default ServersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json b/packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json new file mode 100644 index 0000000000..6045ebc0a2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json @@ -0,0 +1,32 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Simple API", + "version": "1.0.0" + }, + "channels": { + "user/signedup": { + "publish": { + "message": { + "name": "UserSignedUp", + "payload": { + "type": "object", + "properties": { + "id": { "type": "string" } + } + } + } + } + } + }, + "components": { + "messages": { + "UserSignedUp": { + "name": "UserSignedUp", + "payload": { + "type": "object" + } + } + } + } +} diff --git a/packages/apidom-ns-asyncapi-3/test/index.ts b/packages/apidom-ns-asyncapi-3/test/index.ts new file mode 100644 index 0000000000..3eb594a04d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/index.ts @@ -0,0 +1,72 @@ +import { expect } from 'chai'; +import fs from 'fs'; +import path from 'path'; + +import refract from '../src/refractor/index.ts'; + +describe('apidom-ns-asyncapi-3 basic refractor', () => { + it('parses a simple asyncapi v3 fixture into elements', () => { + const __dirname = path.dirname(new URL(import.meta.url).pathname); + const fixturePath = path.join(__dirname, 'fixtures', 'simple-asyncapi-3.json'); + const fixture = JSON.parse(fs.readFileSync(fixturePath, 'utf8')); + + const element = refract(fixture as unknown); + + + expect(element).to.exist; + expect(element.element).to.equal('asyncApi3'); + + // channels.user/signedup.publish.message should be a message element + const channels = typeof element.get === 'function' ? element.get('channels') : undefined; + expect(channels).to.exist; + // robust lookup: iterate members to find key 'user/signedup' + let channel: any = undefined; + if (channels && typeof channels.content !== 'undefined') { + Object.values((channels as any).content || {}).forEach((m: any) => { + if (!m) return; + // member may be a wrapper without .get; try _storedElement or content + if (typeof m.get === 'function') { + const keyEl = m.get('key'); + if (keyEl && typeof (keyEl as any).toValue === 'function' && (keyEl as any).toValue() === 'user/signedup') { + channel = m.get('value'); + } + } else if (m && m._storedElement && m._storedElement.content && m._storedElement.content[0] !== undefined) { + const keyCandidate = m._storedElement.content[0]; + const valCandidate = m._storedElement.content[1]; + let keyStrCandidate: any = undefined; + if (typeof keyCandidate === 'string') keyStrCandidate = keyCandidate; + else if (keyCandidate && typeof keyCandidate.toValue === 'function') keyStrCandidate = keyCandidate.toValue(); + else if (keyCandidate && keyCandidate.value !== undefined) keyStrCandidate = keyCandidate.value; + else if (keyCandidate && keyCandidate._content !== undefined) keyStrCandidate = keyCandidate._content; + else if (keyCandidate && keyCandidate.content !== undefined) keyStrCandidate = keyCandidate.content; + + if (keyStrCandidate === 'user/signedup') { + channel = valCandidate; + } + } + }); + } + expect(channel).to.exist; + expect(channel).to.exist; + const publish = channel && typeof channel.get === 'function' ? channel.get('publish') : undefined; + expect(publish).to.exist; + const message = publish && typeof publish.get === 'function' ? publish.get('message') : undefined; + expect(message).to.exist; + expect(message.element).to.equal('message'); + const payload = message && typeof message.get === 'function' ? message.get('payload') : undefined; + expect(payload).to.exist; + expect(payload.element).to.equal('schema'); + + // components.messages.UserSignedUp should be a message element with payload schema + const components = typeof element.get === 'function' ? element.get('components') : undefined; + expect(components).to.exist; + const messages = components && typeof components.get === 'function' ? components.get('messages') : undefined; + expect(messages).to.exist; + const userMsg = messages && typeof messages.get === 'function' ? messages.get('UserSignedUp') : undefined; + expect(userMsg).to.exist; + expect(userMsg.element).to.equal('message'); + const userPayload = userMsg && typeof userMsg.get === 'function' ? userMsg.get('payload') : undefined; + expect(userPayload).to.exist; + expect(userPayload.element).to.equal('schema'); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/tsconfig.json b/packages/apidom-ns-asyncapi-3/tsconfig.json new file mode 100644 index 0000000000..e5a2034254 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "lib", + "composite": false + }, + "include": ["src/**/*.ts", "test/**/*.ts"] +} diff --git a/packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts b/packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts new file mode 100644 index 0000000000..50c7fd8170 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts @@ -0,0 +1,2 @@ +// Type declarations placeholder for apidom-ns-asyncapi-3 +export {}; From f4da8c841f738aaeaa80ebeb3c70c31ef50b4be0 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Mon, 20 Oct 2025 10:07:51 +0200 Subject: [PATCH 02/27] feat: async v3 refractor specification --- .../apidom-ns-asyncapi-3/src/refractor/specification.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 23cd59e704..4dc84e2799 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -1,5 +1,4 @@ import FallbackVisitor from './visitors/FallbackVisitor.ts'; - import AsyncApi3Visitor from './visitors/AsyncApi3Visitor.ts'; import InfoVisitor from './visitors/info/InfoVisitor.ts'; import ChannelsVisitor from './visitors/channels/ChannelsVisitor.ts'; @@ -23,6 +22,9 @@ const specification = { value: FallbackVisitor, document: { objects: { + /** + * `AsyncApi 3.0.0` specification elements. + */ AsyncApi: { $visitor: AsyncApi3Visitor, fixedFields: { @@ -32,9 +34,8 @@ const specification = { servers: { $ref: '#/visitors/document/objects/Servers' }, defaultContentType: { $ref: '#/visitors/value' }, channels: { $ref: '#/visitors/document/objects/Channels' }, + operations: { $ref: '#/visitors/document/objects/Operation' }, components: { $ref: '#/visitors/document/objects/Components' }, - tags: { $ref: '#/visitors/document/objects/Tags' }, - externalDocs: { $ref: '#/visitors/document/objects/ExternalDocumentation' }, }, }, Info: { From 35a3a8be2406e0412e3162814e55f747841ad5e0 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Mon, 20 Oct 2025 10:33:56 +0200 Subject: [PATCH 03/27] feat(ls): async v3 refractor specification --- .../src/refractor/specification.ts | 34 +++++++++---------- .../refractor/visitors/AsyncApi3Visitor.ts | 7 ---- .../src/refractor/visitors/BindingsVisitor.ts | 7 ---- .../visitors/ExternalDocumentationVisitor.ts | 6 ---- .../refractor/visitors/ParametersVisitor.ts | 6 ---- .../visitors/SecuritySchemesVisitor.ts | 6 ---- .../src/refractor/visitors/TagsVisitor.ts | 7 ---- .../visitors/async-api-3/AsyncApi3Visitor.ts | 5 +++ .../visitors/async-api-3/BindingsVisitor.ts | 5 +++ .../ExternalDocumentationVisitor.ts | 5 +++ .../visitors/async-api-3/ParametersVisitor.ts | 5 +++ .../async-api-3/SecuritySchemesVisitor.ts | 5 +++ .../visitors/async-api-3/TagsVisitor.ts | 5 +++ .../channel/ChanneVisitor.ts | 3 +- .../async-api-3/channels/ChannelsVisitor.ts | 5 +++ .../components/ComponentsVisitor.ts | 3 +- .../{ => async-api-3}/info/InfoVisitor.ts | 3 +- .../message/MessageVisitor.ts | 2 +- .../operation/OperationMessageVisitor.ts | 5 +++ .../operation/OperationVisitor.ts | 2 +- .../reference/ReferenceVisitor.ts | 3 +- .../{ => async-api-3}/schema/SchemaVisitor.ts | 2 +- .../server/ServerVariableVisitor.ts | 29 ++++++++++++++++ .../async-api-3/server/ServerVisitor.ts | 24 +++++++++++++ .../async-api-3/server/ServersVisitor.ts | 29 ++++++++++++++++ .../visitors/channels/ChannelsVisitor.ts | 6 ---- .../operation/OperationMessageVisitor.ts | 6 ---- .../visitors/server/ServerVariableVisitor.ts | 29 ---------------- .../visitors/server/ServerVisitor.ts | 26 -------------- .../visitors/server/ServersVisitor.ts | 29 ---------------- 30 files changed, 150 insertions(+), 159 deletions(-) delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/{ => async-api-3}/channel/ChanneVisitor.ts (85%) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/{ => async-api-3}/components/ComponentsVisitor.ts (86%) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/{ => async-api-3}/info/InfoVisitor.ts (90%) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/{ => async-api-3}/message/MessageVisitor.ts (64%) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/{ => async-api-3}/operation/OperationVisitor.ts (65%) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/{ => async-api-3}/reference/ReferenceVisitor.ts (87%) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/{ => async-api-3}/schema/SchemaVisitor.ts (63%) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVariableVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServersVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 4dc84e2799..9070c40168 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -1,21 +1,21 @@ import FallbackVisitor from './visitors/FallbackVisitor.ts'; -import AsyncApi3Visitor from './visitors/AsyncApi3Visitor.ts'; -import InfoVisitor from './visitors/info/InfoVisitor.ts'; -import ChannelsVisitor from './visitors/channels/ChannelsVisitor.ts'; -import ComponentsVisitor from './visitors/components/ComponentsVisitor.ts'; -import SecuritySchemesVisitor from './visitors/SecuritySchemesVisitor.ts'; -import MessageVisitor from './visitors/message/MessageVisitor.ts'; -import ServerVisitor from './visitors/server/ServerVisitor.ts'; -import ServerVariableVisitor from './visitors/server/ServerVariableVisitor.ts'; -import ParametersVisitor from './visitors/ParametersVisitor.ts'; -import BindingsVisitor from './visitors/BindingsVisitor.ts'; -import TagsVisitor from './visitors/TagsVisitor.ts'; -import ExternalDocumentationVisitor from './visitors/ExternalDocumentationVisitor.ts'; -import ChannelItemVisitor from './visitors/channel/ChanneVisitor.ts'; -import OperationVisitor from './visitors/operation/OperationVisitor.ts'; -import OperationMessageVisitor from './visitors/operation/OperationMessageVisitor.ts'; -import SchemaVisitor from './visitors/schema/SchemaVisitor.ts'; -import ReferenceVisitor from './visitors/reference/ReferenceVisitor.ts'; +import AsyncApi3Visitor from './visitors/async-api-3/AsyncApi3Visitor.ts'; +import InfoVisitor from './visitors/async-api-3/info/InfoVisitor.ts'; +import ChannelsVisitor from './visitors/async-api-3/channels/ChannelsVisitor.ts'; +import ComponentsVisitor from './visitors/async-api-3/components/ComponentsVisitor.ts'; +import SecuritySchemesVisitor from './visitors/async-api-3/SecuritySchemesVisitor.ts'; +import MessageVisitor from './visitors/async-api-3/message/MessageVisitor.ts'; +import ServerVisitor from './visitors/async-api-3/server/ServerVisitor.ts'; +import ServerVariableVisitor from './visitors/async-api-3/server/ServerVariableVisitor.ts'; +import ParametersVisitor from './visitors/async-api-3/ParametersVisitor.ts'; +import BindingsVisitor from './visitors/async-api-3/BindingsVisitor.ts'; +import TagsVisitor from './visitors/async-api-3/TagsVisitor.ts'; +import ExternalDocumentationVisitor from './visitors/async-api-3/ExternalDocumentationVisitor.ts'; +import ChannelItemVisitor from './visitors/async-api-3/channel/ChanneVisitor.ts'; +import OperationVisitor from './visitors/async-api-3/operation/OperationVisitor.ts'; +import OperationMessageVisitor from './visitors/async-api-3/operation/OperationMessageVisitor.ts'; +import SchemaVisitor from './visitors/async-api-3/schema/SchemaVisitor.ts'; +import ReferenceVisitor from './visitors/async-api-3/reference/ReferenceVisitor.ts'; const specification = { visitors: { diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts deleted file mode 100644 index 533b3e42f2..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/AsyncApi3Visitor.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Visitor from './Visitor.ts'; - -class AsyncApi3Visitor extends Visitor { - -} - -export default AsyncApi3Visitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts deleted file mode 100644 index ae46e84f6a..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/BindingsVisitor.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Visitor from './Visitor.ts'; - -class BindingsVisitor extends Visitor { - -} - -export default BindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts deleted file mode 100644 index 1b35acfac5..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ExternalDocumentationVisitor.ts +++ /dev/null @@ -1,6 +0,0 @@ -import Visitor from './Visitor.ts'; - -class ExternalDocumentationVisitor extends Visitor { -} - -export default ExternalDocumentationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts deleted file mode 100644 index 60699d4a9d..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/ParametersVisitor.ts +++ /dev/null @@ -1,6 +0,0 @@ -import Visitor from './Visitor.ts'; - -class ParametersVisitor extends Visitor { -} - -export default ParametersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts deleted file mode 100644 index 69a0c9568e..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SecuritySchemesVisitor.ts +++ /dev/null @@ -1,6 +0,0 @@ -import Visitor from './Visitor.ts'; - -class SecuritySchemesVisitor extends Visitor { -} - -export default SecuritySchemesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts deleted file mode 100644 index 86d2b41fe4..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/TagsVisitor.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Visitor from './Visitor.ts'; - -class TagsVisitor extends Visitor { - -} - -export default TagsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts new file mode 100644 index 0000000000..8521a25a8b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class AsyncApi3Visitor extends Visitor {} + +export default AsyncApi3Visitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts new file mode 100644 index 0000000000..57d1c26b0b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class BindingsVisitor extends Visitor {} + +export default BindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts new file mode 100644 index 0000000000..b85179f82c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class ExternalDocumentationVisitor extends Visitor {} + +export default ExternalDocumentationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts new file mode 100644 index 0000000000..4e75273079 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class ParametersVisitor extends Visitor {} + +export default ParametersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts new file mode 100644 index 0000000000..3277f9e6f3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class SecuritySchemesVisitor extends Visitor {} + +export default SecuritySchemesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts new file mode 100644 index 0000000000..321dee9d66 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../Visitor.ts'; + +class TagsVisitor extends Visitor {} + +export default TagsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channel/ChanneVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ChanneVisitor.ts similarity index 85% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/channel/ChanneVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ChanneVisitor.ts index 0fe78e4b08..51fd601ad1 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channel/ChanneVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ChanneVisitor.ts @@ -1,6 +1,7 @@ -import Visitor from '../Visitor.ts'; import { ObjectElement } from '@swagger-api/apidom-core'; +import Visitor from '../../Visitor.ts'; + class ChannelVisitor extends Visitor { enter(node: any) { const el = new ObjectElement(); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts new file mode 100644 index 0000000000..5d65ef270c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../../Visitor.ts'; + +class ChannelsVisitor extends Visitor {} + +export default ChannelsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/components/ComponentsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ComponentsVisitor.ts similarity index 86% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/components/ComponentsVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ComponentsVisitor.ts index 777f5addd2..771fbe3678 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/components/ComponentsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ComponentsVisitor.ts @@ -1,6 +1,7 @@ -import Visitor from '../Visitor.ts'; import { ObjectElement } from '@swagger-api/apidom-core'; +import Visitor from '../../Visitor.ts'; + class ComponentsVisitor extends Visitor { enter(node: any) { const el = new ObjectElement(); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/info/InfoVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/InfoVisitor.ts similarity index 90% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/info/InfoVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/InfoVisitor.ts index df12d79147..b33315bdcf 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/info/InfoVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/InfoVisitor.ts @@ -1,6 +1,7 @@ -import Visitor from '../Visitor.ts'; import { ObjectElement } from '@swagger-api/apidom-core'; +import Visitor from '../../Visitor.ts'; + class InfoVisitor extends Visitor { enter(node: any) { const el = new ObjectElement(); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/message/MessageVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/MessageVisitor.ts similarity index 64% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/message/MessageVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/MessageVisitor.ts index 7b24273c31..436a23d9cf 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/message/MessageVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/MessageVisitor.ts @@ -1,4 +1,4 @@ -import Visitor from '../Visitor.ts'; +import Visitor from '../../Visitor.ts'; class MessageVisitor extends Visitor {} diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts new file mode 100644 index 0000000000..d1d49af113 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts @@ -0,0 +1,5 @@ +import Visitor from '../../Visitor.ts'; + +class OperationMessageVisitor extends Visitor {} + +export default OperationMessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts similarity index 65% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts index df92ce094b..e8b3292f2b 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts @@ -1,4 +1,4 @@ -import Visitor from '../Visitor.ts'; +import Visitor from '../../Visitor.ts'; class OperationVisitor extends Visitor {} diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/reference/ReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/ReferenceVisitor.ts similarity index 87% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/reference/ReferenceVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/ReferenceVisitor.ts index d5f745ddb5..794572b8d4 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/reference/ReferenceVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/ReferenceVisitor.ts @@ -1,6 +1,7 @@ -import Visitor from '../Visitor.ts'; import { ObjectElement } from '@swagger-api/apidom-core'; +import Visitor from '../../Visitor.ts'; + class ReferenceVisitor extends Visitor { enter(node: any) { const el = new ObjectElement(); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/schema/SchemaVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaVisitor.ts similarity index 63% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/schema/SchemaVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaVisitor.ts index 1de1620647..b99bafb167 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/schema/SchemaVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaVisitor.ts @@ -1,4 +1,4 @@ -import Visitor from '../Visitor.ts'; +import Visitor from '../../Visitor.ts'; class SchemaVisitor extends Visitor {} diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVariableVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVariableVisitor.ts new file mode 100644 index 0000000000..5c0fb2302d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVariableVisitor.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + ServerVariableVisitor as ServerVariableVisitorType, + ServerVariableVisitorOptions, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServerVariableElement from '../../../../elements/ServerVariable.ts'; + +/** + * @public + */ +export const BaseServerVariableVisitor: typeof ServerVariableVisitorType = + AsyncApi2Specification.visitors.document.objects.ServerVariable.$visitor; + +export type { ServerVariableVisitorOptions }; + +/** + * @public + */ +class ServerVariableVisitor extends BaseServerVariableVisitor { + declare public readonly element: ServerVariableElement; + + constructor(options: ServerVariableVisitorOptions) { + super(options); + this.element = new ServerVariableElement(); + } +} + +export default ServerVariableVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts new file mode 100644 index 0000000000..8404acc293 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts @@ -0,0 +1,24 @@ +import { ServerVisitorOptions } from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServerElement from '../../../../elements/Server.ts'; +import Visitor from '../../Visitor.ts'; + +/** + * @public + */ + +export type { ServerVisitorOptions }; + +/** + * @public + */ +class ServerVisitor extends Visitor { + declare public readonly element: ServerElement; + + constructor(options: ServerVisitorOptions) { + super(options); + this.element = new ServerElement(); + } +} + +export default ServerVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServersVisitor.ts new file mode 100644 index 0000000000..aef1aab6ef --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServersVisitor.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + ServersVisitor as ServersVisitorType, + ServersVisitorOptions, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServersElement from '../../../../elements/Servers.ts'; + +/** + * @public + */ +export const BaseServersVisitor: typeof ServersVisitorType = + AsyncApi2Specification.visitors.document.objects.Servers.$visitor; + +export type { ServersVisitorOptions }; + +/** + * @public + */ +class ServersVisitor extends BaseServersVisitor { + declare public readonly element: ServersElement; + + constructor(options: ServersVisitorOptions) { + super(options); + this.element = new ServersElement(); + } +} + +export default ServersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts deleted file mode 100644 index c8dc280eea..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/channels/ChannelsVisitor.ts +++ /dev/null @@ -1,6 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class ChannelsVisitor extends Visitor { -} - -export default ChannelsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts deleted file mode 100644 index a7e4dc7f3a..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationMessageVisitor.ts +++ /dev/null @@ -1,6 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class OperationMessageVisitor extends Visitor { -} - -export default OperationMessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts deleted file mode 100644 index cbae2fa504..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVariableVisitor.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - specificationObj as AsyncApi2Specification, - ServerVariableVisitor as ServerVariableVisitorType, - ServerVariableVisitorOptions, -} from '@swagger-api/apidom-ns-asyncapi-2'; - -import ServerVariableElement from '../../../elements/ServerVariable.ts'; - -/** - * @public - */ -export const BaseServerVariableVisitor: typeof ServerVariableVisitorType = - AsyncApi2Specification.visitors.document.objects.ServerVariable.$visitor; - -export type { ServerVariableVisitorOptions }; - -/** - * @public - */ -class ServerVariableVisitor extends BaseServerVariableVisitor { - declare public readonly element: ServerVariableElement; - - constructor(options: ServerVariableVisitorOptions) { - super(options); - this.element = new ServerVariableElement(); - } -} - -export default ServerVariableVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts deleted file mode 100644 index 4c00a6e330..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServerVisitor.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - ServerVisitorOptions, -} from '@swagger-api/apidom-ns-asyncapi-2'; - -import ServerElement from '../../../elements/Server.ts'; -import Visitor from '../Visitor.ts'; - -/** - * @public - */ - -export type { ServerVisitorOptions }; - -/** - * @public - */ -class ServerVisitor extends Visitor { - declare public readonly element: ServerElement; - - constructor(options: ServerVisitorOptions) { - super(options); - this.element = new ServerElement(); - } -} - -export default ServerVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts deleted file mode 100644 index 70a121b913..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/server/ServersVisitor.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - specificationObj as AsyncApi2Specification, - ServersVisitor as ServersVisitorType, - ServersVisitorOptions, -} from '@swagger-api/apidom-ns-asyncapi-2'; - -import ServersElement from '../../../elements/Servers.ts'; - -/** - * @public - */ -export const BaseServersVisitor: typeof ServersVisitorType = - AsyncApi2Specification.visitors.document.objects.Servers.$visitor; - -export type { ServersVisitorOptions }; - -/** - * @public - */ -class ServersVisitor extends BaseServersVisitor { - declare public readonly element: ServersElement; - - constructor(options: ServersVisitorOptions) { - super(options); - this.element = new ServersElement(); - } -} - -export default ServersVisitor; From e058a6f5ce5ce922d00c9df01cc250956b579829 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Mon, 20 Oct 2025 12:26:21 +0200 Subject: [PATCH 04/27] feat: async v3 refractor specification --- packages/apidom-ns-asyncapi-3/.gitignore | 7 ++ packages/apidom-ns-asyncapi-3/package.json | 5 +- .../apidom-ns-asyncapi-3/src/predicates.ts | 6 +- .../src/refractor/predicates.ts | 10 ++ .../src/refractor/specification.ts | 8 ++ .../src/refractor/visitors/FallbackVisitor.ts | 14 ++- .../visitors/SpecificationExtensionVisitor.ts | 21 ++++ .../visitors/SpecificationVisitor.ts | 79 +++++++++++++++ .../src/refractor/visitors/Visitor.ts | 36 +++++-- .../async-api-3/AsyncApiVersionVisitor.ts | 31 ++++++ .../visitors/async-api-3/IdentifierVisitor.ts | 31 ++++++ .../visitors/generics/AlternatingVisitor.ts | 43 ++++++++ .../visitors/generics/FixedFieldsVisitor.ts | 97 +++++++++++++++++++ .../refractor/visitors/generics/MapVisitor.ts | 25 +++++ .../visitors/generics/MixedFieldsVisitor.ts | 61 ++++++++++++ .../generics/PatternedFieldsVisitor.ts | 97 +++++++++++++++++++ .../tsconfig.declaration.json | 9 ++ packages/apidom-ns-asyncapi-3/tsconfig.json | 9 +- .../types/apidom-ns-asyncapi-3.d.ts | 2 - 19 files changed, 568 insertions(+), 23 deletions(-) create mode 100644 packages/apidom-ns-asyncapi-3/.gitignore create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationExtensionVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApiVersionVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/IdentifierVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/AlternatingVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/FixedFieldsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MapVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MixedFieldsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/PatternedFieldsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/tsconfig.declaration.json delete mode 100644 packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts diff --git a/packages/apidom-ns-asyncapi-3/.gitignore b/packages/apidom-ns-asyncapi-3/.gitignore new file mode 100644 index 0000000000..71324b84ee --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/.gitignore @@ -0,0 +1,7 @@ +/src/**/*.mjs +/src/**/*.cjs +/test/**/*.mjs +/dist +/types +/NOTICE +/swagger-api-apidom-ns-asyncapi-3-*.tgz diff --git a/packages/apidom-ns-asyncapi-3/package.json b/packages/apidom-ns-asyncapi-3/package.json index fcf172f50a..1964188b74 100644 --- a/packages/apidom-ns-asyncapi-3/package.json +++ b/packages/apidom-ns-asyncapi-3/package.json @@ -16,13 +16,14 @@ }, "types": "./types/apidom-ns-asyncapi-3.d.ts", "scripts": { - "build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs", + "build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser", "build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'", "build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'", + "build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress", "lint": "eslint ./", "lint:fix": "eslint ./ --fix", "clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types", - "test": "NODE_ENV=test ts-mocha --project tsconfig.json --exit \"test/**/*.ts\"", + "test": "NODE_ENV=test ts-mocha --project tsconfig.json --exit \"test/**/*.ts\"", "typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json 2>&1 | shx grep -v 'Visitor_base'" }, "repository": { diff --git a/packages/apidom-ns-asyncapi-3/src/predicates.ts b/packages/apidom-ns-asyncapi-3/src/predicates.ts index 4d4f9858c5..385a7448b5 100644 --- a/packages/apidom-ns-asyncapi-3/src/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/predicates.ts @@ -1,9 +1,11 @@ import { isElement } from '@swagger-api/apidom-core'; -export const isAsyncApi3Element = (node: unknown) => isElement(node) && node.element === 'asyncApi3'; +export const isAsyncApi3Element = (node: unknown) => + isElement(node) && node.element === 'asyncApi3'; export const isInfoElement = (node: unknown) => isElement(node) && node.element === 'info'; export const isChannelsElement = (node: unknown) => isElement(node) && node.element === 'channels'; -export const isComponentsElement = (node: unknown) => isElement(node) && node.element === 'components'; +export const isComponentsElement = (node: unknown) => + isElement(node) && node.element === 'components'; export const isMessageElement = (node: unknown) => isElement(node) && node.element === 'message'; export default {}; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts index 6ea4e9a1f5..2a55d049f2 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts @@ -1,9 +1,19 @@ +import { startsWith } from 'ramda'; +import { MemberElement, isStringElement, toValue } from '@swagger-api/apidom-core'; + export const isReferenceObject = (node: any) => { if (!node || typeof node !== 'object') return false; // ApiDOM value may expose $ref directly return typeof node.$ref === 'string' || (typeof node.get === 'function' && node.get('$ref')); }; +/** + * @public + */ +export const isAsyncApiExtension = (element: MemberElement): boolean => { + return isStringElement(element.key) && startsWith('x-', toValue(element.key)); +}; + export default { isReferenceObject, }; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 9070c40168..07d7feedcf 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -1,5 +1,7 @@ import FallbackVisitor from './visitors/FallbackVisitor.ts'; import AsyncApi3Visitor from './visitors/async-api-3/AsyncApi3Visitor.ts'; +import AsyncApiVersionVisitor from './visitors/async-api-3/AsyncApiVersionVisitor.ts'; +import IdentifierVisitor from './visitors/async-api-3/IdentifierVisitor.ts'; import InfoVisitor from './visitors/async-api-3/info/InfoVisitor.ts'; import ChannelsVisitor from './visitors/async-api-3/channels/ChannelsVisitor.ts'; import ComponentsVisitor from './visitors/async-api-3/components/ComponentsVisitor.ts'; @@ -38,6 +40,12 @@ const specification = { components: { $ref: '#/visitors/document/objects/Components' }, }, }, + AsyncApiVersion: { + $visitor: AsyncApiVersionVisitor, + }, + Identifier: { + $visitor: IdentifierVisitor, + }, Info: { $visitor: InfoVisitor, fixedFields: { diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts index e328615781..1635895097 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts @@ -1,6 +1,18 @@ import { Element, BREAK, cloneDeep } from '@swagger-api/apidom-core'; -import Visitor from './Visitor.ts'; +import Visitor, { VisitorOptions } from './Visitor.ts'; + +/** + * This visitor is responsible for falling back to current traversed element. + * Given AsyncApi2Visitor expects ObjectElement to be traversed. If + * different Element is provided FallBackVisitor is responsible to assigning + * this Element as current element. + */ +export type { VisitorOptions as FallbackVisitorOptions }; + +/** + * @public + */ class FallbackVisitor extends Visitor { enter(element: Element) { this.element = cloneDeep(element); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationExtensionVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationExtensionVisitor.ts new file mode 100644 index 0000000000..c00bdefc09 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationExtensionVisitor.ts @@ -0,0 +1,21 @@ +import { MemberElement, BREAK, cloneDeep } from '@swagger-api/apidom-core'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from './SpecificationVisitor.ts'; + +export type { SpecificationVisitorOptions as SpecificationExtensionVisitorOptions }; + +/** + * @public + */ +class SpecificationExtensionVisitor extends SpecificationVisitor { + declare public element: MemberElement; + + MemberElement(memberElement: MemberElement) { + this.element = cloneDeep(memberElement); + this.element.classes.push('specification-extension'); + + return BREAK; + } +} + +export default SpecificationExtensionVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationVisitor.ts new file mode 100644 index 0000000000..950843b7bc --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/SpecificationVisitor.ts @@ -0,0 +1,79 @@ +import { pathSatisfies, path, pick } from 'ramda'; +import { isFunction } from 'ramda-adjunct'; +import { visit, cloneDeep } from '@swagger-api/apidom-core'; + +import Visitor, { VisitorOptions } from './Visitor.ts'; +import type specification from '../specification.ts'; +import FallbackVisitor from './FallbackVisitor.ts'; + +/** + * This is a base Type for every visitor that does + * internal look-ups to retrieve other child visitors. + * @public + */ +export interface SpecificationVisitorOptions extends VisitorOptions { + readonly specObj: typeof specification; +} + +/** + * @public + */ +class SpecificationVisitor extends Visitor { + protected readonly specObj: typeof specification; + + protected readonly passingOptionsNames: string[] = ['specObj']; + + constructor({ specObj, ...rest }: SpecificationVisitorOptions) { + super({ ...rest }); + this.specObj = specObj; + } + + retrievePassingOptions() { + return pick(this.passingOptionsNames as (keyof this)[], this) as unknown as string[]; + } + + retrieveFixedFields(specPath: string[]) { + const fixedFields = path(['visitors', ...specPath, 'fixedFields'], this.specObj); + if (typeof fixedFields === 'object' && fixedFields !== null) { + return Object.keys(fixedFields); + } + return []; + } + + retrieveVisitor(specPath: string[]) { + if (pathSatisfies(isFunction, ['visitors', ...specPath], this.specObj)) { + return path(['visitors', ...specPath], this.specObj); + } + + return path(['visitors', ...specPath, '$visitor'], this.specObj); + } + + retrieveVisitorInstance(specPath: string[], options = {}): Visitor { + const passingOpts = this.retrievePassingOptions(); + const VisitorClz = this.retrieveVisitor(specPath) as typeof Visitor; + const visitorOpts = { ...passingOpts, ...options }; + + return new VisitorClz(visitorOpts); + } + + toRefractedElement(specPath: string[], element: any, options = {}) { + /** + * This is `Visitor shortcut`: mechanism for short circuiting the traversal and replacing + * it by basic node cloning. + * + * Visiting the element is equivalent to cloning it if the prototype of a visitor + * is the same as the prototype of FallbackVisitor. If that's the case, we can avoid + * bootstrapping the traversal cycle for fields that don't require any special visiting. + */ + const visitor = this.retrieveVisitorInstance(specPath, options); + + if (visitor instanceof FallbackVisitor && visitor?.constructor === FallbackVisitor) { + return cloneDeep(element); + } + + visit(element, visitor, options); + return visitor.element; + } +} + +export default SpecificationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts index d65f7622b8..ad6c7c2450 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts @@ -1,18 +1,34 @@ -import { Element } from '@swagger-api/apidom-core'; +import { Element, ObjectElement, deepmerge, hasElementSourceMap } from '@swagger-api/apidom-core'; -export type VisitorOptions = unknown; +/** + * @public + */ +export interface VisitorOptions {} +/** + * @public + */ class Visitor { - element?: Element; - constructor(options?: VisitorOptions) { - // placeholder - } - enter(_node: unknown): void { - // default no-op + public element!: Element; + + constructor(options: VisitorOptions) { + Object.assign(this, options); } - leave() { - return this.element; + + /* eslint-disable class-methods-use-this, no-param-reassign */ + public copyMetaAndAttributes(from: Element, to: Element) { + if (from.meta.length > 0 || to.meta.length > 0) { + to.meta = deepmerge(to.meta, from.meta) as ObjectElement; + if (hasElementSourceMap(from)) { + // avoid deep merging of source maps + to.meta.set('sourceMap', from.meta.get('sourceMap')); + } + } + if (from.attributes.length > 0 || from.meta.length > 0) { + to.attributes = deepmerge(to.attributes, from.attributes) as ObjectElement; // eslint-disable-line no-param-reassign + } } + /* eslint-enable class-methods-use-this, no-param-reassign */ } export default Visitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApiVersionVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApiVersionVisitor.ts new file mode 100644 index 0000000000..1b5bfe460a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApiVersionVisitor.ts @@ -0,0 +1,31 @@ +import { Mixin } from 'ts-mixer'; +import { StringElement, BREAK, toValue } from '@swagger-api/apidom-core'; + +import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; +import AsyncApiVersionElement from '../../../elements/AsyncApiVersion.ts'; + +/** + * @public + */ +export interface AsyncApiVersionVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AsyncApiVersionVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public element: AsyncApiVersionElement; + + StringElement(stringElement: StringElement) { + const asyncApiVersionElement = new AsyncApiVersionElement(toValue(stringElement)); + + this.copyMetaAndAttributes(stringElement, asyncApiVersionElement); + + this.element = asyncApiVersionElement; + return BREAK; + } +} + +export default AsyncApiVersionVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/IdentifierVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/IdentifierVisitor.ts new file mode 100644 index 0000000000..22459c1f22 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/IdentifierVisitor.ts @@ -0,0 +1,31 @@ +import { Mixin } from 'ts-mixer'; +import { StringElement, BREAK, toValue } from '@swagger-api/apidom-core'; + +import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; +import IdentifierElement from '../../../elements/Identifier.ts'; + +/** + * @public + */ +export interface IdentifierVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class IdentifierVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public element: IdentifierElement; + + StringElement(stringElement: StringElement) { + const identifierElement = new IdentifierElement(toValue(stringElement)); + + this.copyMetaAndAttributes(stringElement, identifierElement); + + this.element = identifierElement; + return BREAK; + } +} + +export default IdentifierVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/AlternatingVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/AlternatingVisitor.ts new file mode 100644 index 0000000000..b0fc4d9c53 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/AlternatingVisitor.ts @@ -0,0 +1,43 @@ +import { ifElse, always } from 'ramda'; +import { dispatch, stubUndefined } from 'ramda-adjunct'; +import { Element, BREAK } from '@swagger-api/apidom-core'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; + +/** + * @public + */ +export type Alternator = { predicate: (element: unknown) => boolean; specPath: string[] }; + +/** + * @public + */ +export interface AlternatingVisitorOptions extends SpecificationVisitorOptions { + readonly alternator: Alternator[]; +} + +/** + * @public + */ +class AlternatingVisitor extends SpecificationVisitor { + protected alternator: Alternator[]; + + constructor({ alternator, ...rest }: AlternatingVisitorOptions) { + super({ ...rest }); + this.alternator = alternator; + } + + enter(element: Element) { + const functions = this.alternator.map( + ({ predicate, specPath }: { predicate: (element: unknown) => boolean; specPath: string[] }) => + ifElse(predicate, always(specPath), stubUndefined), + ); + const specPath = dispatch(functions)(element); + + this.element = this.toRefractedElement(specPath, element); + + return BREAK; + } +} + +export default AlternatingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/FixedFieldsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/FixedFieldsVisitor.ts new file mode 100644 index 0000000000..f28dbd146c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/FixedFieldsVisitor.ts @@ -0,0 +1,97 @@ +import { + BREAK, + isStringElement, + MemberElement, + Element, + cloneDeep, + toValue, + ObjectElement, +} from '@swagger-api/apidom-core'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; +import { isAsyncApiExtension } from '../../predicates.ts'; + +/** + * @public + */ +export type SpecPath = (element: unknown) => T; + +/** + * @public + */ +export interface FixedFieldsVisitorOptions extends SpecificationVisitorOptions { + readonly specPath: SpecPath; + readonly ignoredFields?: string[]; + readonly canSupportSpecificationExtensions?: boolean; + readonly specificationExtensionPredicate?: typeof isAsyncApiExtension; +} + +/** + * @public + */ +class FixedFieldsVisitor extends SpecificationVisitor { + protected specPath: SpecPath; + + protected ignoredFields: string[]; + + protected canSupportSpecificationExtensions: boolean = true; + + protected specificationExtensionPredicate = isAsyncApiExtension; + + constructor({ + specPath, + ignoredFields, + canSupportSpecificationExtensions, + specificationExtensionPredicate, + ...rest + }: FixedFieldsVisitorOptions) { + super({ ...rest }); + this.specPath = specPath; + this.ignoredFields = ignoredFields || []; + + if (typeof canSupportSpecificationExtensions === 'boolean') { + this.canSupportSpecificationExtensions = canSupportSpecificationExtensions; + } + + if (typeof specificationExtensionPredicate === 'function') { + this.specificationExtensionPredicate = specificationExtensionPredicate; + } + } + + ObjectElement(objectElement: ObjectElement) { + const specPath = this.specPath(objectElement); + const fields = this.retrieveFixedFields(specPath); + + // @ts-ignore + objectElement.forEach((value: Element, key: Element, memberElement: MemberElement) => { + if ( + isStringElement(key) && + fields.includes(toValue(key)) && + !this.ignoredFields.includes(toValue(key)) + ) { + const fixedFieldElement = this.toRefractedElement( + [...specPath, 'fixedFields', toValue(key)], + value, + ); + const newMemberElement = new MemberElement(cloneDeep(key), fixedFieldElement); + newMemberElement.classes.push('fixed-field'); + this.copyMetaAndAttributes(memberElement, newMemberElement); + this.element.content.push(newMemberElement); + } else if ( + this.canSupportSpecificationExtensions && + this.specificationExtensionPredicate(memberElement) + ) { + const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement); + this.element.content.push(extensionElement); + } else if (!this.ignoredFields.includes(toValue(key))) { + this.element.content.push(cloneDeep(memberElement)); + } + }); + + this.copyMetaAndAttributes(objectElement, this.element); + + return BREAK; + } +} + +export default FixedFieldsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MapVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MapVisitor.ts new file mode 100644 index 0000000000..def4e58f2e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MapVisitor.ts @@ -0,0 +1,25 @@ +import { isNonEmptyString } from 'ramda-adjunct'; + +import PatternedFieldsVisitor, { + PatternedFieldsVisitorOptions, + SpecPath, +} from './PatternedFieldsVisitor.ts'; + +export type { SpecPath }; + +/** + * @public + */ +export interface MapVisitorOptions extends PatternedFieldsVisitorOptions {} + +/** + * @public + */ +class MapVisitor extends PatternedFieldsVisitor { + constructor(options: MapVisitorOptions) { + super(options); + this.fieldPatternPredicate = isNonEmptyString; + } +} + +export default MapVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MixedFieldsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MixedFieldsVisitor.ts new file mode 100644 index 0000000000..23a9eb831d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/MixedFieldsVisitor.ts @@ -0,0 +1,61 @@ +import { Mixin } from 'ts-mixer'; +import { difference } from 'ramda'; +import { ObjectElement, BREAK } from '@swagger-api/apidom-core'; + +import FixedFieldsVisitor, { FixedFieldsVisitorOptions, SpecPath } from './FixedFieldsVisitor.ts'; +import PatternedFieldsVisitor, { PatternedFieldsVisitorOptions } from './PatternedFieldsVisitor.ts'; + +export type { SpecPath }; + +/** + * @public + */ +export interface MixedFieldsVisitorOptions + extends FixedFieldsVisitorOptions, + PatternedFieldsVisitorOptions { + readonly specPathFixedFields: SpecPath; + readonly specPathPatternedFields: SpecPath; +} + +/** + * @public + */ +class MixedFieldsVisitor extends Mixin(FixedFieldsVisitor, PatternedFieldsVisitor) { + protected specPathFixedFields: SpecPath; + + protected specPathPatternedFields: SpecPath; + + constructor({ + specPathFixedFields, + specPathPatternedFields, + ...rest + }: MixedFieldsVisitorOptions) { + super({ ...rest }); + this.specPathFixedFields = specPathFixedFields; + this.specPathPatternedFields = specPathPatternedFields; + } + + ObjectElement(objectElement: ObjectElement) { + const { specPath, ignoredFields } = this; + + try { + this.specPath = this.specPathFixedFields; + const fixedFields = this.retrieveFixedFields(this.specPath(objectElement)); + // let FixedFieldsVisitor only process fixed fields and leave rest to PatternedFieldsVisitor + // @ts-ignore + this.ignoredFields = [...ignoredFields, ...difference(objectElement.keys(), fixedFields)]; + FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + this.specPath = this.specPathPatternedFields; + this.ignoredFields = fixedFields; + PatternedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + } catch (e) { + this.specPath = specPath; + throw e; + } + + return BREAK; + } +} + +export default MixedFieldsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/PatternedFieldsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/PatternedFieldsVisitor.ts new file mode 100644 index 0000000000..8ed1f57ac4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/PatternedFieldsVisitor.ts @@ -0,0 +1,97 @@ +import { F as stubFalse } from 'ramda'; +import { + ObjectElement, + Element, + MemberElement, + BREAK, + cloneDeep, + toValue, +} from '@swagger-api/apidom-core'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; +import { SpecPath } from './FixedFieldsVisitor.ts'; +import { isAsyncApiExtension } from '../../predicates.ts'; + +export type { SpecPath }; + +/** + * @public + */ +export interface PatternedFieldsVisitorOptions extends SpecificationVisitorOptions { + readonly specPath: SpecPath; + readonly ignoredFields?: string[]; + readonly fieldPatternPredicate?: (...args: unknown[]) => boolean; + readonly canSupportSpecificationExtensions?: boolean; + readonly specificationExtensionPredicate?: typeof isAsyncApiExtension; +} + +/** + * @public + */ +class PatternedFieldsVisitor extends SpecificationVisitor { + protected specPath: SpecPath; + + protected ignoredFields: string[]; + + protected fieldPatternPredicate: (value: unknown) => boolean = stubFalse; + + protected canSupportSpecificationExtensions: boolean = false; + + protected specificationExtensionPredicate = isAsyncApiExtension; + + constructor({ + specPath, + ignoredFields, + fieldPatternPredicate, + canSupportSpecificationExtensions, + specificationExtensionPredicate, + ...rest + }: PatternedFieldsVisitorOptions) { + super({ ...rest }); + this.specPath = specPath; + this.ignoredFields = ignoredFields || []; + + if (typeof fieldPatternPredicate === 'function') { + this.fieldPatternPredicate = fieldPatternPredicate; + } + + if (typeof canSupportSpecificationExtensions === 'boolean') { + this.canSupportSpecificationExtensions = canSupportSpecificationExtensions; + } + + if (typeof specificationExtensionPredicate === 'function') { + this.specificationExtensionPredicate = specificationExtensionPredicate; + } + } + + ObjectElement(objectElement: ObjectElement) { + // @ts-ignore + objectElement.forEach((value: Element, key: Element, memberElement: MemberElement) => { + if ( + this.canSupportSpecificationExtensions && + this.specificationExtensionPredicate(memberElement) + ) { + const extensionElement = this.toRefractedElement(['document', 'extension'], memberElement); + this.element.content.push(extensionElement); + } else if ( + !this.ignoredFields.includes(toValue(key)) && + this.fieldPatternPredicate(toValue(key)) + ) { + const specPath = this.specPath(value); + const patternedFieldElement = this.toRefractedElement(specPath, value); + const newMemberElement = new MemberElement(cloneDeep(key), patternedFieldElement); + this.copyMetaAndAttributes(memberElement, newMemberElement); + newMemberElement.classes.push('patterned-field'); + this.element.content.push(newMemberElement); + } else if (!this.ignoredFields.includes(toValue(key))) { + this.element.content.push(cloneDeep(memberElement)); + } + }); + + this.copyMetaAndAttributes(objectElement, this.element); + + return BREAK; + } +} + +export default PatternedFieldsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/tsconfig.declaration.json b/packages/apidom-ns-asyncapi-3/tsconfig.declaration.json new file mode 100644 index 0000000000..82d128fa80 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/tsconfig.declaration.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationDir": "types", + "noEmit": false, + "emitDeclarationOnly": true + } +} diff --git a/packages/apidom-ns-asyncapi-3/tsconfig.json b/packages/apidom-ns-asyncapi-3/tsconfig.json index e5a2034254..5cc50cd885 100644 --- a/packages/apidom-ns-asyncapi-3/tsconfig.json +++ b/packages/apidom-ns-asyncapi-3/tsconfig.json @@ -1,9 +1,6 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "lib", - "composite": false - }, - "include": ["src/**/*.ts", "test/**/*.ts"] + "include": [ + "src/**/*" + ] } diff --git a/packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts b/packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts deleted file mode 100644 index 50c7fd8170..0000000000 --- a/packages/apidom-ns-asyncapi-3/types/apidom-ns-asyncapi-3.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Type declarations placeholder for apidom-ns-asyncapi-3 -export {}; From 03d731d5a1641a9d20bc997c661e7d9983da29ec Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 11:55:56 +0200 Subject: [PATCH 05/27] feat: async v3 binding elements --- .../src/elements/bindings/amqp/AmqpChannelBinding.ts | 5 +++++ .../src/elements/bindings/amqp/AmqpMessageBinding.ts | 5 +++++ .../src/elements/bindings/amqp/AmqpOperationBinding.ts | 5 +++++ .../src/elements/bindings/amqp/AmqpServerBinding.ts | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts new file mode 100644 index 0000000000..7bff41796e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts @@ -0,0 +1,5 @@ +import { AmqpChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AmqpChannelBinding extends AmqpChannelBindingElement {} + +export default AmqpChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts new file mode 100644 index 0000000000..51693d5e83 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts @@ -0,0 +1,5 @@ +import { AmqpMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AmqpMessageBinding extends AmqpMessageBindingElement {} + +export default AmqpMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts new file mode 100644 index 0000000000..b38ed27300 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts @@ -0,0 +1,5 @@ +import { AmqpOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AmqpOperationBinding extends AmqpOperationBindingElement {} + +export default AmqpOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts new file mode 100644 index 0000000000..c7e0856daf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts @@ -0,0 +1,5 @@ +import { AmqpServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AmqpServerBinding extends AmqpServerBindingElement {} + +export default AmqpServerBinding; From 410875d3114a83a9a122327c5d73f89c4338de21 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 11:56:15 +0200 Subject: [PATCH 06/27] feat: async v3 binding elements --- .../src/elements/bindings/amqp1/Amqp1ChannelBinding.ts | 5 +++++ .../src/elements/bindings/amqp1/Amqp1MessageBinding.ts | 5 +++++ .../src/elements/bindings/amqp1/Amqp1OperationBinding.ts | 5 +++++ .../src/elements/bindings/amqp1/Amqp1ServerBinding.ts | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts new file mode 100644 index 0000000000..5ff90666a0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts @@ -0,0 +1,5 @@ +import { Amqp1ChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Amqp1ChannelBinding extends Amqp1ChannelBindingElement {} + +export default Amqp1ChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts new file mode 100644 index 0000000000..71acf387d7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts @@ -0,0 +1,5 @@ +import { Amqp1MessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Amqp1MessageBinding extends Amqp1MessageBindingElement {} + +export default Amqp1MessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts new file mode 100644 index 0000000000..6809cf8e42 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts @@ -0,0 +1,5 @@ +import { Amqp1OperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Amqp1OperationBinding extends Amqp1OperationBindingElement {} + +export default Amqp1OperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts new file mode 100644 index 0000000000..6b6282ffdf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts @@ -0,0 +1,5 @@ +import { Amqp1ServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Amqp1ServerBinding extends Amqp1ServerBindingElement {} + +export default Amqp1ServerBinding; From 33995da10128fe3282c6ba7d29cb19021803aeca Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 11:56:55 +0200 Subject: [PATCH 07/27] feat: async v3 binding elements --- .../elements/bindings/anypointmq/AnypointmqChannelBinding.ts | 5 +++++ .../elements/bindings/anypointmq/AnypointmqMessageBinding.ts | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts new file mode 100644 index 0000000000..2fbbe9ac5c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts @@ -0,0 +1,5 @@ +import { AnypointmqChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AnypointmqChannelBinding extends AnypointmqChannelBindingElement {} + +export default AnypointmqChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts new file mode 100644 index 0000000000..85b00393a7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts @@ -0,0 +1,5 @@ +import { AnypointmqMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AnypointmqMessageBinding extends AnypointmqMessageBindingElement {} + +export default AnypointmqMessageBinding; From baa0c78c645b8a26911bb9cc2dea99e5a949f83d Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 13:14:24 +0200 Subject: [PATCH 08/27] feat: async v3 binding elements --- .../bindings/googlepubsub/GooglepubsubChannelBinding.ts | 5 +++++ .../bindings/googlepubsub/GooglepubsubMessageBinding.ts | 5 +++++ .../bindings/googlepubsub/GooglepubsubOperationBinding.ts | 5 +++++ .../bindings/googlepubsub/GooglepubsubServerBinding.ts | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts new file mode 100644 index 0000000000..191b2b96db --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts @@ -0,0 +1,5 @@ +import { GooglepubsubChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class GooglepubsubChannelBinding extends GooglepubsubChannelBindingElement {} + +export default GooglepubsubChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts new file mode 100644 index 0000000000..b97ee1348d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts @@ -0,0 +1,5 @@ +import { GooglepubsubMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class GooglepubsubMessageBinding extends GooglepubsubMessageBindingElement {} + +export default GooglepubsubMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts new file mode 100644 index 0000000000..0c93d4aad3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts @@ -0,0 +1,5 @@ +import { GooglepubsubOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class GooglepubsubOperationBinding extends GooglepubsubOperationBindingElement {} + +export default GooglepubsubOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts new file mode 100644 index 0000000000..730a22cf52 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts @@ -0,0 +1,5 @@ +import { GooglepubsubServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class GooglepubsubServerBinding extends GooglepubsubServerBindingElement {} + +export default GooglepubsubServerBinding; From 9540dad7320885ec38dbc146318a8cd339b70d2c Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 13:14:46 +0200 Subject: [PATCH 09/27] feat: async v3 binding elements --- .../src/elements/bindings/http/HttpChannelBinding.ts | 5 +++++ .../src/elements/bindings/http/HttpMessageBinding.ts | 5 +++++ .../src/elements/bindings/http/HttpOperationBinding.ts | 5 +++++ .../src/elements/bindings/http/HttpServerBinding.ts | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts new file mode 100644 index 0000000000..6907f20b5e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts @@ -0,0 +1,5 @@ +import { HttpChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class HttpChannelBinding extends HttpChannelBindingElement {} + +export default HttpChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts new file mode 100644 index 0000000000..1b086f293d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts @@ -0,0 +1,5 @@ +import { HttpMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class HttpMessageBinding extends HttpMessageBindingElement {} + +export default HttpMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts new file mode 100644 index 0000000000..2a413fdc51 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts @@ -0,0 +1,5 @@ +import { HttpOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class HttpOperationBinding extends HttpOperationBindingElement {} + +export default HttpOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts new file mode 100644 index 0000000000..16a3329d6d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts @@ -0,0 +1,5 @@ +import { HttpServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class HttpServerBinding extends HttpServerBindingElement {} + +export default HttpServerBinding; From 7eb7bf111212a446d8930974391fd1e19085433e Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 13:15:04 +0200 Subject: [PATCH 10/27] feat: async v3 binding elements --- .../src/elements/bindings/ibmmq/IbmmqChannelBinding.ts | 5 +++++ .../src/elements/bindings/ibmmq/IbmmqMessageBinding.ts | 5 +++++ .../src/elements/bindings/ibmmq/IbmmqOperationBinding.ts | 5 +++++ .../src/elements/bindings/ibmmq/IbmmqServerBinding.ts | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts new file mode 100644 index 0000000000..af4bbedf2d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts @@ -0,0 +1,5 @@ +import { IbmmqChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class IbmmqChannelBinding extends IbmmqChannelBindingElement {} + +export default IbmmqChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts new file mode 100644 index 0000000000..115dc189bf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts @@ -0,0 +1,5 @@ +import { IbmmqMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class IbmmqMessageBinding extends IbmmqMessageBindingElement {} + +export default IbmmqMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts new file mode 100644 index 0000000000..342409e147 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts @@ -0,0 +1,5 @@ +import { IbmmqOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class IbmmqOperationBinding extends IbmmqOperationBindingElement {} + +export default IbmmqOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts new file mode 100644 index 0000000000..599e0daa71 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts @@ -0,0 +1,5 @@ +import { IbmmqServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class IbmmqServerBinding extends IbmmqServerBindingElement {} + +export default IbmmqServerBinding; From 71cc9faa80511fc2f46ee8fc73af890153cfada8 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 13:17:35 +0200 Subject: [PATCH 11/27] feat: async v3 binding elements --- .../src/elements/bindings/jms/JmsChannelBinding.ts | 5 +++++ .../src/elements/bindings/jms/JmsMessageBinding.ts | 5 +++++ .../src/elements/bindings/jms/JmsOperationBinding.ts | 5 +++++ .../src/elements/bindings/jms/JmsServerBinding.ts | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts new file mode 100644 index 0000000000..7834a73851 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts @@ -0,0 +1,5 @@ +import { JmsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class JmsChannelBinding extends JmsChannelBindingElement {} + +export default JmsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts new file mode 100644 index 0000000000..57e157be28 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts @@ -0,0 +1,5 @@ +import { JmsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class JmsMessageBinding extends JmsMessageBindingElement {} + +export default JmsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts new file mode 100644 index 0000000000..eb4f0c9147 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts @@ -0,0 +1,5 @@ +import { JmsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class JmsOperationBinding extends JmsOperationBindingElement {} + +export default JmsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts new file mode 100644 index 0000000000..6555290e6f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts @@ -0,0 +1,5 @@ +import { JmsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class JmsServerBinding extends JmsServerBindingElement {} + +export default JmsServerBinding; From c28df59ac64f55a7cec1064d0880f0a3b7f702b8 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 13:25:19 +0200 Subject: [PATCH 12/27] feat: async v3 binding elements --- .../src/elements/bindings/kafka/KafkaChannelBinding.ts | 5 +++++ .../src/elements/bindings/kafka/KafkaMessageBinding.ts | 5 +++++ .../src/elements/bindings/kafka/KafkaOperationBinding.ts | 5 +++++ .../src/elements/bindings/kafka/KafkaServerBinding.ts | 5 +++++ .../src/elements/bindings/mercure/MercureChannelBinding.ts | 5 +++++ .../src/elements/bindings/mercure/MercureMessageBinding.ts | 5 +++++ .../src/elements/bindings/mercure/MercureOperationBinding.ts | 5 +++++ .../src/elements/bindings/mercure/MercureServerBinding.ts | 5 +++++ .../src/elements/bindings/mqtt/MqttChannelBinding.ts | 5 +++++ .../src/elements/bindings/mqtt/MqttMessageBinding.ts | 5 +++++ .../src/elements/bindings/mqtt/MqttOperationBinding.ts | 5 +++++ .../src/elements/bindings/mqtt/MqttServerBinding.ts | 5 +++++ .../src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts | 5 +++++ .../src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts | 5 +++++ .../src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts | 5 +++++ .../src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts | 5 +++++ .../src/elements/bindings/nats/NatsChannelBinding.ts | 5 +++++ .../src/elements/bindings/nats/NatsMessageBinding.ts | 5 +++++ .../src/elements/bindings/nats/NatsOperationBinding.ts | 5 +++++ .../src/elements/bindings/nats/NatsServerBinding.ts | 5 +++++ .../src/elements/bindings/pulsar/PulsarChannelBinding.ts | 5 +++++ .../src/elements/bindings/pulsar/PulsarMessageBinding.ts | 5 +++++ .../src/elements/bindings/pulsar/PulsarOperationBinding.ts | 5 +++++ .../src/elements/bindings/pulsar/PulsarServerBinding.ts | 5 +++++ .../src/elements/bindings/redis/RedisChannelBinding.ts | 5 +++++ .../src/elements/bindings/redis/RedisMessageBinding.ts | 5 +++++ .../src/elements/bindings/redis/RedisOperationBinding.ts | 5 +++++ .../src/elements/bindings/redis/RedisServerBinding.ts | 5 +++++ .../src/elements/bindings/sns/SnsChannelBinding.ts | 5 +++++ .../src/elements/bindings/sns/SnsMessageBinding.ts | 5 +++++ .../src/elements/bindings/sns/SnsOperationBinding.ts | 5 +++++ .../src/elements/bindings/sns/SnsServerBinding.ts | 5 +++++ .../src/elements/bindings/solace/SolaceChannelBinding.ts | 5 +++++ .../src/elements/bindings/solace/SolaceMessageBinding.ts | 5 +++++ .../src/elements/bindings/solace/SolaceOperationBinding.ts | 5 +++++ .../src/elements/bindings/solace/SolaceServerBinding.ts | 5 +++++ .../src/elements/bindings/sqs/SqsChannelBinding.ts | 5 +++++ .../src/elements/bindings/sqs/SqsMessageBinding.ts | 5 +++++ .../src/elements/bindings/sqs/SqsOperationBinding.ts | 5 +++++ .../src/elements/bindings/sqs/SqsServerBinding.ts | 5 +++++ .../src/elements/bindings/stomp/StompChannelBinding.ts | 5 +++++ .../src/elements/bindings/stomp/StompMessageBinding.ts | 5 +++++ .../src/elements/bindings/stomp/StompOperationBinding.ts | 5 +++++ .../src/elements/bindings/stomp/StompServerBinding.ts | 5 +++++ 44 files changed, 220 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts new file mode 100644 index 0000000000..411150b0b9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts @@ -0,0 +1,5 @@ +import { KafkaChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class KafkaChannelBinding extends KafkaChannelBindingElement {} + +export default KafkaChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts new file mode 100644 index 0000000000..65fa9a570f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts @@ -0,0 +1,5 @@ +import { KafkaMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class KafkaMessageBinding extends KafkaMessageBindingElement {} + +export default KafkaMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts new file mode 100644 index 0000000000..e2d7c2d6bf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts @@ -0,0 +1,5 @@ +import { KafkaOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class KafkaOperationBinding extends KafkaOperationBindingElement {} + +export default KafkaOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts new file mode 100644 index 0000000000..7d13e987e9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts @@ -0,0 +1,5 @@ +import { KafkaServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class KafkaServerBinding extends KafkaServerBindingElement {} + +export default KafkaServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts new file mode 100644 index 0000000000..78442b6e24 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts @@ -0,0 +1,5 @@ +import { MercureChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MercureChannelBinding extends MercureChannelBindingElement {} + +export default MercureChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts new file mode 100644 index 0000000000..6e3c3ff68e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts @@ -0,0 +1,5 @@ +import { MercureMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MercureMessageBinding extends MercureMessageBindingElement {} + +export default MercureMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts new file mode 100644 index 0000000000..7d73a88b8c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts @@ -0,0 +1,5 @@ +import { MercureOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MercureOperationBinding extends MercureOperationBindingElement {} + +export default MercureOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts new file mode 100644 index 0000000000..291a0934f4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts @@ -0,0 +1,5 @@ +import { MercureServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MercureServerBinding extends MercureServerBindingElement {} + +export default MercureServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts new file mode 100644 index 0000000000..c993d7b6e4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts @@ -0,0 +1,5 @@ +import { MqttChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MqttChannelBinding extends MqttChannelBindingElement {} + +export default MqttChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts new file mode 100644 index 0000000000..2a0d4e8430 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts @@ -0,0 +1,5 @@ +import { MqttMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MqttMessageBinding extends MqttMessageBindingElement {} + +export default MqttMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts new file mode 100644 index 0000000000..d1bafd378d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts @@ -0,0 +1,5 @@ +import { MqttOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MqttOperationBinding extends MqttOperationBindingElement {} + +export default MqttOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts new file mode 100644 index 0000000000..1bc3d8b244 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts @@ -0,0 +1,5 @@ +import { MqttServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class MqttServerBinding extends MqttServerBindingElement {} + +export default MqttServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts new file mode 100644 index 0000000000..1ece0a6bb7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts @@ -0,0 +1,5 @@ +import { Mqtt5ChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Mqtt5ChannelBinding extends Mqtt5ChannelBindingElement {} + +export default Mqtt5ChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts new file mode 100644 index 0000000000..d47aac633b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts @@ -0,0 +1,5 @@ +import { Mqtt5MessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Mqtt5MessageBinding extends Mqtt5MessageBindingElement {} + +export default Mqtt5MessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts new file mode 100644 index 0000000000..d3474a91a2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts @@ -0,0 +1,5 @@ +import { Mqtt5OperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Mqtt5OperationBinding extends Mqtt5OperationBindingElement {} + +export default Mqtt5OperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts new file mode 100644 index 0000000000..eda2f72521 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts @@ -0,0 +1,5 @@ +import { Mqtt5ServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class Mqtt5ServerBinding extends Mqtt5ServerBindingElement {} + +export default Mqtt5ServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts new file mode 100644 index 0000000000..e748727941 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts @@ -0,0 +1,5 @@ +import { NatsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class NatsChannelBinding extends NatsChannelBindingElement {} + +export default NatsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts new file mode 100644 index 0000000000..279a3f838d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts @@ -0,0 +1,5 @@ +import { NatsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class NatsMessageBinding extends NatsMessageBindingElement {} + +export default NatsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts new file mode 100644 index 0000000000..db0f732caf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts @@ -0,0 +1,5 @@ +import { NatsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class NatsOperationBinding extends NatsOperationBindingElement {} + +export default NatsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts new file mode 100644 index 0000000000..28879d465b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts @@ -0,0 +1,5 @@ +import { NatsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class NatsServerBinding extends NatsServerBindingElement {} + +export default NatsServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts new file mode 100644 index 0000000000..d5f4a4cc29 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts @@ -0,0 +1,5 @@ +import { PulsarChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class PulsarChannelBinding extends PulsarChannelBindingElement {} + +export default PulsarChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts new file mode 100644 index 0000000000..38e3c952aa --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts @@ -0,0 +1,5 @@ +import { PulsarMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class PulsarMessageBinding extends PulsarMessageBindingElement {} + +export default PulsarMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts new file mode 100644 index 0000000000..594a12f97d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts @@ -0,0 +1,5 @@ +import { PulsarOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class PulsarOperationBinding extends PulsarOperationBindingElement {} + +export default PulsarOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts new file mode 100644 index 0000000000..8ef57f4077 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts @@ -0,0 +1,5 @@ +import { PulsarServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class PulsarServerBinding extends PulsarServerBindingElement {} + +export default PulsarServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts new file mode 100644 index 0000000000..ae2ea390a0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts @@ -0,0 +1,5 @@ +import { RedisChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class RedisChannelBinding extends RedisChannelBindingElement {} + +export default RedisChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts new file mode 100644 index 0000000000..764852e071 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts @@ -0,0 +1,5 @@ +import { RedisMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class RedisMessageBinding extends RedisMessageBindingElement {} + +export default RedisMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts new file mode 100644 index 0000000000..81838f715e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts @@ -0,0 +1,5 @@ +import { RedisOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class RedisOperationBinding extends RedisOperationBindingElement {} + +export default RedisOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts new file mode 100644 index 0000000000..0b4357c7e4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts @@ -0,0 +1,5 @@ +import { RedisServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class RedisServerBinding extends RedisServerBindingElement {} + +export default RedisServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts new file mode 100644 index 0000000000..6c981e8011 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts @@ -0,0 +1,5 @@ +import { SnsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SnsChannelBinding extends SnsChannelBindingElement {} + +export default SnsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts new file mode 100644 index 0000000000..73f24861a0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts @@ -0,0 +1,5 @@ +import { SnsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SnsMessageBinding extends SnsMessageBindingElement {} + +export default SnsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts new file mode 100644 index 0000000000..bd0fc637d5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts @@ -0,0 +1,5 @@ +import { SnsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SnsOperationBinding extends SnsOperationBindingElement {} + +export default SnsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts new file mode 100644 index 0000000000..ccc637271d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts @@ -0,0 +1,5 @@ +import { SnsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SnsServerBinding extends SnsServerBindingElement {} + +export default SnsServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts new file mode 100644 index 0000000000..35458c91d7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts @@ -0,0 +1,5 @@ +import { SolaceChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SolaceChannelBinding extends SolaceChannelBindingElement {} + +export default SolaceChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts new file mode 100644 index 0000000000..2161c76c25 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts @@ -0,0 +1,5 @@ +import { SolaceMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SolaceMessageBinding extends SolaceMessageBindingElement {} + +export default SolaceMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts new file mode 100644 index 0000000000..f914366f72 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts @@ -0,0 +1,5 @@ +import { SolaceOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SolaceOperationBinding extends SolaceOperationBindingElement {} + +export default SolaceOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts new file mode 100644 index 0000000000..d8a9a63522 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts @@ -0,0 +1,5 @@ +import { SolaceServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SolaceServerBinding extends SolaceServerBindingElement {} + +export default SolaceServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts new file mode 100644 index 0000000000..d10b58cea9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts @@ -0,0 +1,5 @@ +import { SqsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SqsChannelBinding extends SqsChannelBindingElement {} + +export default SqsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts new file mode 100644 index 0000000000..afa75b296a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts @@ -0,0 +1,5 @@ +import { SqsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SqsMessageBinding extends SqsMessageBindingElement {} + +export default SqsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts new file mode 100644 index 0000000000..0c0432d150 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts @@ -0,0 +1,5 @@ +import { SqsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SqsOperationBinding extends SqsOperationBindingElement {} + +export default SqsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts new file mode 100644 index 0000000000..112cd8ad31 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts @@ -0,0 +1,5 @@ +import { SqsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class SqsServerBinding extends SqsServerBindingElement {} + +export default SqsServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts new file mode 100644 index 0000000000..d09dd2e915 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts @@ -0,0 +1,5 @@ +import { StompChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class StompChannelBinding extends StompChannelBindingElement {} + +export default StompChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts new file mode 100644 index 0000000000..b9583a559a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts @@ -0,0 +1,5 @@ +import { StompMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class StompMessageBinding extends StompMessageBindingElement {} + +export default StompMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts new file mode 100644 index 0000000000..725c42e86d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts @@ -0,0 +1,5 @@ +import { StompOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class StompOperationBinding extends StompOperationBindingElement {} + +export default StompOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts new file mode 100644 index 0000000000..fcf1432e49 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts @@ -0,0 +1,5 @@ +import { StompServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class StompServerBinding extends StompServerBindingElement {} + +export default StompServerBinding; From a262c019e641ebc208146aa0f070cb1870d3703e Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 13:30:22 +0200 Subject: [PATCH 13/27] feat: async v3 binding elements --- .../bindings/anypointmq/AnypointmqOperationBinding.ts | 5 +++++ .../elements/bindings/anypointmq/AnypointmqServerBinding.ts | 5 +++++ .../src/elements/bindings/ws/WebSocketChannelBinding.ts | 5 +++++ .../src/elements/bindings/ws/WebSocketMessageBinding.ts | 5 +++++ .../src/elements/bindings/ws/WebSocketOperationBinding.ts | 5 +++++ .../src/elements/bindings/ws/WebSocketServerBinding.ts | 5 +++++ 6 files changed, 30 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts new file mode 100644 index 0000000000..fdca90b55b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts @@ -0,0 +1,5 @@ +import { AnypointmqOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AnypointmqOperationBinding extends AnypointmqOperationBindingElement {} + +export default AnypointmqOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts new file mode 100644 index 0000000000..8dbab48529 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts @@ -0,0 +1,5 @@ +import { AnypointmqServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class AnypointmqServerBinding extends AnypointmqServerBindingElement {} + +export default AnypointmqServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts new file mode 100644 index 0000000000..ca56ca1e09 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts @@ -0,0 +1,5 @@ +import { WebSocketChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class WebSocketChannelBinding extends WebSocketChannelBindingElement {} + +export default WebSocketChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts new file mode 100644 index 0000000000..84da058c69 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts @@ -0,0 +1,5 @@ +import { WebSocketMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class WebSocketMessageBinding extends WebSocketMessageBindingElement {} + +export default WebSocketMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts new file mode 100644 index 0000000000..c573a0a0e3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts @@ -0,0 +1,5 @@ +import { WebSocketOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class WebSocketOperationBinding extends WebSocketOperationBindingElement {} + +export default WebSocketOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts new file mode 100644 index 0000000000..c01ff990bb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts @@ -0,0 +1,5 @@ +import { WebSocketServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +class WebSocketServerBinding extends WebSocketServerBindingElement {} + +export default WebSocketServerBinding; From 395cae64238121d42ed40409a6e3f55abf7ba9af Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 15:36:24 +0200 Subject: [PATCH 14/27] feat: async v3 license, contact visitor --- .../src/refractor/specification.ts | 32 +++++++++++++++++++ .../visitors/async-api-3/contact/index.ts | 29 +++++++++++++++++ .../visitors/async-api-3/license/index.ts | 29 +++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/contact/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/license/index.ts diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 07d7feedcf..45aa74f2bc 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -18,6 +18,8 @@ import OperationVisitor from './visitors/async-api-3/operation/OperationVisitor. import OperationMessageVisitor from './visitors/async-api-3/operation/OperationMessageVisitor.ts'; import SchemaVisitor from './visitors/async-api-3/schema/SchemaVisitor.ts'; import ReferenceVisitor from './visitors/async-api-3/reference/ReferenceVisitor.ts'; +import ContactVisitor from './visitors/async-api-3/contact/index.ts'; +import LicenseVisitor from './visitors/async-api-3/license/index.ts'; const specification = { visitors: { @@ -52,6 +54,32 @@ const specification = { title: { $ref: '#/visitors/value' }, version: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, + termsOfService: { $ref: '#/visitors/value' }, + contact: { $ref: '#/visitors/document/objects/Contact' }, + license: { + $ref: '#/visitors/document/objects/License', + }, + externalDocs: { + $ref: '#/visitors/document/objects/ExternalDocumentation', + }, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + }, + }, + Contact: { + $visitor: ContactVisitor, + fixedFields: { + name: { $ref: '#/visitors/value' }, + url: { $ref: '#/visitors/value' }, + email: { $ref: '#/visitors/value' }, + }, + }, + License: { + $visitor: LicenseVisitor, + fixedFields: { + name: { $ref: '#/visitors/value' }, + url: { $ref: '#/visitors/value' }, }, }, Servers: { @@ -71,6 +99,10 @@ const specification = { }, ExternalDocumentation: { $visitor: ExternalDocumentationVisitor, + fixedFields: { + description: { $ref: '#/visitors/value' }, + url: { $ref: '#/visitors/value' }, + }, }, Parameters: { $visitor: ParametersVisitor, diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/contact/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/contact/index.ts new file mode 100644 index 0000000000..219b4d6b00 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/contact/index.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + ContactVisitorOptions, + ContactVisitor as ContactVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ContactElement from '../../../../elements/Contact.ts'; + +/** + * @public + */ +export const BaseContactVisitor: typeof ContactVisitorType = + AsyncApi2Specification.visitors.document.objects.Contact.$visitor; + +export type { ContactVisitorOptions }; + +/** + * @public + */ +class ContactVisitor extends BaseContactVisitor { + declare public readonly element: ContactElement; + + constructor(options: ContactVisitorOptions) { + super(options); + this.element = new ContactElement(); + } +} + +export default ContactVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/license/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/license/index.ts new file mode 100644 index 0000000000..1fb0550186 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/license/index.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + LicenseVisitorOptions, + LicenseVisitor as LicenseVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import LicenseElement from '../../../../elements/License.ts'; + +/** + * @public + */ +export const BaseLicenseVisitor: typeof LicenseVisitorType = + AsyncApi2Specification.visitors.document.objects.License.$visitor; + +export type { LicenseVisitorOptions }; + +/** + * @public + */ +class LicenseVisitor extends BaseLicenseVisitor { + declare public readonly element: LicenseElement; + + constructor(options: LicenseVisitorOptions) { + super(options); + this.element = new LicenseElement(); + } +} + +export default LicenseVisitor; From ced878712a902676168c2adacb4e3be988c3ccd1 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Tue, 21 Oct 2025 16:26:35 +0200 Subject: [PATCH 15/27] feat: async v3 Servers hint --- packages/apidom-ns-asyncapi-3/src/elements/Servers.ts | 2 +- packages/apidom-ns-asyncapi-3/src/refractor/specification.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts index acc6b1aa92..9092299522 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts @@ -1,4 +1,4 @@ -import { ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; // TODO: Should be ServersElement ? class Servers extends ServerElement {} diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 45aa74f2bc..0dbf9a9a56 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -83,7 +83,7 @@ const specification = { }, }, Servers: { - $visitor: ServerVisitor, + $visitor: ServerVisitor, // TODO: Should be ServersVisitor ? fixedFields: { // server entries are dynamic keys - handled by ChannelsVisitor/ServersVisitor in full impl }, From dbf0d83c993ca40affcc55a15d3ee5886899b69b Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Mon, 27 Oct 2025 17:05:23 +0530 Subject: [PATCH 16/27] feat: add visitors --- .../src/elements/Components.ts | 117 +------- .../src/elements/MessageTrait.ts | 98 ++---- .../src/elements/OauthFlow.ts | 4 +- .../src/elements/OauthFlows.ts | 6 +- .../src/elements/OperationTrait.ts | 59 +--- .../src/elements/Schema.ts | 83 +----- .../src/elements/Server.ts | 53 +--- .../apidom-ns-asyncapi-3/src/elements/Tag.ts | 23 +- .../src/elements/nces/ChannelServers.ts | 14 + .../src/elements/nces/ComponentOperations.ts | 14 + .../src/elements/nces/ComponentsSchemas.ts | 8 + .../src/elements/nces/MessageExamples.ts | 8 + .../src/elements/nces/MessageTraits.ts | 8 + .../src/elements/nces/OperationMessage.ts | 8 + .../src/elements/nces/OperationSecurity.ts | 8 + .../src/elements/nces/OperationTraits.ts | 8 + .../apidom-ns-asyncapi-3/src/media-types.ts | 1 - .../apidom-ns-asyncapi-3/src/predicates.ts | 14 +- .../src/refractor/specification.ts | 278 +++++++++++++++--- .../src/refractor/toolbox.ts | 12 +- .../visitors/DefaultContentTypeVisitor.ts | 23 ++ .../visitors/async-api-3/AsyncApi3Visitor.ts | 5 - .../visitors/async-api-3/TagsVisitor.ts | 5 - .../bindings/amqp/channel-binding/index.ts | 38 +++ .../bindings/amqp/message-binding/index.ts | 38 +++ .../bindings/amqp/operation-binding/index.ts | 38 +++ .../bindings/amqp/server-binding/index.ts | 38 +++ .../bindings/amqp1/channel-binding/index.ts | 38 +++ .../bindings/amqp1/message-binding/index.ts | 38 +++ .../bindings/amqp1/operation-binding/index.ts | 38 +++ .../bindings/amqp1/server-binding/index.ts | 38 +++ .../anypointmq/channel-binding/index.ts | 38 +++ .../anypointmq/message-binding/index.ts | 38 +++ .../anypointmq/operation-binding/index.ts | 38 +++ .../anypointmq/server-binding/index.ts | 38 +++ .../googlepubsub/channel-binding/index.ts | 38 +++ .../googlepubsub/message-binding/index.ts | 38 +++ .../googlepubsub/operation-binding/index.ts | 38 +++ .../googlepubsub/server-binding/index.ts | 38 +++ .../bindings/http/channel-binding/index.ts | 38 +++ .../bindings/http/message-binding/index.ts | 38 +++ .../bindings/http/operation-binding/index.ts | 38 +++ .../bindings/http/server-binding/index.ts | 38 +++ .../bindings/ibmmq/channel-binding/index.ts | 38 +++ .../bindings/ibmmq/message-binding/index.ts | 38 +++ .../bindings/ibmmq/operation-binding/index.ts | 38 +++ .../bindings/ibmmq/server-binding/index.ts | 38 +++ .../visitors/async-api-3/bindings/index.ts | 38 +++ .../bindings/jms/channel-binding/index.ts | 38 +++ .../bindings/jms/message-binding/index.ts | 38 +++ .../bindings/jms/operation-binding/index.ts | 38 +++ .../bindings/jms/server-binding/index.ts | 38 +++ .../bindings/kafka/channel-binding/index.ts | 38 +++ .../bindings/kafka/message-binding/index.ts | 38 +++ .../bindings/kafka/operation-binding/index.ts | 38 +++ .../bindings/kafka/server-binding/index.ts | 38 +++ .../bindings/mercure/channel-binding/index.ts | 38 +++ .../bindings/mercure/message-binding/index.ts | 38 +++ .../mercure/operation-binding/index.ts | 38 +++ .../bindings/mercure/server-binding/index.ts | 38 +++ .../bindings/mqtt/channel-binding/index.ts | 38 +++ .../bindings/mqtt/message-binding/index.ts | 38 +++ .../bindings/mqtt/operation-binding/index.ts | 38 +++ .../bindings/mqtt/server-binding/index.ts | 38 +++ .../bindings/mqtt5/channel-binding/index.ts | 38 +++ .../bindings/mqtt5/message-binding/index.ts | 38 +++ .../bindings/mqtt5/operation-binding/index.ts | 38 +++ .../bindings/mqtt5/server-binding/index.ts | 38 +++ .../bindings/nats/channel-binding/index.ts | 38 +++ .../bindings/nats/message-binding/index.ts | 38 +++ .../bindings/nats/operation-binding/index.ts | 38 +++ .../bindings/nats/server-binding/index.ts | 38 +++ .../bindings/pulsar/channel-binding/index.ts | 38 +++ .../bindings/pulsar/message-binding/index.ts | 38 +++ .../pulsar/operation-binding/index.ts | 38 +++ .../bindings/pulsar/server-binding/index.ts | 38 +++ .../bindings/redis/channel-binding/index.ts | 38 +++ .../bindings/redis/message-binding/index.ts | 38 +++ .../bindings/redis/operation-binding/index.ts | 38 +++ .../bindings/redis/server-binding/index.ts | 38 +++ .../bindings/sns/channel-binding/index.ts | 38 +++ .../bindings/sns/message-binding/index.ts | 38 +++ .../bindings/sns/operation-binding/index.ts | 38 +++ .../bindings/sns/server-binding/index.ts | 38 +++ .../bindings/solace/channel-binding/index.ts | 38 +++ .../bindings/solace/message-binding/index.ts | 38 +++ .../solace/operation-binding/index.ts | 38 +++ .../bindings/solace/server-binding/index.ts | 38 +++ .../bindings/sqs/channel-binding/index.ts | 38 +++ .../bindings/sqs/message-binding/index.ts | 38 +++ .../bindings/sqs/operation-binding/index.ts | 38 +++ .../bindings/sqs/server-binding/index.ts | 38 +++ .../bindings/stomp/channel-binding/index.ts | 38 +++ .../bindings/stomp/message-binding/index.ts | 38 +++ .../bindings/stomp/operation-binding/index.ts | 38 +++ .../bindings/stomp/server-binding/index.ts | 38 +++ .../bindings/ws/channel-binding/index.ts | 38 +++ .../bindings/ws/message-binding/index.ts | 38 +++ .../bindings/ws/operation-binding/index.ts | 38 +++ .../bindings/ws/server-binding/index.ts | 38 +++ .../async-api-3/channel/BindingsVisitor.ts | 40 +++ .../async-api-3/channel/ChanneVisitor.ts | 13 - .../async-api-3/channel/ServersVisitor.ts | 44 +++ .../visitors/async-api-3/channel/index.ts | 28 ++ .../async-api-3/channels/ChannelsVisitor.ts | 5 - .../visitors/async-api-3/channels/index.ts | 23 ++ .../components/ComponentsVisitor.ts | 14 - .../components/OperationsVisitor.ts | 44 +++ .../async-api-3/components/SchemasVisitor.ts | 56 ++++ .../visitors/async-api-3/components/index.ts | 23 ++ .../async-api-3/correlation-id/index.ts | 23 ++ .../refractor/visitors/async-api-3/index.ts | 36 +++ .../visitors/async-api-3/info/InfoVisitor.ts | 16 - .../visitors/async-api-3/info/info.ts | 23 ++ .../async-api-3/message-bindings/index.ts | 23 ++ .../async-api-3/message-example/index.ts | 23 ++ .../async-api-3/message/BindingsVisitor.ts | 40 +++ .../message/CorrelationIdVisitor.ts | 41 +++ .../async-api-3/message/ExamplesVisitor.ts | 42 +++ .../async-api-3/message/HeadersVisitor.ts | 48 +++ .../async-api-3/message/MessageVisitor.ts | 5 - .../async-api-3/message/TraitsVisitor.ts | 45 +++ .../visitors/async-api-3/message/index.ts | 62 ++++ .../visitors/async-api-3/messages/index.ts | 23 ++ .../async-api-3/multiFormatSchema/index.ts | 47 +++ .../visitors/async-api-3/oauth-flow/index.ts | 29 ++ .../visitors/async-api-3/oauth-flows/index.ts | 29 ++ .../async-api-3/operation/BindingsVisitor.ts | 40 +++ .../async-api-3/operation/MessagesVisitor.ts | 44 +++ .../operation/OperationMessageVisitor.ts | 5 - .../async-api-3/operation/OperationVisitor.ts | 47 ++- .../async-api-3/operation/ReplyVisitor.ts | 40 +++ .../async-api-3/operation/SecurityVisitor.ts | 46 +++ .../async-api-3/operation/TraitsVisitor.ts | 45 +++ .../async-api-3/operationReply/index.ts | 27 ++ .../visitors/async-api-3/operations/index.ts | 29 ++ .../async-api-3/reference/ReferenceVisitor.ts | 14 - .../visitors/async-api-3/reference/index.ts | 29 ++ .../async-api-3/schema/SchemaVisitor.ts | 5 - .../visitors/async-api-3/schema/index.ts | 23 ++ .../async-api-3/server-bindings/index.ts | 23 ++ .../visitors/async-api-3/tag/index.ts | 35 +++ .../visitors/async-api-3/tags/index.ts | 29 ++ .../generics/ExternalDocumentationVisitor.ts | 35 +++ 144 files changed, 4603 insertions(+), 541 deletions(-) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentOperations.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsSchemas.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/MessageExamples.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/MessageTraits.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/OperationSecurity.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraits.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/channel-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/message-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/operation-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/server-binding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ChanneVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ComponentsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/index.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/InfoVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/ExamplesVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/MessageVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operationReply/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/ReferenceVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Components.ts b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts index 7e6091d815..2d0b4e2616 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Components.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts @@ -1,38 +1,15 @@ import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; import TagsElement from './Tags.ts'; +import { ComponentsElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ -class Components extends ObjectElement { +class Components extends ComponentsElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'components'; - } - - get schemas(): ObjectElement | undefined { - return this.get('schemas'); - } - - set schemas(schemas: ObjectElement | undefined) { - this.set('schemas', schemas); - } - - get servers(): ObjectElement | undefined { - return this.get('servers'); - } - - set servers(servers: ObjectElement | undefined) { - this.set('servers', servers); - } - - get channels(): ObjectElement | undefined { - return this.get('channnels'); - } - - set channels(channels: ObjectElement | undefined) { - this.set('channels', channels); - } + } get operations(): ObjectElement | undefined { return this.get('operations'); @@ -42,46 +19,6 @@ class Components extends ObjectElement { this.set('operations', operations); } - get messages(): ObjectElement | undefined { - return this.get('messages'); - } - - set messages(messages: ObjectElement | undefined) { - this.set('messages', messages); - } - - get securitySchemes(): ObjectElement | undefined { - return this.get('securitySchemes'); - } - - set securitySchemes(securitySchemes: ObjectElement | undefined) { - this.set('securitySchemes', securitySchemes); - } - - get serverVariables(): ObjectElement | undefined { - return this.get('serverVariables'); - } - - set serverVariables(serverVariables: ObjectElement | undefined) { - this.set('serverVariables', serverVariables); - } - - get parameters(): ObjectElement | undefined { - return this.get('parameters'); - } - - set parameters(parameters: ObjectElement | undefined) { - this.set('parameters', parameters); - } - - get correlationIds(): ObjectElement | undefined { - return this.get('correlationIds'); - } - - set correlationIds(correlationIds: ObjectElement | undefined) { - this.set('correlationIds', correlationIds); - } - get replies(): ObjectElement | undefined { return this.get('reply'); } @@ -113,54 +50,6 @@ class Components extends ObjectElement { set tags(tags: TagsElement | undefined) { this.set('tags', tags); } - - get operationTraits(): ObjectElement | undefined { - return this.get('operationTraits'); - } - - set operationTraits(operationTraits: ObjectElement | undefined) { - this.set('operationTraits', operationTraits); - } - - get messageTraits(): ObjectElement | undefined { - return this.get('messageTraits'); - } - - set messageTraits(messageTraits: ObjectElement | undefined) { - this.set('messageTraits', messageTraits); - } - - get serverBindings(): ObjectElement | undefined { - return this.get('serverBindings'); - } - - set serverBindings(serverBindings: ObjectElement | undefined) { - this.set('serverBindings', serverBindings); - } - - get channelBindings(): ObjectElement | undefined { - return this.get('channelBindings'); - } - - set channelBindings(channelBindings: ObjectElement | undefined) { - this.set('channelBindings', channelBindings); - } - - get operationBindings(): ObjectElement | undefined { - return this.get('operationBindings'); - } - - set operationBindings(operationBindings: ObjectElement | undefined) { - this.set('operationBindings', operationBindings); - } - - get messageBindings(): ObjectElement | undefined { - return this.get('messageBindings'); - } - - set messageBindings(messageBindings: ObjectElement | undefined) { - this.set('messageBindings', messageBindings); - } } export default Components; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts b/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts index de087d7307..1f2eb7f5f0 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts @@ -1,115 +1,51 @@ import { - ObjectElement, StringElement, Attributes, Meta, } from '@swagger-api/apidom-core'; -import CorrelationIDElement from './CorrelationID.ts'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; -import MessageBindingsElement from './MessageBindings.ts'; import ReferenceElement from './Reference.ts'; import SchemaElement from './Schema.ts'; -import TagsElement from './Tag.ts'; import MultiFormatSchema from './MultiFormatSchema.ts'; -import MessageExampleElement from './MessageExample.ts'; +import { MessageTraitElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; /** * @public */ -class MessageTrait extends ObjectElement { +class MessageTrait extends MessageTraitElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'messageTrait'; } - get headers(): MultiFormatSchema| SchemaElement | ReferenceElement | undefined { - return this.get('headers'); - } - - set headers(headers: MultiFormatSchema | SchemaElement | ReferenceElement | undefined) { - this.set('headers', headers); - } - - get correlationId(): CorrelationIDElement | ReferenceElement | undefined { - return this.get('correlationId'); - } - - set correlationId(correlationId: CorrelationIDElement | ReferenceElement | undefined) { - this.set('correlationId', correlationId); - } - - get contentType(): StringElement | undefined { - return this.get('contentType'); + get messageId(): StringElement | undefined { + throw new UnsupportedOperationError( + 'messageId keyword from Core vocabulary has been removed', + ); } - set contentType(contentType: StringElement | undefined) { - this.set('contentType', contentType); + set messageId(messageId: StringElement | undefined) { + throw new UnsupportedOperationError( + 'messageId keyword from Core vocabulary has been removed', + ); } - - get name(): StringElement | undefined { - return this.get('name'); - } - - set name(name: StringElement | undefined) { - this.set('name', name); - } - - get title(): StringElement | undefined { - return this.get('title'); - } - - set title(title: StringElement | undefined) { - this.set('title', title); - } - - get summary(): StringElement | undefined { - return this.get('summary'); - } - - set summary(summary: StringElement | undefined) { - this.set('summary', summary); - } - - get description(): StringElement | undefined { - return this.get('description'); - } - - set description(description: StringElement | undefined) { - this.set('description', description); - } - - get tags(): TagsElement | undefined { - return this.get('tags'); + get headers(): MultiFormatSchema| SchemaElement | ReferenceElement | undefined | any { + return this.get('headers'); } - set tags(tags: TagsElement | undefined) { - this.set('tags', tags); + set headers(headers: MultiFormatSchema | SchemaElement | ReferenceElement | undefined | any) { + this.set('headers', headers); } - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { this.set('externalDocs', externalDocs); } - - get bindings(): MessageBindingsElement | ReferenceElement | undefined { - return this.get('bindings'); - } - - set bindings(bindings: MessageBindingsElement | ReferenceElement | undefined) { - this.set('bindings', bindings); - } - - get examples(): MessageExampleElement[] | undefined { - return this.get('examples'); - } - - set examples(examples: MessageExampleElement[] | undefined) { - this.set('examples', examples); - } } export default MessageTrait; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts index 8a4b3c213b..fe86f2e256 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts @@ -2,7 +2,7 @@ import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; import { UnsupportedOperationError } from '@swagger-api/apidom-error'; import { OAuthFlowElement } from '@swagger-api/apidom-ns-asyncapi-2'; -class OauthFlow extends OAuthFlowElement { +class OAuthFlow extends OAuthFlowElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'oauthFlow'; @@ -29,4 +29,4 @@ class OauthFlow extends OAuthFlowElement { } } -export default OauthFlow; \ No newline at end of file +export default OAuthFlow; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts index 7ceb9da3ed..c5b82199e9 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts @@ -1,5 +1,5 @@ -import { OAuthFlowElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { OAuthFlowsElement } from '@swagger-api/apidom-ns-asyncapi-2'; -class OauthFlows extends OAuthFlowElement {} +class OAuthFlows extends OAuthFlowsElement {} -export default OauthFlows; \ No newline at end of file +export default OAuthFlows; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts index fd922c4855..72ec99478d 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts @@ -1,80 +1,37 @@ import { StringElement, - ObjectElement, - ArrayElement, Attributes, Meta, } from '@swagger-api/apidom-core'; -import TagsElement from './Tags.ts'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; -import OperationBindingsElement from './OperationBindings.ts'; import ReferenceElement from './Reference.ts'; +import { OperationTraitElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ -class OperationTrait extends ObjectElement { +class OperationTrait extends OperationTraitElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'operationTrait'; } - get operationId(): StringElement | undefined { - return this.get('operationId'); + get title(): StringElement | undefined { + return this.get('title'); } - set operationId(operationId: StringElement | undefined) { - this.set('operationId', operationId); + set title(title: StringElement | undefined) { + this.set('title', title); } - get summary(): StringElement | undefined { - return this.get('summary'); - } - - set summary(summary: StringElement | undefined) { - this.set('summary', summary); - } - - get description(): StringElement | undefined { - return this.get('description'); - } - - set description(description: StringElement | undefined) { - this.set('description', description); - } - - get security(): ArrayElement | undefined { - return this.get('security'); - } - - set security(security: ArrayElement | undefined) { - this.set('security', security); - } - - get tags(): TagsElement | undefined { - return this.get('tags'); - } - - set tags(tags: TagsElement | undefined) { - this.set('tags', tags); - } - - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any{ return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { this.set('externalDocs', externalDocs); } - - get bindings(): OperationBindingsElement | ReferenceElement | undefined { - return this.get('bindings'); - } - - set bindings(bindings: OperationBindingsElement | ReferenceElement | undefined) { - this.set('bindings', bindings); - } } export default OperationTrait; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts index cc4f4cf8c3..71ce6fc9ce 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts @@ -1,85 +1,8 @@ -import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; -import AsyncApi3Element from './AsyncApi3.ts'; -import ComponentsElement from './Components.ts'; -import ChannelsElement from './Channels.ts'; -import DefaultContentTypeElement from './DefaultContentType.ts'; -import InfoElement from './Info.ts'; -import OperationsElement from './Operations.ts'; -import ServersElement from './Servers.ts'; - +import { SchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ -class Schema extends ObjectElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'schema'; - } - - get asyncapi(): AsyncApi3Element | undefined { - return this.get('asyncapi'); - } - - set asyncapi(asyncapi: AsyncApi3Element | undefined) { - this.set('asyncapi', asyncapi); - } - - get idProp(): string | undefined { - return this.get('idProp'); - } - - set idProp(idProp: string | undefined) { - this.set('idProp', idProp); - } - - get info(): InfoElement | undefined { - return this.get('info'); - } - - set info(info: InfoElement | undefined) { - this.set('info', info); - } - - get servers(): ServersElement | undefined { - return this.get('servers'); - } - - set servers(servers: ServersElement | undefined) { - this.set('servers', servers); - } - - get defaultContentType(): DefaultContentTypeElement | undefined { - return this.get('defaultContentType'); - } - - set defaultContentType(defaultContentType: DefaultContentTypeElement | undefined) { - this.set('defaultContentType', defaultContentType); - } - - get channels(): ChannelsElement | undefined { - return this.get('channels'); - } - - set channels(channels: ChannelsElement | undefined) { - this.set('channels', channels); - } - - get operations(): OperationsElement | undefined { - return this.get('operations'); - } - - set operations(operations: OperationsElement | undefined) { - this.set('operations', operations); - } - - get components(): ComponentsElement | undefined { - return this.get('components'); - } - - set components(components: ComponentsElement | undefined) { - this.set('components', components); - } -} +class Schema extends SchemaElement {} -export default Schema; +export default Schema; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts index 1aaa807ea4..6657f9e2fe 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -1,5 +1,5 @@ import { ArrayElement, Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; -import { ServerBindingsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { ServerBindingsElement, ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; import TagsElement from './Tags.ts'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; @@ -7,7 +7,7 @@ import ReferenceElement from './Reference.ts'; /** * @public */ -class Server extends ObjectElement { +class Server extends ServerElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'server'; @@ -21,22 +21,6 @@ class Server extends ObjectElement { this.set('host', host); } - get protocol(): StringElement | undefined { - return this.get('protocol'); - } - - set protocol(protocol: StringElement | undefined) { - this.set('protocol', protocol); - } - - get protocolVersion(): StringElement | undefined { - return this.get('protocolVersion'); - } - - set protocolVersion(protocolVersion: StringElement | undefined) { - this.set('protocolVersion', protocolVersion); - } - get pathName(): StringElement | undefined { return this.get('pathName'); } @@ -68,30 +52,6 @@ class Server extends ObjectElement { set summary(summary: StringElement | undefined) { this.set('summary', summary); } - - get variables(): ObjectElement | undefined { - return this.get('variables'); - } - - set variables(variables: ObjectElement | undefined) { - this.set('variables', variables); - } - - get security(): ArrayElement | undefined { - return this.get('security'); - } - - set security(security: ArrayElement | undefined) { - this.set('security', security); - } - - get tags(): TagsElement | undefined { - return this.get('tags'); - } - - set tags(tags: TagsElement | undefined) { - this.set('tags', tags); - } get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { return this.get('externalDocs'); @@ -100,15 +60,6 @@ class Server extends ObjectElement { set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { this.set('externalDocs', externalDocs); } - - get bindings(): ServerBindingsElement | undefined { - return this.get('bindings'); - } - - set bindings(bindings: ServerBindingsElement | undefined) { - this.set('bindings', bindings); - } - } export default Server; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts index 3d9343475e..9b3ee36e3b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts @@ -1,34 +1,19 @@ import { ObjectElement, Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; +import { TagElement } from '@swagger-api/apidom-ns-asyncapi-2'; -class Tag extends ObjectElement { +class Tag extends TagElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'tag'; } - get name(): StringElement | undefined { - return this.get('name'); - } - - set name(name: StringElement | undefined) { - this.set('name', name); - } - - get description(): StringElement | undefined { - return this.get('description'); - } - - set description(description: StringElement | undefined) { - this.set('description', description); - } - - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { this.set('externalDocs', externalDocs); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts new file mode 100644 index 0000000000..7396c7595a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts @@ -0,0 +1,14 @@ +import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; +/** + * @public + */ +class ChannelServers extends ArrayElement { + static primaryClass = 'channel-server-names-list'; + + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ChannelServers.primaryClass); + } +} + +export default ChannelServers; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentOperations.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentOperations.ts new file mode 100644 index 0000000000..24f8e5fb03 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentOperations.ts @@ -0,0 +1,14 @@ +import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; +/** + * @public + */ +class ComponentOperations extends ArrayElement { + static primaryClass = 'component-operations-list'; + + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push( ComponentOperations.primaryClass); + } +} + +export default ComponentOperations; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsSchemas.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsSchemas.ts new file mode 100644 index 0000000000..722cbf00a6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsSchemas.ts @@ -0,0 +1,8 @@ +import { ComponentsSchemasElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class ComponentsSchemas extends ComponentsSchemasElement {} + +export default ComponentsSchemas; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/MessageExamples.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/MessageExamples.ts new file mode 100644 index 0000000000..5620fb7b1a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/MessageExamples.ts @@ -0,0 +1,8 @@ +import { MessageExamplesElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class MessageExamples extends MessageExamplesElement {} + +export default MessageExamples; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/MessageTraits.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/MessageTraits.ts new file mode 100644 index 0000000000..37b584454c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/MessageTraits.ts @@ -0,0 +1,8 @@ +import { MessageTraitsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class MessageTraits extends MessageTraitsElement {} + +export default MessageTraits; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts new file mode 100644 index 0000000000..59e697313e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts @@ -0,0 +1,8 @@ +import { OperationMessageElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class OperationMessage extends OperationMessageElement { } + +export default OperationMessage; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationSecurity.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationSecurity.ts new file mode 100644 index 0000000000..060187365d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationSecurity.ts @@ -0,0 +1,8 @@ +import { OperationSecurityElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class OperationSecurity extends OperationSecurityElement {} + +export default OperationSecurity; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraits.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraits.ts new file mode 100644 index 0000000000..fced8c789f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraits.ts @@ -0,0 +1,8 @@ +import { OperationTraitsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class OperationTraits extends OperationTraitsElement {} + +export default OperationTraits; diff --git a/packages/apidom-ns-asyncapi-3/src/media-types.ts b/packages/apidom-ns-asyncapi-3/src/media-types.ts index e72c915892..af513ad369 100644 --- a/packages/apidom-ns-asyncapi-3/src/media-types.ts +++ b/packages/apidom-ns-asyncapi-3/src/media-types.ts @@ -32,7 +32,6 @@ const mediaTypes = new AsyncAPIMediaTypes( 'application/vnd.asyncapi;version=3.0.1', 'application/vnd.asyncapi+json;version=3.0.1', 'application/vnd.asyncapi+yaml;version=3.0.1', - // Add legacy vendor prefix aliases similar to v2 to aid content negotiation 'application/vnd.aai.asyncapi;version=3.0.0', 'application/vnd.aai.asyncapi+json;version=3.0.0', 'application/vnd.aai.asyncapi+yaml;version=3.0.0', diff --git a/packages/apidom-ns-asyncapi-3/src/predicates.ts b/packages/apidom-ns-asyncapi-3/src/predicates.ts index 385a7448b5..206a582117 100644 --- a/packages/apidom-ns-asyncapi-3/src/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/predicates.ts @@ -1,4 +1,5 @@ -import { isElement } from '@swagger-api/apidom-core'; +import { createPredicate, isElement } from '@swagger-api/apidom-core'; +import MultiFormatSchemaElement from './elements/MultiFormatSchema.ts'; export const isAsyncApi3Element = (node: unknown) => isElement(node) && node.element === 'asyncApi3'; @@ -7,5 +8,12 @@ export const isChannelsElement = (node: unknown) => isElement(node) && node.elem export const isComponentsElement = (node: unknown) => isElement(node) && node.element === 'components'; export const isMessageElement = (node: unknown) => isElement(node) && node.element === 'message'; - -export default {}; +export const isMultiFormatSchemaElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is MultiFormatSchemaElement => + element instanceof MultiFormatSchemaElement || + (hasBasicElementProps(element) && + isElementType('multiFormatSchema', element) && + primitiveEq('object', element)); + }, +); \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 0dbf9a9a56..c6a86d29a3 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -1,25 +1,49 @@ +import { specificationObj as AsyncApi2_0Specification } from '@swagger-api/apidom-ns-asyncapi-2'; + import FallbackVisitor from './visitors/FallbackVisitor.ts'; -import AsyncApi3Visitor from './visitors/async-api-3/AsyncApi3Visitor.ts'; +import AsyncApi3Visitor from './visitors/async-api-3/index.ts'; import AsyncApiVersionVisitor from './visitors/async-api-3/AsyncApiVersionVisitor.ts'; import IdentifierVisitor from './visitors/async-api-3/IdentifierVisitor.ts'; -import InfoVisitor from './visitors/async-api-3/info/InfoVisitor.ts'; -import ChannelsVisitor from './visitors/async-api-3/channels/ChannelsVisitor.ts'; -import ComponentsVisitor from './visitors/async-api-3/components/ComponentsVisitor.ts'; +import InfoVisitor from './visitors/async-api-3/info/info.ts'; +import ChannelsVisitor from './visitors/async-api-3/channels/index.ts'; +import ChannelVisitor from './visitors/async-api-3/channel/index.ts'; +import ChannelServersVisitor from './visitors/async-api-3/channel/ServersVisitor.ts'; +import ExternalDocsVisitor from './visitors/generics/ExternalDocumentationVisitor.ts'; +import ChanneBindingsVisitor from './visitors/async-api-3/channel/BindingsVisitor.ts'; +import ComponentsVisitor from './visitors/async-api-3/components/index.ts'; +import ComponentsSchemasVisitor from './visitors/async-api-3/components/SchemasVisitor.ts'; +import ComponentsOperationsVisitor from './visitors/async-api-3/components/OperationsVisitor.ts'; +import DefaultContentTypeVisitor from '../elements/DefaultContentType.ts'; import SecuritySchemesVisitor from './visitors/async-api-3/SecuritySchemesVisitor.ts'; -import MessageVisitor from './visitors/async-api-3/message/MessageVisitor.ts'; import ServerVisitor from './visitors/async-api-3/server/ServerVisitor.ts'; import ServerVariableVisitor from './visitors/async-api-3/server/ServerVariableVisitor.ts'; import ParametersVisitor from './visitors/async-api-3/ParametersVisitor.ts'; import BindingsVisitor from './visitors/async-api-3/BindingsVisitor.ts'; -import TagsVisitor from './visitors/async-api-3/TagsVisitor.ts'; +import TagsVisitor from './visitors/async-api-3/tags/index.ts'; import ExternalDocumentationVisitor from './visitors/async-api-3/ExternalDocumentationVisitor.ts'; -import ChannelItemVisitor from './visitors/async-api-3/channel/ChanneVisitor.ts'; + import OperationVisitor from './visitors/async-api-3/operation/OperationVisitor.ts'; -import OperationMessageVisitor from './visitors/async-api-3/operation/OperationMessageVisitor.ts'; -import SchemaVisitor from './visitors/async-api-3/schema/SchemaVisitor.ts'; -import ReferenceVisitor from './visitors/async-api-3/reference/ReferenceVisitor.ts'; +import OperationsVisitor from './visitors/async-api-3/operations/index.ts'; +import OperationMessagesVisitor from './visitors/async-api-3/operation/MessagesVisitor.ts'; +import OperationBindingsVisitor from './visitors/async-api-3/operation/BindingsVisitor.ts'; +import OperationTraitsVisitor from './visitors/async-api-3/operation/TraitsVisitor.ts'; +import OperationSecurityVisitor from './visitors/async-api-3/operation/SecurityVisitor.ts'; +import SchemaVisitor from './visitors/async-api-3/schema/index.ts'; +import ReferenceVisitor from './visitors/async-api-3/reference/index.ts'; import ContactVisitor from './visitors/async-api-3/contact/index.ts'; import LicenseVisitor from './visitors/async-api-3/license/index.ts'; +import TagVisitor from './visitors/async-api-3/tag/index.ts'; +import MessagesVisitor from './visitors/async-api-3/messages/index.ts'; +import MessageVisitor from './visitors/async-api-3/message/index.ts'; +import MessageExamplesVisitor from './visitors/async-api-3/message/ExamplesVisitor.ts'; +import MessageExampleVisitor from './visitors/async-api-3/message-example/index.ts'; +import MessageBindingsVisitor from './visitors/async-api-3/message/BindingsVisitor.ts'; +import MessageHeadersVisitor from './visitors/async-api-3/message/HeadersVisitor.ts'; +import MessageTraitsVisitor from './visitors/async-api-3/message/TraitsVisitor.ts'; +import MessageCorrelationIdVisitor from './visitors/async-api-3/message/CorrelationIdVisitor.ts'; +import OperationReplyVisitor from './visitors/async-api-3/operationReply/index.ts'; +import ServersVisitor from './visitors/async-api-3/server/ServersVisitor.ts'; +import MultiFormatSchemaVisitor from './visitors/async-api-3/multiFormatSchema/index.ts' const specification = { visitors: { @@ -52,16 +76,12 @@ const specification = { $visitor: InfoVisitor, fixedFields: { title: { $ref: '#/visitors/value' }, - version: { $ref: '#/visitors/value' }, + version: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.version, description: { $ref: '#/visitors/value' }, termsOfService: { $ref: '#/visitors/value' }, contact: { $ref: '#/visitors/document/objects/Contact' }, - license: { - $ref: '#/visitors/document/objects/License', - }, - externalDocs: { - $ref: '#/visitors/document/objects/ExternalDocumentation', - }, + license: { $ref: '#/visitors/document/objects/License' }, + externalDocs: ExternalDocsVisitor, tags: { $ref: '#/visitors/document/objects/Tags', }, @@ -83,25 +103,84 @@ const specification = { }, }, Servers: { - $visitor: ServerVisitor, // TODO: Should be ServersVisitor ? + $visitor: ServersVisitor, + }, + Server: { + $visitor: ServerVisitor, fixedFields: { - // server entries are dynamic keys - handled by ChannelsVisitor/ServersVisitor in full impl + host: { $ref: '#/visitors/value' }, + protocol: { $ref: '#/visitors/value' }, + protocolVersion: { $ref: '#/visitors/value' }, + pathname: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + title: { $ref: '#/visitors/value' }, + summary: { $ref: '#/visitors/value' }, + variables: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.variables, + security:AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.security, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + externalDocs: ExternalDocumentationVisitor, + bindings: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.bindings, }, }, ServerVariable: { $visitor: ServerVariableVisitor, + fixedFields: { + enum: { $ref: '#/visitors/value' }, + default: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + examples: { $ref: '#/visitors/value' }, + }, + }, + DefaultContentType: { + $visitor: DefaultContentTypeVisitor, }, Channels: { $visitor: ChannelsVisitor, }, - Tags: { - $visitor: TagsVisitor, + Channel: { + $visitor: ChannelVisitor, + fixedFields: { + address: { $ref: '#/visitors/value' }, + messages: { $ref: '#/visitors/value' }, + title: { $ref: '#/visitors/value' }, + summary: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + servers: ChannelServersVisitor, + parameters: { $ref: '#/visitors/value' }, + tags: { $ref: '#/visitors/document/objects/Tags' }, + externalDocs: ExternalDocsVisitor, + bindings: ChanneBindingsVisitor, + }, }, - ExternalDocumentation: { - $visitor: ExternalDocumentationVisitor, + Operations: { + $visitor: OperationsVisitor, + }, + Operation: { + $visitor: OperationVisitor, fixedFields: { + action: { $ref: '#/visitors/value' }, + channel: { $ref: '#/visitors/value' }, + title: { $ref: '#/visitors/value' }, + summary: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, - url: { $ref: '#/visitors/value' }, + security: OperationSecurityVisitor, + tags: { $ref: '#/visitors/document/objects/Tags' }, + externalDocs: ExternalDocsVisitor, + bindings: OperationBindingsVisitor, + traits: OperationTraitsVisitor, + message: OperationMessagesVisitor, + reply: OperationReplyVisitor, + + }, + }, + OperationReply: { + $visitor: OperationReplyVisitor, + fixedFields: { + address: { $ref: '#/visitors/value' }, + channel: { $ref: '#/visitors/value' }, + messages: { $ref: '#/visitors/value' }, }, }, Parameters: { @@ -110,46 +189,147 @@ const specification = { Bindings: { $visitor: BindingsVisitor, }, - ChannelItem: { - $visitor: ChannelItemVisitor, + MessageBindings: { + $visitor: MessageBindingsVisitor, fixedFields: { - description: { $ref: '#/visitors/value' }, - subscribe: { $ref: '#/visitors/document/objects/Operation' }, - publish: { $ref: '#/visitors/document/objects/Operation' }, - parameters: { $ref: '#/visitors/document/objects/Parameters' }, - bindings: { $ref: '#/visitors/document/objects/Bindings' }, + http: { + $ref: '#/visitors/document/objects/bindings/http/MessageBinding', + }, + ws: { + $ref: '#/visitors/document/objects/bindings/ws/MessageBinding', + }, + kafka: { + $ref: '#/visitors/document/objects/bindings/kafka/MessageBinding', + }, + anypointmq: { + $ref: '#/visitors/document/objects/bindings/anypointmq/MessageBinding', + }, + amqp: { + $ref: '#/visitors/document/objects/bindings/amqp/MessageBinding', + }, + amqp1: { + $ref: '#/visitors/document/objects/bindings/amqp1/MessageBinding', + }, + mqtt: { + $ref: '#/visitors/document/objects/bindings/mqtt/MessageBinding', + }, + mqtt5: { + $ref: '#/visitors/document/objects/bindings/mqtt5/MessageBinding', + }, + nats: { + $ref: '#/visitors/document/objects/bindings/nats/MessageBinding', + }, + jms: { + $ref: '#/visitors/document/objects/bindings/jms/MessageBinding', + }, + sns: { + $ref: '#/visitors/document/objects/bindings/sns/MessageBinding', + }, + solace: { + $ref: '#/visitors/document/objects/bindings/solace/MessageBinding', + }, + sqs: { + $ref: '#/visitors/document/objects/bindings/sqs/MessageBinding', + }, + stomp: { + $ref: '#/visitors/document/objects/bindings/stomp/MessageBinding', + }, + redis: { + $ref: '#/visitors/document/objects/bindings/redis/MessageBinding', + }, + mercure: { + $ref: '#/visitors/document/objects/bindings/mercure/MessageBinding', + }, + ibmmq: { + $ref: '#/visitors/document/objects/bindings/ibmmq/MessageBinding', + }, + googlepubsub: { + $ref: '#/visitors/document/objects/bindings/googlepubsub/MessageBinding', + }, + pulsar: { + $ref: '#/visitors/document/objects/bindings/pulsar/MessageBinding', + }, }, }, Components: { $visitor: ComponentsVisitor, fixedFields: { - securitySchemes: { $ref: '#/visitors/document/objects/SecuritySchemes' }, + schemas: ComponentsSchemasVisitor, + servers: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.servers, + channels: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channels, + serverVariables: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverVariables, + operations: ComponentsOperationsVisitor, + messages: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messages, + securitySchemes: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.securitySchemes, + parameters: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.parameters, + correlationIds: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.correlationIds, + replies: { $ref: '#/visitors/value' }, + replyAddresses: { $ref: '#/visitors/value' }, + tags: { $ref: '#/visitors/document/objects/Tags' },, + externalDocs: ExternalDocumentationVisitor, + operationTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationTraits, + messageTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageTraits, + serverBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverBindings, + channelBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channelBindings, + operationBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationBindings, + messageBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageBindings }, }, SecuritySchemes: { $visitor: SecuritySchemesVisitor, }, - Operation: { - $visitor: OperationVisitor, + OperationMessage: { + $visitor: MessageVisitor, + }, + Messages: { + $visitor: MessagesVisitor + }, + Message: { + $visitor: MessageVisitor, fixedFields: { - operationId: { $ref: '#/visitors/value' }, + headers: MessageHeadersVisitor, + payload: { $ref: '#/visitors/document/objects/Schema' }, + correlationId: MessageCorrelationIdVisitor, + contetType: { $ref: '#/visitors/value' }, + name: { $ref: '#/visitors/value' }, + title: { $ref: '#/visitors/value' }, summary: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, - message: { $ref: '#/visitors/document/objects/OperationMessage' }, - tags: { $ref: '#/visitors/document/objects/Tags' }, - bindings: { $ref: '#/visitors/document/objects/Bindings' }, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + externalDocs: ExternalDocumentationVisitor, + bindings: MessageBindingsVisitor, + examples: MessageExamplesVisitor, + traits: MessageTraitsVisitor }, }, - OperationMessage: { - $visitor: OperationMessageVisitor, + MessageExample: { + $visitor: MessageExampleVisitor, + fixedFields: { + headers: { $ref: '#/visitors/value' }, + payload: { $ref: '#/visitors/value' }, + name: { $ref: '#/visitors/value' }, + summary: { $ref: '#/visitors/value' }, + }, }, - Message: { - $visitor: MessageVisitor, + tags: { + $visitor: TagsVisitor, + }, + Tag: { + $visitor: TagVisitor, fixedFields: { - payload: { $ref: '#/visitors/document/objects/Schema' }, - headers: { $ref: '#/visitors/document/objects/Schema' }, - examples: { $ref: '#/visitors/value' }, + name: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + externalDocs: ExternalDocsVisitor, + }, + }, + ExternalDocumentation: { + $visitor: ExternalDocumentationVisitor, + fixedFields: { + description: { $ref: '#/visitors/value' }, + url: { $ref: '#/visitors/value' }, }, }, Schema: { @@ -160,6 +340,14 @@ const specification = { properties: { $ref: '#/visitors/document/objects/Schema' }, }, }, + MultiFormatSchema: { + $visitor: MultiFormatSchemaVisitor, + fixedFields: { + $shemaFormat: { $ref: '#/visitors/document/objects/SchemaFormat' }, + $schema: { $ref: '#/visitors/document/objects/Schema' }, + properties: { $ref: '#/visitors/document/objects/MultiFormatSchema' }, + }, + }, Reference: { $visitor: ReferenceVisitor, fixedFields: { diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts b/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts index 517865e16f..c45ded0a62 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts @@ -1,3 +1,13 @@ -const createToolbox = () => ({ /* minimal toolbox placeholder */ }); +import { createNamespace, isStringElement } from '@swagger-api/apidom-core'; + +import * as asyncApi3Predicates from '../predicates.ts'; +import asyncApi2Namespace from '../namespace.ts'; + +const createToolbox = () => { + const namespace = createNamespace(asyncApi2Namespace); + const predicates = { ...asyncApi3Predicates, isStringElement }; + + return { predicates, namespace }; +}; export default createToolbox; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts new file mode 100644 index 0000000000..4d073f8f6a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + DefaultContentTypeVisitorOptions, + DefaultContentTypeVisitor as DefaultContentTypeVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import DefaultContentTypeElement from '../../elements/DefaultContentType.ts'; + +export const BaseDefaultContentTypeVisitor: typeof DefaultContentTypeVisitorType = + AsyncApi2Specification.visitors.document.objects.DefaultContentType.$visitor; + +export type { DefaultContentTypeVisitorOptions }; + +class DefaultContentTypeVisitor extends BaseDefaultContentTypeVisitor { + declare public readonly element: DefaultContentTypeElement; + + constructor(options: DefaultContentTypeVisitorOptions) { + super(options); + this.element = new DefaultContentTypeElement(); + } +} + +export default DefaultContentTypeVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts deleted file mode 100644 index 8521a25a8b..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/AsyncApi3Visitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class AsyncApi3Visitor extends Visitor {} - -export default AsyncApi3Visitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts deleted file mode 100644 index 321dee9d66..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/TagsVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class TagsVisitor extends Visitor {} - -export default TagsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts new file mode 100644 index 0000000000..e4153eaaf2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AmqpChannelBindingElement from '../../../../../../elements/bindings/amqp/AmqpChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AmqpChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AmqpChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AmqpChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AmqpChannelBindingVisitorOptions) { + super(options); + this.element = new AmqpChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AmqpChannelBindingVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/message-binding/index.ts new file mode 100644 index 0000000000..cc7817c244 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AmqpMessageBindingElement from '../../../../../../elements/bindings/amqp/AmqpMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AmqpMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AmqpMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AmqpMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AmqpMessageBindingVisitorOptions) { + super(options); + this.element = new AmqpMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AmqpMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/operation-binding/index.ts new file mode 100644 index 0000000000..245a397777 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AmqpOperationBindingElement from '../../../../../../elements/bindings/amqp/AmqpOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AmqpOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AmqpOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AmqpOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AmqpOperationBindingVisitorOptions) { + super(options); + this.element = new AmqpOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AmqpOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/server-binding/index.ts new file mode 100644 index 0000000000..fe0dd73353 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AmqpServerBindingElement from '../../../../../../elements/bindings/amqp/AmqpServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AmqpServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AmqpServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AmqpServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AmqpServerBindingVisitorOptions) { + super(options); + this.element = new AmqpServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AmqpServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/channel-binding/index.ts new file mode 100644 index 0000000000..51812aed5d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Amqp1ChannelBindingElement from '../../../../../../elements/bindings/amqp1/Amqp1ChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Amqp1ChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Amqp1ChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Amqp1ChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp1', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Amqp1ChannelBindingVisitorOptions) { + super(options); + this.element = new Amqp1ChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp1', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Amqp1ChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/message-binding/index.ts new file mode 100644 index 0000000000..5f6005380d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Amqp1MessageBindingElement from '../../../../../../elements/bindings/amqp1/Amqp1MessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Amqp1MessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Amqp1MessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Amqp1MessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp1', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Amqp1MessageBindingVisitorOptions) { + super(options); + this.element = new Amqp1MessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp1', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Amqp1MessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/operation-binding/index.ts new file mode 100644 index 0000000000..6aaf23e718 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Amqp1OperationBindingElement from '../../../../../../elements/bindings/amqp1/Amqp1OperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Amqp1OperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Amqp1OperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Amqp1OperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp1', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Amqp1OperationBindingVisitorOptions) { + super(options); + this.element = new Amqp1OperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp1', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Amqp1OperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/server-binding/index.ts new file mode 100644 index 0000000000..68c4798098 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp1/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Amqp1ServerBindingElement from '../../../../../../elements/bindings/amqp1/Amqp1ServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Amqp1ServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Amqp1ServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Amqp1ServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp1', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Amqp1ServerBindingVisitorOptions) { + super(options); + this.element = new Amqp1ServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp1', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Amqp1ServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/channel-binding/index.ts new file mode 100644 index 0000000000..60e90e73bf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AnypointmqChannelBindingElement from '../../../../../../elements/bindings/anypointmq/AnypointmqChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AnypointmqChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AnypointmqChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AnypointmqChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'anypointmq', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AnypointmqChannelBindingVisitorOptions) { + super(options); + this.element = new AnypointmqChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'anypointmq', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AnypointmqChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/message-binding/index.ts new file mode 100644 index 0000000000..5bf1416fd3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AnypointmqMessageBindingElement from '../../../../../../elements/bindings/anypointmq/AnypointmqMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AnypointmqMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AnypointmqMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AnypointmqMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'anypointmq', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AnypointmqMessageBindingVisitorOptions) { + super(options); + this.element = new AnypointmqMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'anypointmq', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AnypointmqMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/operation-binding/index.ts new file mode 100644 index 0000000000..cc05573833 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AnypointmqOperationBindingElement from '../../../../../../elements/bindings/anypointmq/AnypointmqOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AnypointmqOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AnypointmqOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AnypointmqOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'anypointmq', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AnypointmqOperationBindingVisitorOptions) { + super(options); + this.element = new AnypointmqOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'anypointmq', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AnypointmqOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/server-binding/index.ts new file mode 100644 index 0000000000..7d2d395432 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/anypointmq/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import AnypointmqServerBindingElement from '../../../../../../elements/bindings/anypointmq/AnypointmqServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface AnypointmqServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AnypointmqServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AnypointmqServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'anypointmq', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: AnypointmqServerBindingVisitorOptions) { + super(options); + this.element = new AnypointmqServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'anypointmq', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default AnypointmqServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/channel-binding/index.ts new file mode 100644 index 0000000000..503e1f61ce --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import GooglepubsubChannelBindingElement from '../../../../../../elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface GooglepubsubChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class GooglepubsubChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: GooglepubsubChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'googlepubsub', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: GooglepubsubChannelBindingVisitorOptions) { + super(options); + this.element = new GooglepubsubChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'googlepubsub', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default GooglepubsubChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/message-binding/index.ts new file mode 100644 index 0000000000..312caeef1b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import GooglepubsubMessageBindingElement from '../../../../../../elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface GooglepubsubMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class GooglepubsubMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: GooglepubsubMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'googlepubusb', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: GooglepubsubMessageBindingVisitorOptions) { + super(options); + this.element = new GooglepubsubMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'googlepubusb', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default GooglepubsubMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/operation-binding/index.ts new file mode 100644 index 0000000000..10acf84eb6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import GooglepubsubOperationBindingElement from '../../../../../../elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface GooglepubsubOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class GooglepubsubOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: GooglepubsubOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'googlepubsub', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: GooglepubsubOperationBindingVisitorOptions) { + super(options); + this.element = new GooglepubsubOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'googlepubsub', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default GooglepubsubOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/server-binding/index.ts new file mode 100644 index 0000000000..3b736bd1ee --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/googlepubsub/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import GooglepubsubServerBindingElement from '../../../../../../elements/bindings/googlepubsub/GooglepubsubServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface GooglepubsubServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class GooglepubsubServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: GooglepubsubServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'googlepubsub', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: GooglepubsubServerBindingVisitorOptions) { + super(options); + this.element = new GooglepubsubServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'googlepubsub', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default GooglepubsubServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/channel-binding/index.ts new file mode 100644 index 0000000000..fc7a33106e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import HttpChannelBindingElement from '../../../../../../elements/bindings/http/HttpChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface HttpChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class HttpChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: HttpChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'http', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: HttpChannelBindingVisitorOptions) { + super(options); + this.element = new HttpChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'http', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default HttpChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/message-binding/index.ts new file mode 100644 index 0000000000..8de2a9aa67 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import HttpMessageBindingElement from '../../../../../../elements/bindings/http/HttpMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface HttpMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class HttpMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: HttpMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'http', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: HttpMessageBindingVisitorOptions) { + super(options); + this.element = new HttpMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'http', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default HttpMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/operation-binding/index.ts new file mode 100644 index 0000000000..1ad75c4cf6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import HttpOperationBindingElement from '../../../../../../elements/bindings/http/HttpOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface HttpOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class HttpOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: HttpOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'http', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: HttpOperationBindingVisitorOptions) { + super(options); + this.element = new HttpOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'http', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default HttpOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/server-binding/index.ts new file mode 100644 index 0000000000..251d388b04 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/http/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import HttpServerBindingElement from '../../../../../../elements/bindings/http/HttpServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface HttpServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class HttpServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: HttpServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'http', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: HttpServerBindingVisitorOptions) { + super(options); + this.element = new HttpServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'http', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default HttpServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/channel-binding/index.ts new file mode 100644 index 0000000000..6e7d9c5ae8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import IbmmqChannelBindingElement from '../../../../../../elements/bindings/ibmmq/IbmmqChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface IbmmqChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class IbmmqChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: IbmmqChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ibmmq', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: IbmmqChannelBindingVisitorOptions) { + super(options); + this.element = new IbmmqChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ibmmq', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default IbmmqChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/message-binding/index.ts new file mode 100644 index 0000000000..ab2e7f441d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import IbmmqMessageBindingElement from '../../../../../../elements/bindings/ibmmq/IbmmqMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface IbmmqMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class IbmmqMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: IbmmqMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ibmmq', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: IbmmqMessageBindingVisitorOptions) { + super(options); + this.element = new IbmmqMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ibmmq', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default IbmmqMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/operation-binding/index.ts new file mode 100644 index 0000000000..4274f28487 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import IbmmqOperationBindingElement from '../../../../../../elements/bindings/ibmmq/IbmmqOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface IbmmqOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class IbmmqOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: IbmmqOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ibmmq', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: IbmmqOperationBindingVisitorOptions) { + super(options); + this.element = new IbmmqOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ibmmq', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default IbmmqOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/server-binding/index.ts new file mode 100644 index 0000000000..b59ac03eab --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ibmmq/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import IbmmqServerBindingElement from '../../../../../../elements/bindings/ibmmq/IbmmqServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface IbmmqServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class IbmmqServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: IbmmqServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ibmmq', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: IbmmqServerBindingVisitorOptions) { + super(options); + this.element = new IbmmqServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ibmmq', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default IbmmqServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts new file mode 100644 index 0000000000..68c4798098 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Amqp1ServerBindingElement from '../../../../../../elements/bindings/amqp1/Amqp1ServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Amqp1ServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Amqp1ServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Amqp1ServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'amqp1', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Amqp1ServerBindingVisitorOptions) { + super(options); + this.element = new Amqp1ServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'amqp1', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Amqp1ServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/channel-binding/index.ts new file mode 100644 index 0000000000..f0e23f9dce --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import JmsChannelBindingElement from '../../../../../../elements/bindings/jms/JmsChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface JmsChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class JmsChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: JmsChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'jms', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: JmsChannelBindingVisitorOptions) { + super(options); + this.element = new JmsChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'jms', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default JmsChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/message-binding/index.ts new file mode 100644 index 0000000000..85ec32cbcf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import JmsMessageBindingElement from '../../../../../../elements/bindings/jms/JmsMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface JmsMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class JmsMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: JmsMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'jms', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: JmsMessageBindingVisitorOptions) { + super(options); + this.element = new JmsMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'jms', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default JmsMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/operation-binding/index.ts new file mode 100644 index 0000000000..161c16c75d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import JmsOperationBindingElement from '../../../../../../elements/bindings/jms/JmsOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface JmsOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class JmsOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: JmsOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'jms', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: JmsOperationBindingVisitorOptions) { + super(options); + this.element = new JmsOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'jms', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default JmsOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/server-binding/index.ts new file mode 100644 index 0000000000..3a903935a7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/jms/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import JmsServerBindingElement from '../../../../../../elements/bindings/jms/JmsServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface JmsServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class JmsServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: JmsServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'jms', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: JmsServerBindingVisitorOptions) { + super(options); + this.element = new JmsServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'jms', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default JmsServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/channel-binding/index.ts new file mode 100644 index 0000000000..fa697909c9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import KafkaChannelBindingElement from '../../../../../../elements/bindings/kafka/KafkaChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface KafkaChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class KafkaChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: KafkaChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'kafka', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: KafkaChannelBindingVisitorOptions) { + super(options); + this.element = new KafkaChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'kafka', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default KafkaChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/message-binding/index.ts new file mode 100644 index 0000000000..c4d2fb7e5c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import KafkaMessageBindingElement from '../../../../../../elements/bindings/kafka/KafkaMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface KafkaMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class KafkaMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: KafkaMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'kafka', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: KafkaMessageBindingVisitorOptions) { + super(options); + this.element = new KafkaMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'kafka', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default KafkaMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/operation-binding/index.ts new file mode 100644 index 0000000000..3146f05960 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import KafkaOperationBindingElement from '../../../../../../elements/bindings/kafka/KafkaOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface KafkaOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class KafkaOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: KafkaOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'kafka', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: KafkaOperationBindingVisitorOptions) { + super(options); + this.element = new KafkaOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'kafka', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default KafkaOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/server-binding/index.ts new file mode 100644 index 0000000000..f8f33c3a4e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/kafka/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import KafkaServerBindingElement from '../../../../../../elements/bindings/kafka/KafkaServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface KafkaServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class KafkaServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: KafkaServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'kafka', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: KafkaServerBindingVisitorOptions) { + super(options); + this.element = new KafkaServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'kafka', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default KafkaServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/channel-binding/index.ts new file mode 100644 index 0000000000..11d1e5b51b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MercureChannelBindingElement from '../../../../../../elements/bindings/mercure/MercureChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MercureChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MercureChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MercureChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mercure', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MercureChannelBindingVisitorOptions) { + super(options); + this.element = new MercureChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mercure', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MercureChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/message-binding/index.ts new file mode 100644 index 0000000000..4878575ca9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MercureMessageBindingElement from '../../../../../../elements/bindings/mercure/MercureMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MercureMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MercureMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MercureMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mercure', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MercureMessageBindingVisitorOptions) { + super(options); + this.element = new MercureMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mercure', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MercureMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/operation-binding/index.ts new file mode 100644 index 0000000000..db83070c99 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MercureOperationBindingElement from '../../../../../../elements/bindings/mercure/MercureOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MercureOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MercureOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MercureOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mercure', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MercureOperationBindingVisitorOptions) { + super(options); + this.element = new MercureOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mercure', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MercureOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/server-binding/index.ts new file mode 100644 index 0000000000..2ca51b5e0a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mercure/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MercureServerBindingElement from '../../../../../../elements/bindings/mercure/MercureServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MercureServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MercureServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MercureServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mercure', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MercureServerBindingVisitorOptions) { + super(options); + this.element = new MercureServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mercure', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MercureServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/channel-binding/index.ts new file mode 100644 index 0000000000..2a69a82232 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MqttChannelBindingElement from '../../../../../../elements/bindings/mqtt/MqttChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MqttChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MqttChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MqttChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MqttChannelBindingVisitorOptions) { + super(options); + this.element = new MqttChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MqttChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/message-binding/index.ts new file mode 100644 index 0000000000..15c529edb6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MqttMessageBindingElement from '../../../../../../elements/bindings/mqtt/MqttMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MqttMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MqttMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MqttMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MqttMessageBindingVisitorOptions) { + super(options); + this.element = new MqttMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MqttMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/operation-binding/index.ts new file mode 100644 index 0000000000..4baf02ff24 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MqttOperationBindingElement from '../../../../../../elements/bindings/mqtt/MqttOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MqttOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MqttOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MqttOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MqttOperationBindingVisitorOptions) { + super(options); + this.element = new MqttOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MqttOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/server-binding/index.ts new file mode 100644 index 0000000000..ff7a79a1b4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MqttServerBindingElement from '../../../../../../elements/bindings/mqtt/MqttServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MqttServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MqttServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MqttServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MqttServerBindingVisitorOptions) { + super(options); + this.element = new MqttServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default MqttServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/channel-binding/index.ts new file mode 100644 index 0000000000..31668d6fd8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Mqtt5ChannelBindingElement from '../../../../../../elements/bindings/mqtt5/Mqtt5ChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Mqtt5ChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Mqtt5ChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Mqtt5ChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt5', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Mqtt5ChannelBindingVisitorOptions) { + super(options); + this.element = new Mqtt5ChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt5', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Mqtt5ChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/message-binding/index.ts new file mode 100644 index 0000000000..c13012d49c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Mqtt5MessageBindingElement from '../../../../../../elements/bindings/mqtt5/Mqtt5MessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Mqtt5MessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Mqtt5MessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Mqtt5MessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt5', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Mqtt5MessageBindingVisitorOptions) { + super(options); + this.element = new Mqtt5MessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt5', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Mqtt5MessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/operation-binding/index.ts new file mode 100644 index 0000000000..3c82e9cd3d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Mqtt5OperationBindingElement from '../../../../../../elements/bindings/mqtt5/Mqtt5OperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Mqtt5OperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Mqtt5OperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Mqtt5OperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt5', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Mqtt5OperationBindingVisitorOptions) { + super(options); + this.element = new Mqtt5OperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt5', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Mqtt5OperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/server-binding/index.ts new file mode 100644 index 0000000000..64019b4f05 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/mqtt5/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import Mqtt5ServerBindingElement from '../../../../../../elements/bindings/mqtt5/Mqtt5ServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface Mqtt5ServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class Mqtt5ServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: Mqtt5ServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'mqtt5', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: Mqtt5ServerBindingVisitorOptions) { + super(options); + this.element = new Mqtt5ServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'mqtt5', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default Mqtt5ServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/channel-binding/index.ts new file mode 100644 index 0000000000..ffce9437ed --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import NatsChannelBindingElement from '../../../../../../elements/bindings/nats/NatsChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface NatsChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class NatsChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: NatsChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'nats', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: NatsChannelBindingVisitorOptions) { + super(options); + this.element = new NatsChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'nats', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default NatsChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/message-binding/index.ts new file mode 100644 index 0000000000..b8f0952733 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import NatsMessageBindingElement from '../../../../../../elements/bindings/nats/NatsMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface NatsMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class NatsMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: NatsMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'nats', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: NatsMessageBindingVisitorOptions) { + super(options); + this.element = new NatsMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'nats', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default NatsMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/operation-binding/index.ts new file mode 100644 index 0000000000..ea68a68c33 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import NatsOperationBindingElement from '../../../../../../elements/bindings/nats/NatsOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface NatsOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class NatsOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: NatsOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'nats', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: NatsOperationBindingVisitorOptions) { + super(options); + this.element = new NatsOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'nats', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default NatsOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/server-binding/index.ts new file mode 100644 index 0000000000..d82f403b82 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/nats/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import NatsServerBindingElement from '../../../../../../elements/bindings/nats/NatsServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface NatsServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class NatsServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: NatsServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'nats', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: NatsServerBindingVisitorOptions) { + super(options); + this.element = new NatsServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'nats', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default NatsServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/channel-binding/index.ts new file mode 100644 index 0000000000..e5eb67bfbe --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import PulsarChannelBindingElement from '../../../../../../elements/bindings/pulsar/PulsarChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface PulsarChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class PulsarChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'pulsar', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: PulsarChannelBindingVisitorOptions) { + super(options); + this.element = new PulsarChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'pulsar', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default PulsarChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/message-binding/index.ts new file mode 100644 index 0000000000..47485fbce8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import PulsarMessageBindingElement from '../../../../../../elements/bindings/pulsar/PulsarMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface PulsarMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class PulsarMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: PulsarMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'pulsar', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: PulsarMessageBindingVisitorOptions) { + super(options); + this.element = new PulsarMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'pulsar', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default PulsarMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/operation-binding/index.ts new file mode 100644 index 0000000000..7d6dd37ffb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import PulsarOperationBindingElement from '../../../../../../elements/bindings/pulsar/PulsarOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface PulsarOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class PulsarOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: PulsarOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'pulsar', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: PulsarOperationBindingVisitorOptions) { + super(options); + this.element = new PulsarOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'pulsar', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default PulsarOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/server-binding/index.ts new file mode 100644 index 0000000000..38745650df --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/pulsar/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import PulsarServerBindingElement from '../../../../../../elements/bindings/pulsar/PulsarServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface PulsarServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class PulsarServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: PulsarServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'pulsar', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: PulsarServerBindingVisitorOptions) { + super(options); + this.element = new PulsarServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'pulsar', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default PulsarServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/channel-binding/index.ts new file mode 100644 index 0000000000..6670285405 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import RedisChannelBindingElement from '../../../../../../elements/bindings/redis/RedisChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface RedisChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class RedisChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: RedisChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'redis', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: RedisChannelBindingVisitorOptions) { + super(options); + this.element = new RedisChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'redis', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default RedisChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/message-binding/index.ts new file mode 100644 index 0000000000..5a205c54a7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import RedisMessageBindingElement from '../../../../../../elements/bindings/redis/RedisMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface RedisMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class RedisMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: RedisMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'redis', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: RedisMessageBindingVisitorOptions) { + super(options); + this.element = new RedisMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'redis', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default RedisMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/operation-binding/index.ts new file mode 100644 index 0000000000..31ba1060b0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import RedisOperationBindingElement from '../../../../../../elements/bindings/redis/RedisOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface RedisOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class RedisOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: RedisOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'redis', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: RedisOperationBindingVisitorOptions) { + super(options); + this.element = new RedisOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'redis', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default RedisOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/server-binding/index.ts new file mode 100644 index 0000000000..3ba3f8d8d0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/redis/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import RedisServerBindingElement from '../../../../../../elements/bindings/redis/RedisServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface RedisServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class RedisServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: RedisServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'redis', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: RedisServerBindingVisitorOptions) { + super(options); + this.element = new RedisServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'redis', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default RedisServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/channel-binding/index.ts new file mode 100644 index 0000000000..9e7b817e22 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SnsChannelBindingElement from '../../../../../../elements/bindings/sns/SnsChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SnsChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SnsChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SnsChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sns', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SnsChannelBindingVisitorOptions) { + super(options); + this.element = new SnsChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sns', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SnsChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/message-binding/index.ts new file mode 100644 index 0000000000..02e1afacbb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SnsMessageBindingElement from '../../../../../../elements/bindings/sns/SnsMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SnsMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SnsMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SnsMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sns', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SnsMessageBindingVisitorOptions) { + super(options); + this.element = new SnsMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sns', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SnsMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/operation-binding/index.ts new file mode 100644 index 0000000000..16d27c2ca2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SnsOperationBindingElement from '../../../../../../elements/bindings/sns/SnsOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SnsOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SnsOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SnsOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sns', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SnsOperationBindingVisitorOptions) { + super(options); + this.element = new SnsOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sns', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SnsOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/server-binding/index.ts new file mode 100644 index 0000000000..c119af410b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sns/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SnsServerBindingElement from '../../../../../../elements/bindings/sns/SnsServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SnsServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SnsServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SnsServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sns', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SnsServerBindingVisitorOptions) { + super(options); + this.element = new SnsServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sns', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SnsServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/channel-binding/index.ts new file mode 100644 index 0000000000..70f52dd140 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SolaceChannelBindingElement from '../../../../../../elements/bindings/solace/SolaceChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SolaceChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SolaceChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SolaceChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'solace', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SolaceChannelBindingVisitorOptions) { + super(options); + this.element = new SolaceChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'solace', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SolaceChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/message-binding/index.ts new file mode 100644 index 0000000000..c88601fc14 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SolaceMessageBindingElement from '../../../../../../elements/bindings/solace/SolaceMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SolaceMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SolaceMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SolaceMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'solace', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SolaceMessageBindingVisitor) { + super(options); + this.element = new SolaceMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'solace', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SolaceMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/operation-binding/index.ts new file mode 100644 index 0000000000..31766b817e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SolaceOperationBindingElement from '../../../../../../elements/bindings/solace/SolaceOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SolaceOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SolaceOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SolaceOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'solace', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SolaceOperationBindingVisitorOptions) { + super(options); + this.element = new SolaceOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'solace', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SolaceOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/server-binding/index.ts new file mode 100644 index 0000000000..f6d5b4357c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/solace/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SolaceServerBindingElement from '../../../../../../elements/bindings/solace/SolaceServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SolaceServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SolaceServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SolaceServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'solace', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SolaceServerBindingVisitorOptions) { + super(options); + this.element = new SolaceServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'solace', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SolaceServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/channel-binding/index.ts new file mode 100644 index 0000000000..09b2691e8c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SqsChannelBindingElement from '../../../../../../elements/bindings/sqs/SqsChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SqsChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SqsChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SqsChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sqs', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SqsChannelBindingVisitorOptions) { + super(options); + this.element = new SqsChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sqs', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SqsChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/message-binding/index.ts new file mode 100644 index 0000000000..95e1920ec5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SqsMessageBindingElement from '../../../../../../elements/bindings/sqs/SqsMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SqsMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SqsMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SqsMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sqs', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SqsMessageBindingVisitorOptions) { + super(options); + this.element = new SqsMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sqs', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SqsMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/operation-binding/index.ts new file mode 100644 index 0000000000..79332ffa77 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SqsOperationBindingElement from '../../../../../../elements/bindings/sqs/SqsOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SqsOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SqsOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SqsOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sqs', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SqsOperationBindingVisitorOptions) { + super(options); + this.element = new SqsOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sqs', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SqsOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/server-binding/index.ts new file mode 100644 index 0000000000..d46a2baf90 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/sqs/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import SqsServerBindingElement from '../../../../../../elements/bindings/sqs/SqsServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface SqsServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SqsServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: SqsServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'sqs', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: SqsServerBindingVisitorOptions) { + super(options); + this.element = new SqsServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'sqs', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default SqsServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/channel-binding/index.ts new file mode 100644 index 0000000000..edb69bb985 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import StompChannelBindingElement from '../../../../../../elements/bindings/stomp/StompChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface StompChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class StompChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: StompChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'stomp', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: StompChannelBindingVisitorOptions) { + super(options); + this.element = new StompChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'stomp', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default StompChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/message-binding/index.ts new file mode 100644 index 0000000000..a20db229ab --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import StompMessageBindingElement from '../../../../../../elements/bindings/stomp/StompMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface StompMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class StompMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: StompMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'stomp', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: StompMessageBindingVisitorOptions) { + super(options); + this.element = new StompMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'stomp', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default StompMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/operation-binding/index.ts new file mode 100644 index 0000000000..8d958a504e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import StompOperationBindingElement from '../../../../../../elements/bindings/stomp/StompOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface StompOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class StompOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: StompOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'stomp', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: StompOperationBindingVisitorOptions) { + super(options); + this.element = new StompOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'stomp', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default StompOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/server-binding/index.ts new file mode 100644 index 0000000000..5bbe712d59 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/stomp/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import StompServerBindingElement from '../../../../../../elements/bindings/stomp/StompServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface StompServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class StompServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: StompServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'stomp', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: StompServerBindingVisitorOptions) { + super(options); + this.element = new StompServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'stomp', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default StompServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/channel-binding/index.ts new file mode 100644 index 0000000000..42ae4876d8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/channel-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import WebSocketChannelBindingElement from '../../../../../../elements/bindings/ws/WebSocketChannelBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface WebSocketChannelBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class WebSocketChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: WebSocketChannelBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ws', 'ChannelBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: WebSocketChannelBindingVisitorOptions) { + super(options); + this.element = new WebSocketChannelBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ws', 'ChannelBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default WebSocketChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/message-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/message-binding/index.ts new file mode 100644 index 0000000000..72d01c37ed --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/message-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import WebSocketMessageBindingElement from '../../../../../../elements/bindings/ws/WebSocketMessageBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface WebSocketMessageBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class WebSocketMessageBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: WebSocketMessageBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ws', 'MessageBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: WebSocketMessageBindingVisitorOptions) { + super(options); + this.element = new WebSocketMessageBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ws', 'MessageBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default WebSocketMessageBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/operation-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/operation-binding/index.ts new file mode 100644 index 0000000000..00585e3378 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/operation-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import WebSocketOperationBindingElement from '../../../../../../elements/bindings/ws/WebSocketOperationBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface WebSocketOperationBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class WebSocketOperationBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: WebSocketOperationBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ws', 'OperationBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: WebSocketOperationBindingVisitor) { + super(options); + this.element = new WebSocketOperationBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ws', 'OperationBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default WebSocketOperationBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/server-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/server-binding/index.ts new file mode 100644 index 0000000000..0ceaffe163 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/ws/server-binding/index.ts @@ -0,0 +1,38 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import WebSocketServerBindingElement from '../../../../../../elements/bindings/ws/WebSocketServerBinding.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface WebSocketServerBindingVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class WebSocketServerBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: WebSocketServerBindingElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'bindings', 'ws', 'ServerBinding'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: WebSocketServerBindingVisitorOptions) { + super(options); + this.element = new WebSocketServerBindingElement(); + this.specPath = always(['document', 'objects', 'bindings', 'ws', 'ServerBinding']); + this.canSupportSpecificationExtensions = false; + } +} + +export default WebSocketServerBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts new file mode 100644 index 0000000000..b38e0ba808 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts @@ -0,0 +1,40 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + + +/** + * @public + */ +export interface BindingsVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class BindingsVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: BindingsVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'ChannelBindings'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'channelBindings'); + } + + return result; + } +} + +export default BindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ChanneVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ChanneVisitor.ts deleted file mode 100644 index 51fd601ad1..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ChanneVisitor.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ObjectElement } from '@swagger-api/apidom-core'; - -import Visitor from '../../Visitor.ts'; - -class ChannelVisitor extends Visitor { - enter(node: any) { - const el = new ObjectElement(); - el.element = 'channelItem'; - this.element = el; - } -} - -export default ChannelVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts new file mode 100644 index 0000000000..ece7c3e0f8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts @@ -0,0 +1,44 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, isStringElement, BREAK, cloneDeep } from '@swagger-api/apidom-core'; + +import ChannelServersElement from '../../../../elements/nces/ChannelServers.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface ServersVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class ServersVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: ChannelServersElement; + + constructor(options: ServersVisitorOptions) { + super(options); + this.element = new ChannelServersElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + const element = cloneDeep(item); + + if (isReferenceElement(element)) { + element.classes.push('server-name'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default ServersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts new file mode 100644 index 0000000000..7164916855 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts @@ -0,0 +1,28 @@ +import { Mixin } from 'ts-mixer'; +import { + ObjectElement, +} from '@swagger-api/apidom-core'; +import { always } from 'ramda'; + +import ChannelElement from '../../../../elements/Channel.ts'; +import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor from '../../FallbackVisitor.ts'; + +class ChannelVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: ChannelElement; + + constructor(options: any) { + super(options); + this.element = new ChannelElement(); + this.specPath = always(['document','objects','Channel']); + this.canSupportSpecificationExtensions = true; + } + + ObjectElement(objectElement: ObjectElement) { + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + return result; + } +} + +export default ChannelVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts deleted file mode 100644 index 5d65ef270c..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/ChannelsVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../../Visitor.ts'; - -class ChannelsVisitor extends Visitor {} - -export default ChannelsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts new file mode 100644 index 0000000000..69103e18cf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + ChannelsVisitorOptions, + ChannelsVisitor as ChannelsVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ChannelsElement from '../../../../elements/Channels.ts'; + +export const BaseChannelsVisitor: typeof ChannelsVisitorType = + AsyncApi2Specification.visitors.document.objects.Channels.$visitor; + +export type { ChannelsVisitorOptions }; + +class ChannelsVisitor extends BaseChannelsVisitor { + declare public readonly element: ChannelsElement; + + constructor(options: ChannelsVisitorOptions) { + super(options); + this.element = new ChannelsElement(); + } +} + +export default ChannelsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ComponentsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ComponentsVisitor.ts deleted file mode 100644 index 771fbe3678..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ComponentsVisitor.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ObjectElement } from '@swagger-api/apidom-core'; - -import Visitor from '../../Visitor.ts'; - -class ComponentsVisitor extends Visitor { - enter(node: any) { - const el = new ObjectElement(); - el.element = 'components'; - - this.element = el; - } -} - -export default ComponentsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts new file mode 100644 index 0000000000..0510aa9f48 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts @@ -0,0 +1,44 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK, cloneDeep } from '@swagger-api/apidom-core'; + +import ComponentOperationsElement from '../../../../elements/nces/ComponentOperations.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface OperationsVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class OperationsVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: ComponentOperationsElement; + + constructor(options:OperationsVisitorOptions) { + super(options); + this.element = new + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + const element = cloneDeep(item); + + if (isReferenceElement(element)) { + element.classes.push('operations-name'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default OperationsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts new file mode 100644 index 0000000000..9495795a51 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts @@ -0,0 +1,56 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import ReferenceElement from '../../../../elements/Reference.ts'; +import ComponentsSchemasElement from '../../../../elements/nces/ComponentsSchemas.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement, isSchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; +import MultiFormatSchema from '../../../../elements/MultiFormatSchema.ts'; + +/** + * @public + */ +export interface SchemasVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class SchemasVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsSchemasElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Schema'] | ['document', 'objects', 'MultiFormatSchema'] + >; + + constructor(options: SchemasVisitorOptions) { + super(options); + this.element = new ComponentsSchemasElement(); + this.specPath = (element: unknown) => isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : isMultiFormatSchemaElement(element) + ? ['document', 'objects', 'MultiFormatSchema'] + : isSchemaElement(element) + ? ['document', 'objects', 'Schema'] + : ['document', 'objects', 'Schema']; + } + + ObjectElement(objectElement: ObjectElement) { + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'schema'); + }); + + // @ts-ignore + this.element.filter(isMultiFormatSchemaElement).forEach((multiFormatSchemaElement: MultiFormatSchema) => { + multiFormatSchemaElement.setMetaProperty('multiformat-schema-element', 'schema'); + }); + + return result; + } +} + +export default SchemasVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts new file mode 100644 index 0000000000..f47ccc3d56 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + ComponentsVisitorOptions, + ComponentsVisitor as ComponentsVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ComponentsElement from '../../../../elements/Components.ts'; + +export const BaseComponentsVisitor: typeof ComponentsVisitorType = + AsyncApi2Specification.visitors.document.objects.Components.$visitor; + +export type { ComponentsVisitorOptions }; + +class ComponentsVisitor extends BaseComponentsVisitor { + declare public readonly element: ComponentsElement; + + constructor(options: ComponentsVisitorOptions) { + super(options); + this.element = new ComponentsElement(); + } +} + +export default ComponentsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts new file mode 100644 index 0000000000..c63f792ff7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + CorrelationIDVisitorOptions, + CorrelationIDVisitor as CorrelationIDVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import CorrelationIDElement from '../../../../elements/CorrelationID.ts'; + +export const BaseCorrelationIDVisitor: typeof CorrelationIDVisitorType = + AsyncApi2Specification.visitors.document.objects.CorrelationID.$visitor; + +export type { CorrelationIDVisitorOptions }; + +class CorrelationIDVisitor extends BaseCorrelationIDVisitor { + declare public readonly element: CorrelationIDElement; + + constructor(options: CorrelationIDVisitorOptions) { + super(options); + this.element = new CorrelationIDElement(); + } +} + +export default CorrelationIDVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/index.ts new file mode 100644 index 0000000000..59fd6843bc --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/index.ts @@ -0,0 +1,36 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; +import AsyncApi3Element from '../../../elements/AsyncApi3.ts'; + +/** + * @public + */ +export interface AsyncApi3VisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class AsyncApi3Visitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: AsyncApi3Element; + + declare protected readonly specPath: SpecPath<['document', 'objects', 'AsyncApi']>; + + declare protected readonly canSupportSpecificationExtensions: true; + + constructor(options: AsyncApi3VisitorOptions) { + super(options); + this.element = new AsyncApi3Element(); + this.specPath = always(['document', 'objects', 'AsyncApi']); + this.canSupportSpecificationExtensions = true; + } +} + +export default AsyncApi3Visitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/InfoVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/InfoVisitor.ts deleted file mode 100644 index b33315bdcf..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/InfoVisitor.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ObjectElement } from '@swagger-api/apidom-core'; - -import Visitor from '../../Visitor.ts'; - -class InfoVisitor extends Visitor { - enter(node: any) { - const el = new ObjectElement(); - el.element = 'info'; - if (node.title) el.set('title', node.title); - if (node.version) el.set('version', node.version); - if (node.description) el.set('description', node.description); - this.element = el; - } -} - -export default InfoVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts new file mode 100644 index 0000000000..2248aac074 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + InfoVisitorOptions, + InfoVisitor as InfoVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import InfoElement from '../../../../elements/Info.ts'; + +export const BaseInfoVisitor: typeof InfoVisitorType = + AsyncApi2Specification.visitors.document.objects.Info.$visitor; + +export type { InfoVisitorOptions }; + +class InfoVisitor extends BaseInfoVisitor { + declare public readonly element: InfoElement; + + constructor(options: InfoVisitorOptions) { + super(options); + this.element = new InfoElement(); + } +} + +export default InfoVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts new file mode 100644 index 0000000000..ba4b731ebd --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + MessageBindingsVisitorOptions, + MessageBindingsVisitor as MessageBindingsVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import MessageBindingsElement from '../../../../elements/MessageBindings.ts'; + +export const BaseMessageBindingsVisitor: typeof MessageBindingsVisitorType = + AsyncApi2Specification.visitors.document.objects.MessageBindings.$visitor; + +export type { MessageBindingsVisitorOptions }; + +class MessageBindingsVisitor extends BaseMessageBindingsVisitor { + declare public readonly element: MessageBindingsElement; + + constructor(options: MessageBindingsVisitorOptions) { + super(options); + this.element = new MessageBindingsElement(); + } +} + +export default MessageBindingsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts new file mode 100644 index 0000000000..c6f1b296ed --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + MessageExampleVisitorOptions, + MessageExampleVisitor as MessageExampleVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import MessageExampleElement from '../../../../elements/MessageExample.ts'; + +export const BaseMessageExampleVisitor: typeof MessageExampleVisitorType = + AsyncApi2Specification.visitors.document.objects.MessageExample.$visitor; + +export type { MessageExampleVisitorOptions }; + +class MessageExampleVisitor extends BaseMessageExampleVisitor { + declare public readonly element: MessageExampleElement; + + constructor(options: MessageExampleVisitorOptions) { + super(options); + this.element = new MessageExampleElement(); + } +} + +export default MessageExampleVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts new file mode 100644 index 0000000000..91e5adb3b3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts @@ -0,0 +1,40 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + + +/** + * @public + */ +export interface BindingsVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class BindingsVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: BindingsVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'MessageBindings'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'messageBindings'); + } + + return result; + } +} + +export default BindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts new file mode 100644 index 0000000000..c9ae13f874 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts @@ -0,0 +1,41 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface CorrelationIdVisitorOptions + extends AlternatingVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class CorrelationIdVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: CorrelationIdVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'CorrelationID'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'correlationID'); + } + + return result; + } +} + +export default CorrelationIdVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/ExamplesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/ExamplesVisitor.ts new file mode 100644 index 0000000000..255c130e4d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/ExamplesVisitor.ts @@ -0,0 +1,42 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import MessageExamplesElement from '../../../../elements/nces/MessageExamples.ts'; + +/** + * @public + */ +export interface ExamplesVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class ExamplesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: MessageExamplesElement; + + constructor(options: ExamplesVisitorOptions) { + super(options); + this.element = new MessageExamplesElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + const messageElement = this.toRefractedElement( + ['document', 'objects', 'MessageExample'], + item, + ); + + this.element.push(messageElement); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default ExamplesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts new file mode 100644 index 0000000000..5b66e541df --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts @@ -0,0 +1,48 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement, isSchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface HeadersVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: HeadersVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: isSchemaElement, specPath: ['document', 'objects', 'Schema'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'MultiformatSchema'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'ref-header'); + } + + if(isSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'header-schema'); + } + + else { + this.element.setMetaProperty('schema', 'header-multiformat-schema') + } + + return result; + } +} + +export default HeadersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/MessageVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/MessageVisitor.ts deleted file mode 100644 index 436a23d9cf..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/MessageVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../../Visitor.ts'; - -class MessageVisitor extends Visitor {} - -export default MessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts new file mode 100644 index 0000000000..320c949604 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts @@ -0,0 +1,45 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import MessageTraitsElement from '../../../../elements/nces/MessageTraits.ts'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface TraitsVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class TraitsVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: MessageTraitsElement; + + constructor(options: TraitsVisitorOptions) { + super(options); + this.element = new MessageTraitsElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + let element; + + if (isReferenceLikeElement(item)) { + element = this.toRefractedElement(['document', 'objects', 'Reference'], item); + element.setMetaProperty('referenced-element', 'messageTrait'); + } else { + element = this.toRefractedElement(['document', 'objects', 'MessageTrait'], item); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default TraitsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts new file mode 100644 index 0000000000..6de296f19f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts @@ -0,0 +1,62 @@ +import { Mixin } from 'ts-mixer'; +import { always, defaultTo, includes } from 'ramda'; +import { ObjectElement, isObjectElement, toValue } from '@swagger-api/apidom-core'; + +import mediaTypes from '../../../../media-types.ts'; +import MessageElement from '../../../../elements/Message.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + + +/** + * Implementation of refracting according `schemaFormat` fixed field is now limited, + * and currently only supports `AsyncAPI Schema Object >= 2.0.0 <=2.6.0.` + * @public + */ +export interface MessageVisitorOptions extends FixedFieldsVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class MessageVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MessageElement; + + declare protected readonly specPath: SpecPath<['document', 'objects', 'Message']>; + + declare protected readonly canSupportSpecificationExtensions: true; + + constructor(options: MessageVisitorOptions) { + super(options); + this.element = new MessageElement(); + this.specPath = always(['document', 'objects', 'Message']); + this.canSupportSpecificationExtensions = true; + } + + ObjectElement(objectElement: ObjectElement) { + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + const payload = this.element.get('payload'); + const schemaFormat = defaultTo(mediaTypes.latest(), toValue(objectElement.get('schemaFormat'))); + const multiFormatSchema = objectElement.hasKey('multiFormatSchema') ? objectElement.get('multiFormatSchema') : undefined; + if (mediaTypes.includes(schemaFormat) && isReferenceLikeElement(payload)) { + // refract to ReferenceElement + const referenceElement = this.toRefractedElement( + ['document', 'objects', 'Reference'], + payload, + ); + referenceElement.meta.set('referenced-element', 'schema'); + this.element.payload = referenceElement; + } else if (mediaTypes.includes(schemaFormat) && isObjectElement(this.element.payload)) { + this.element.payload = this.toRefractedElement(['document', 'objects', 'Schema'], payload); + } else if (mediaTypes.includes(multiFormatSchema)) { + this.element.payload = this.toRefractedElement(['document', 'objects', 'MultiformatSchema'], payload); + } + + return result; + } +} + +export default MessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts new file mode 100644 index 0000000000..bd65898e8d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts @@ -0,0 +1,23 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MessagesElement from '../../../../elements/Messages.ts'; +import FallbackVisitor from '../../FallbackVisitor.ts'; +import MapVisitor from '../../generics/MapVisitor.ts'; +import { SpecPath } from '../../generics/FixedFieldsVisitor.ts'; + + +class MessagesVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: MessagesElement; + declare protected readonly specPath: SpecPath<['document', 'objects', 'Messages']>; + declare protected readonly canSupportSpecificationExtensions: true; + + constructor(options: any) { + super(options); + this.element = new MessagesElement(); + this.specPath = always(['document', 'objects', 'Messages']); + this.canSupportSpecificationExtensions = true; + } +} + +export default MessagesVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts new file mode 100644 index 0000000000..c2644085ab --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts @@ -0,0 +1,47 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; +import { ObjectElement, BooleanElement } from '@swagger-api/apidom-core'; + +import MultiFormatSchemaElement from '../../../../elements/MultiFormatSchema.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; + +/** + * @public + */ +export interface MultiFormatSchemaVisitorOptions extends FixedFieldsVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class MultiFormatSchemaVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public element: MultiFormatSchemaElement; + + declare protected readonly specPath: SpecPath<['document', 'objects', 'MultiFormatSchema']>; + + declare protected readonly canSupportSpecificationExtensions: true; + + constructor(options: MultiFormatSchemaVisitorOptions) { + super(options); + this.specPath = always(['document', 'objects', 'MultiFormatSchema']); + this.canSupportSpecificationExtensions = true; + } + + ObjectElement(objectElement: ObjectElement) { + this.element = new MultiFormatSchemaElement(); + + return FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + } + + BooleanElement(booleanElement: BooleanElement) { + const result = super.enter(booleanElement); + this.element.classes.push('boolean-json-MultiFormatSchema'); + + return result; + } +} + +export default MultiFormatSchemaVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts new file mode 100644 index 0000000000..55a48f5163 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + OAuthFlowVisitorOptions, + OAuthFlowVisitor as OAuthFlowVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import OAuthFlowElement from '../../../../elements/OAuthFlow.ts'; + +/** + * @public + */ +export const BaseOAuthFlowVisitor: typeof OAuthFlowVisitorType = + AsyncApi2Specification.visitors.document.objects.OAuthFlow.$visitor; + +export type { OAuthFlowVisitorOptions }; + +/** + * @public + */ +class OAuthFlowVisitor extends BaseOAuthFlowVisitor { + declare public readonly element: OAuthFlowElement; + + constructor(options: OAuthFlowVisitorOptions) { + super(options); + this.element = new OAuthFlowElement(); + } +} + +export default OAuthFlowVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts new file mode 100644 index 0000000000..ab91c92430 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + OAuthFlowsVisitorOptions, + OAuthFlowsVisitor as OAuthFlowsVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import OAuthFlowsElement from '../../../../elements/OAuthFlows.ts'; + +/** + * @public + */ +export const BaseOAuthFlowsVisitor: typeof OAuthFlowsVisitorType = + AsyncApi2Specification.visitors.document.objects.OAuthFlows.$visitor; + +export type { OAuthFlowsVisitorOptions }; + +/** + * @public + */ +class OAuthFlowsVisitor extends BaseOAuthFlowsVisitor { + declare public readonly element: OAuthFlowsElement; + + constructor(options: OAuthFlowsVisitorOptions) { + super(options); + this.element = new OAuthFlowsElement(); + } +} + +export default OAuthFlowsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts new file mode 100644 index 0000000000..7efca710c3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts @@ -0,0 +1,40 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + + +/** + * @public + */ +export interface BindingsVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class BindingsVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: BindingsVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'OperationBindings'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'operationBindings'); + } + + return result; + } +} + +export default BindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts new file mode 100644 index 0000000000..cb57407b39 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts @@ -0,0 +1,44 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import OperationMessagesElement from '../../../../elements/nces/OperationMessage.ts'; + +/** + * @public + */ +export interface OperationMessageVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * Handles the 'messages' field in Operation Object (array of references) + */ +class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: OperationMessagesElement; + + constructor(options: OperationMessageVisitorOptions) { + super(options); + this.element = new OperationMessagesElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + + let element; + if (isReferenceElement(item)) { + element = this.toRefractedElement(['document', 'objects', 'Messages'], item); + element.setMetaProperty('referenced-element', 'operationMessages') + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default MessagesVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts deleted file mode 100644 index d1d49af113..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationMessageVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../../Visitor.ts'; - -class OperationMessageVisitor extends Visitor {} - -export default OperationMessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts index e8b3292f2b..be4ca9e56f 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts @@ -1,5 +1,46 @@ -import Visitor from '../../Visitor.ts'; +import { Mixin } from 'ts-mixer'; +import { isStringElement, ObjectElement } from '@swagger-api/apidom-core'; +import { always } from 'ramda'; -class OperationVisitor extends Visitor {} +import OperationElement from '../../../../elements/Operation.ts'; +import FixedFieldsVisitor, { SpecPath } from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor from '../../FallbackVisitor.ts'; +/** + * @public + */ +class OperationVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public element: OperationElement; + declare protected readonly specPath: SpecPath<['document', 'objects', 'Operation']>; + declare protected readonly canSupportSpecificationExtensions: true; -export default OperationVisitor; + constructor(options: any) { + super(options); + this.element = new OperationElement(); + this.specPath = always(['document', 'objects', 'Operation']); + this.canSupportSpecificationExtensions = true; + } + + ObjectElement(objectElement: ObjectElement) { + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement) as OperationElement; + + // Retrieve the action from the objectElement + const action = objectElement.get('action'); + + if (isStringElement(action)) { + const actionValue = action.toValue(); + if (actionValue === 'send' || actionValue === 'receive') { + result.setMetaProperty('operation-action', actionValue); + } else { + throw new Error(`Invalid action type: ${actionValue}. Expected "send" or "receive".`); + } + } + + // Set the element to the result after processing + this.element = result; + this.copyMetaAndAttributes(objectElement, this.element); + + return this.element; +} +} + +export default OperationVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts new file mode 100644 index 0000000000..f7a0eef819 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts @@ -0,0 +1,40 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + + +/** + * @public + */ +export interface ReplyVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class ReplyVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: ReplyVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'OperationReply'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'operationReply'); + } + + return result; + } +} + +export default ReplyVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts new file mode 100644 index 0000000000..828ca28c5b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts @@ -0,0 +1,46 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import OperationSecurityElement from '../../../../elements/nces/OperationSecurity.ts'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ +export interface SecurityVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SecurityVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: OperationSecurityElement; + + constructor(options: SecurityVisitorOptions) { + super(options); + this.element = new OperationSecurityElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + let element; + + if (isReferenceLikeElement(item)) { + element = this.toRefractedElement(['document', 'objects', 'Reference'], item); + element.setMetaProperty('referenced-element', 'operationSecurity'); + } else { + element = this.toRefractedElement(['document', 'objects', 'SecurityScheme'], item); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default SecurityVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts new file mode 100644 index 0000000000..cd22627db4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts @@ -0,0 +1,45 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; + +import OperationTraitsElement from '../../../../elements/nces/OperationTraits.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface TraitsVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class TraitsVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: OperationTraitsElement; + + constructor(options: TraitsVisitorOptions) { + super(options); + this.element = new OperationTraitsElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + let element; + + if (isReferenceLikeElement(item)) { + element = this.toRefractedElement(['document', 'objects', 'Reference'], item); + element.setMetaProperty('referenced-element', 'operationTrait'); + } else { + element = this.toRefractedElement(['document', 'objects', 'OperationTrait'], item); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default TraitsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operationReply/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operationReply/index.ts new file mode 100644 index 0000000000..afb2910cef --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operationReply/index.ts @@ -0,0 +1,27 @@ +// filepath: packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationReplyVisitor.ts +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import OperationReplyElement from '../../../../elements/OperationReply.ts'; +import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor from '../../FallbackVisitor.ts'; +import { always } from 'ramda'; + +class OperationReplyVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: OperationReplyElement; + + constructor(options: any) { + super(options); + this.element = new OperationReplyElement(); + this.specPath = always(['document', 'objects', 'OperationReply']); + this.canSupportSpecificationExtensions = true; + } + + ObjectElement(objectElement: ObjectElement) { + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + return result; + } +} + +export default OperationReplyVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts new file mode 100644 index 0000000000..16c0eaa8d3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts @@ -0,0 +1,29 @@ +import { Mixin } from 'ts-mixer'; + +import OperationsElement from '../../../../elements/Operations.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { always } from 'ramda'; + +/** + * @public + */ +export interface OperationsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} +/** + * @public + */ +class OperationsVisitor extends Mixin(MapVisitor, FallbackVisitor) { + + declare public readonly element: OperationsElement; + + declare protected readonly specPath: SpecPath<['document', 'objects', 'Operation']>; + + constructor(options: OperationsVisitorOptions) { + super(options); + this.element = new OperationsElement(); + this.specPath = always(['document', 'objects', 'Operation']); + } + +} + +export default OperationsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/ReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/ReferenceVisitor.ts deleted file mode 100644 index 794572b8d4..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/ReferenceVisitor.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ObjectElement } from '@swagger-api/apidom-core'; - -import Visitor from '../../Visitor.ts'; - -class ReferenceVisitor extends Visitor { - enter(node: any) { - const el = new ObjectElement(); - el.element = 'reference'; - if (node.$ref) el.set('$ref', node.$ref); - this.element = el; - } -} - -export default ReferenceVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts new file mode 100644 index 0000000000..fa24f7a74a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + ReferenceVisitorOptions, + ReferenceVisitor as ReferenceVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ReferenceElement from '../../../../elements/Reference.ts'; + +/** + * @public + */ +export const BaseReferenceVisitor: typeof ReferenceVisitorType = + AsyncApi2Specification.visitors.document.objects.Reference.$visitor; + +export type { ReferenceVisitorOptions }; + +/** + * @public + */ +class ReferenceVisitor extends BaseReferenceVisitor { + declare public readonly element: ReferenceElement; + + constructor(options: ReferenceVisitorOptions) { + super(options); + this.element = new ReferenceElement(); + } +} + +export default ReferenceVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaVisitor.ts deleted file mode 100644 index b99bafb167..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../../Visitor.ts'; - -class SchemaVisitor extends Visitor {} - -export default SchemaVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts new file mode 100644 index 0000000000..faaf49ce14 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + SchemaVisitorOptions, + SchemaVisitor as SchemaVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import SchemaElement from '../../../../elements/Schema.ts'; + +export const BaseSchemaVisitor: typeof SchemaVisitorType = + AsyncApi2Specification.visitors.document.objects.Schema.$visitor; + +export type { SchemaVisitorOptions }; + +class SchemaVisitor extends BaseSchemaVisitor { + declare public readonly element: SchemaElement; + + constructor(options: SchemaVisitorOptions) { + super(options); + this.element = new SchemaElement(); + } +} + +export default SchemaVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts new file mode 100644 index 0000000000..2e2e22d6a4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + ServerBindingsVisitorOptions, + ServerBindingsVisitor as ServerBindingsVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServerBindingsElement from '../../../../elements/ServerBindings.ts'; + +export const BaseServerBindingsVisitor: typeof ServerBindingsVisitorType = + AsyncApi2Specification.visitors.document.objects.ServerBindings.$visitor; + +export type { ServerBindingsVisitorOptions }; + +class ServerBindingsVisitor extends BaseServerBindingsVisitor { + declare public readonly element: ServerBindingsElement; + + constructor(options: ServerBindingsVisitorOptions) { + super(options); + this.element = new ServerBindingsElement(); + } +} + +export default ServerBindingsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts new file mode 100644 index 0000000000..5106137f64 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts @@ -0,0 +1,35 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import TagElement from '../../../../elements/Tag.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; +import { isStringElement, ObjectElement } from '@swagger-api/apidom-core'; + +/** + * @public + */ +export interface TagVisitorOptions extends FixedFieldsVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class TagVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: TagElement; + + declare protected readonly specPath: SpecPath<['document','objects','Tag']>; + + declare protected readonly canSupportSpecificationExtensions: true; + + constructor(options: TagVisitorOptions) { + super(options); + this.element = new TagElement(); + this.specPath = always(['document','objects', 'Tag']); + this.canSupportSpecificationExtensions = true; + } +} + +export default TagVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts new file mode 100644 index 0000000000..16d97b58a7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + TagsVisitor as TagsVisitorType, + TagsVisitorOptions +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import TagsElement from '../../../../elements/Tags.ts'; + +/** + * @public + */ +export const BaseTagsVisitor: typeof TagsVisitorType = + AsyncApi2Specification.visitors.document.objects.Tags.$visitor; + +export type { TagsVisitorOptions }; + +/** + * @public + */ +class TagsVisitor extends BaseTagsVisitor { + declare public readonly element: TagsElement; + + constructor(options: TagsVisitorOptions) { + super(options); + this.element = new TagsElement(); + } +} + +export default TagsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts new file mode 100644 index 0000000000..be3fee11c9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts @@ -0,0 +1,35 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement, BREAK } from '@swagger-api/apidom-core'; +import ExternalDocumentationElement from '../../../elements/ExternalDocumentation.ts'; +import ReferenceElement from '../../../elements/Reference.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import AlternatingVisitor from './AlternatingVisitor.ts'; +import { T as stubTrue } from 'ramda'; + +export interface ExternalDocumentationVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +class ExternalDocumentationVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: ExternalDocumentationVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'ExternalDocumentation'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'ExternalDocumentation'); + } + + return result; + } +} + +export default ExternalDocumentationVisitor; \ No newline at end of file From 2f9420ba2b865b11c81a22c2d3d72e6a5efef8c8 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Tue, 28 Oct 2025 18:46:10 +0530 Subject: [PATCH 17/27] feat: add missing visitors for async-api-3 --- packages/apidom-ns-asyncapi-3/package.json | 2 +- .../src/refractor/specification.ts | 286 +++++++++++++++++- .../visitors/async-api-3/bindings/index.ts | 9 +- .../channel-address-expression/index.ts | 56 ++++ .../async-api-3/channel-bindings/index.ts | 36 +++ .../components/OperationsVisitor.ts | 2 +- .../async-api-3/external-documentation | 23 ++ .../message-trait/HeadersVisitor.ts | 49 +++ .../async-api-3/message-trait/index.ts | 23 ++ .../async-api-3/message/HeadersVisitor.ts | 3 +- .../visitors/async-api-3/oauth-flow/index.ts | 2 +- .../visitors/async-api-3/oauth-flows/index.ts | 2 +- .../async-api-3/operation-bindings/index.ts | 23 ++ .../async-api-3/operation-trait/index.ts | 23 ++ .../visitors/async-api-3/parameter/index.ts | 36 +++ .../visitors/async-api-3/parameters/index.ts | 23 ++ .../async-api-3/security-scheme/index.ts | 23 ++ 17 files changed, 602 insertions(+), 19 deletions(-) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expression/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-bindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameter/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts diff --git a/packages/apidom-ns-asyncapi-3/package.json b/packages/apidom-ns-asyncapi-3/package.json index 1964188b74..2a81a62a55 100644 --- a/packages/apidom-ns-asyncapi-3/package.json +++ b/packages/apidom-ns-asyncapi-3/package.json @@ -35,7 +35,7 @@ "dependencies": { "@babel/runtime-corejs3": "^7.26.10", "@swagger-api/apidom-core": "^1.0.0-beta.51", - "@swagger-api/apidom-ns-asyncapi-2": "workspace:^1.0.0-beta.51", + "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-beta.51", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index c6a86d29a3..365886b510 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -17,7 +17,8 @@ import DefaultContentTypeVisitor from '../elements/DefaultContentType.ts'; import SecuritySchemesVisitor from './visitors/async-api-3/SecuritySchemesVisitor.ts'; import ServerVisitor from './visitors/async-api-3/server/ServerVisitor.ts'; import ServerVariableVisitor from './visitors/async-api-3/server/ServerVariableVisitor.ts'; -import ParametersVisitor from './visitors/async-api-3/ParametersVisitor.ts'; +import ParametersVisitor from './visitors/async-api-3/parameters/index.ts'; +import ParameterVisitor from './visitors/async-api-3/parameter/index.ts'; import BindingsVisitor from './visitors/async-api-3/BindingsVisitor.ts'; import TagsVisitor from './visitors/async-api-3/tags/index.ts'; import ExternalDocumentationVisitor from './visitors/async-api-3/ExternalDocumentationVisitor.ts'; @@ -25,7 +26,7 @@ import ExternalDocumentationVisitor from './visitors/async-api-3/ExternalDocumen import OperationVisitor from './visitors/async-api-3/operation/OperationVisitor.ts'; import OperationsVisitor from './visitors/async-api-3/operations/index.ts'; import OperationMessagesVisitor from './visitors/async-api-3/operation/MessagesVisitor.ts'; -import OperationBindingsVisitor from './visitors/async-api-3/operation/BindingsVisitor.ts'; +import OperationBindingsVisitor_ from './visitors/async-api-3/operation/BindingsVisitor.ts'; import OperationTraitsVisitor from './visitors/async-api-3/operation/TraitsVisitor.ts'; import OperationSecurityVisitor from './visitors/async-api-3/operation/SecurityVisitor.ts'; import SchemaVisitor from './visitors/async-api-3/schema/index.ts'; @@ -44,6 +45,15 @@ import MessageCorrelationIdVisitor from './visitors/async-api-3/message/Correlat import OperationReplyVisitor from './visitors/async-api-3/operationReply/index.ts'; import ServersVisitor from './visitors/async-api-3/server/ServersVisitor.ts'; import MultiFormatSchemaVisitor from './visitors/async-api-3/multiFormatSchema/index.ts' +import ChannelBindingsVisitor from './visitors/async-api-3/channel-bindings/index.ts'; +import MessageTraitVisitor from './visitors/async-api-3/message-trait/index.ts'; +import MessageTraitHeadersVisitor from './visitors/async-api-3/message-trait/HeadersVisitor.ts'; +import SecuritySchemeVisitor from './visitors/async-api-3/security-scheme/index.ts'; +import OperationBindingsVisitor from './visitors/async-api-3/operation-bindings/index.ts'; +import OAuthFlowVisitor from './visitors/async-api-3/oauth-flow/index.ts'; +import OAuthFlowsVisitor from './visitors/async-api-3/oauth-flows/index.ts'; +import ServerBindingsVisitor from './visitors/async-api-3/server-bindings/index.ts'; +import ChannelAddressExpressionsVisitor from './visitors/async-api-3/channel-address-expression/index.ts'; const specification = { visitors: { @@ -105,7 +115,7 @@ const specification = { Servers: { $visitor: ServersVisitor, }, - Server: { + Server: { $visitor: ServerVisitor, fixedFields: { host: { $ref: '#/visitors/value' }, @@ -133,7 +143,7 @@ const specification = { examples: { $ref: '#/visitors/value' }, }, }, - DefaultContentType: { + DefaultContentType: { $visitor: DefaultContentTypeVisitor, }, Channels: { @@ -148,12 +158,15 @@ const specification = { summary: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, servers: ChannelServersVisitor, - parameters: { $ref: '#/visitors/value' }, + parameters: { $ref: '#/visitors/document/object/Parameters' }, tags: { $ref: '#/visitors/document/objects/Tags' }, externalDocs: ExternalDocsVisitor, bindings: ChanneBindingsVisitor, }, }, + ChannelAddressExpressions: { + $visitor: ChannelAddressExpressionsVisitor + }, Operations: { $visitor: OperationsVisitor, }, @@ -168,7 +181,7 @@ const specification = { security: OperationSecurityVisitor, tags: { $ref: '#/visitors/document/objects/Tags' }, externalDocs: ExternalDocsVisitor, - bindings: OperationBindingsVisitor, + bindings: OperationBindingsVisitor_, traits: OperationTraitsVisitor, message: OperationMessagesVisitor, reply: OperationReplyVisitor, @@ -186,9 +199,143 @@ const specification = { Parameters: { $visitor: ParametersVisitor, }, + Parameter: { + $visitor: ParameterVisitor, + fixedFields: { + enum: { $ref: '#/visitors/value' }, + default: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + examples: { $ref: '#/visitors/value' }, + location: { $ref: '#/visitors/location' }, + }, + }, Bindings: { $visitor: BindingsVisitor, }, + ChannelBindings: { + $visitor: ChannelBindingsVisitor, + fixedFields: { + http: { + $ref: '#/visitors/document/objects/bindings/http/ChannelBinding', + }, + ws: { + $ref: '#/visitors/document/objects/bindings/ws/ChannelBinding', + }, + kafka: { + $ref: '#/visitors/document/objects/bindings/kafka/ChannelBinding', + }, + anypointmq: { + $ref: '#/visitors/document/objects/bindings/anypointmq/ChannelBinding', + }, + amqp: { + $ref: '#/visitors/document/objects/bindings/amqp/ChannelBinding', + }, + amqp1: { + $ref: '#/visitors/document/objects/bindings/amqp1/ChannelBinding', + }, + mqtt: { + $ref: '#/visitors/document/objects/bindings/mqtt/ChannelBinding', + }, + mqtt5: { + $ref: '#/visitors/document/objects/bindings/mqtt5/ChannelBinding', + }, + nats: { + $ref: '#/visitors/document/objects/bindings/nats/ChannelBinding', + }, + jms: { + $ref: '#/visitors/document/objects/bindings/jms/ChannelBinding', + }, + sns: { + $ref: '#/visitors/document/objects/bindings/sns/ChannelBinding', + }, + solace: { + $ref: '#/visitors/document/objects/bindings/solace/ChannelBinding', + }, + sqs: { + $ref: '#/visitors/document/objects/bindings/sqs/ChannelBinding', + }, + stomp: { + $ref: '#/visitors/document/objects/bindings/stomp/ChannelBinding', + }, + redis: { + $ref: '#/visitors/document/objects/bindings/redis/ChannelBinding', + }, + mercure: { + $ref: '#/visitors/document/objects/bindings/mercure/ChannelBinding', + }, + ibmmq: { + $ref: '#/visitors/document/objects/bindings/ibmmq/ChannelBinding', + }, + googlepubsub: { + $ref: '#/visitors/document/objects/bindings/googlepubsub/ChannelBinding', + }, + pulsar: { + $ref: '#/visitors/document/objects/bindings/pulsar/ChannelBinding', + }, + }, + }, + OperationBindings: { + $visitor: OperationBindingsVisitor, + fixedFields: { + http: { + $ref: '#/visitors/document/objects/bindings/http/OperationBinding', + }, + ws: { + $ref: '#/visitors/document/objects/bindings/ws/OperationBinding', + }, + kafka: { + $ref: '#/visitors/document/objects/bindings/kafka/OperationBinding', + }, + anypointmq: { + $ref: '#/visitors/document/objects/bindings/anypointmq/OperationBinding', + }, + amqp: { + $ref: '#/visitors/document/objects/bindings/amqp/OperationBinding', + }, + amqp1: { + $ref: '#/visitors/document/objects/bindings/amqp1/OperationBinding', + }, + mqtt: { + $ref: '#/visitors/document/objects/bindings/mqtt/OperationBinding', + }, + mqtt5: { + $ref: '#/visitors/document/objects/bindings/mqtt5/OperationBinding', + }, + nats: { + $ref: '#/visitors/document/objects/bindings/nats/OperationBinding', + }, + jms: { + $ref: '#/visitors/document/objects/bindings/jms/OperationBinding', + }, + sns: { + $ref: '#/visitors/document/objects/bindings/sns/OperationBinding', + }, + solace: { + $ref: '#/visitors/document/objects/bindings/solace/OperationBinding', + }, + sqs: { + $ref: '#/visitors/document/objects/bindings/sqs/OperationBinding', + }, + stomp: { + $ref: '#/visitors/document/objects/bindings/stomp/OperationBinding', + }, + redis: { + $ref: '#/visitors/document/objects/bindings/redis/OperationBinding', + }, + mercure: { + $ref: '#/visitors/document/objects/bindings/mercure/OperationBinding', + }, + googlepubsub: { + $ref: '#/visitors/document/objects/bindings/googlepubsub/OperationBinding', + }, + ibmmq: { + $ref: '#/visitors/document/objects/bindings/ibmmq/OperationBinding', + }, + pulsar: { + $ref: '#/visitors/document/objects/bindings/pulsar/OperationBinding', + }, + }, + }, MessageBindings: { $visitor: MessageBindingsVisitor, fixedFields: { @@ -265,7 +412,7 @@ const specification = { correlationIds: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.correlationIds, replies: { $ref: '#/visitors/value' }, replyAddresses: { $ref: '#/visitors/value' }, - tags: { $ref: '#/visitors/document/objects/Tags' },, + tags: { $ref: '#/visitors/document/objects/Tags' }, externalDocs: ExternalDocumentationVisitor, operationTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationTraits, messageTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageTraits, @@ -275,7 +422,94 @@ const specification = { messageBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageBindings }, }, - + OAuthFlows: { + $visitor: OAuthFlowsVisitor, + fixedFields: { + implicit: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + password: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + clientCredentials: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + authorizationCode: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + }, + }, + OAuthFlow: { + $visitor: OAuthFlowVisitor, + fixedFields: { + authorizationUrl: { $ref: '#/visitors/value' }, + tokenUrl: { $ref: '#/visitors/value' }, + refreshUrl: { $ref: '#/visitors/value' }, + availableScopes: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.scopes + }, + }, + ServerBindings: { + $visitor: ServerBindingsVisitor, + fixedFields: { + http: { + $ref: '#/visitors/document/objects/bindings/http/ServerBinding', + }, + ws: { + $ref: '#/visitors/document/objects/bindings/ws/ServerBinding', + }, + kafka: { + $ref: '#/visitors/document/objects/bindings/kafka/ServerBinding', + }, + anypointmq: { + $ref: '#/visitors/document/objects/bindings/anypointmq/ServerBinding', + }, + amqp: { + $ref: '#/visitors/document/objects/bindings/amqp/ServerBinding', + }, + amqp1: { + $ref: '#/visitors/document/objects/bindings/amqp1/ServerBinding', + }, + mqtt: { + $ref: '#/visitors/document/objects/bindings/mqtt/ServerBinding', + }, + mqtt5: { + $ref: '#/visitors/document/objects/bindings/mqtt5/ServerBinding', + }, + nats: { + $ref: '#/visitors/document/objects/bindings/nats/ServerBinding', + }, + jms: { + $ref: '#/visitors/document/objects/bindings/jms/ServerBinding', + }, + sns: { + $ref: '#/visitors/document/objects/bindings/sns/ServerBinding', + }, + solace: { + $ref: '#/visitors/document/objects/bindings/solace/ServerBinding', + }, + sqs: { + $ref: '#/visitors/document/objects/bindings/sqs/ServerBinding', + }, + stomp: { + $ref: '#/visitors/document/objects/bindings/stomp/ServerBinding', + }, + redis: { + $ref: '#/visitors/document/objects/bindings/redis/ServerBinding', + }, + mercure: { + $ref: '#/visitors/document/objects/bindings/mercure/ServerBinding', + }, + ibmmq: { + $ref: '#/visitors/document/objects/bindings/ibmmq/ServerBinding', + }, + googlepubsub: { + $ref: '#/visitors/document/objects/bindings/googlepubsub/ServerBinding', + }, + pulsar: { + $ref: '#/visitors/document/objects/bindings/pulsar/ServerBinding', + }, + }, + }, SecuritySchemes: { $visitor: SecuritySchemesVisitor, }, @@ -305,6 +539,26 @@ const specification = { traits: MessageTraitsVisitor }, }, + MessageTrait: { + $visitor: MessageTraitVisitor, + fixedFields: { + messageId: { $ref: '#/visitors/value' }, + headers: MessageTraitHeadersVisitor, + correlationId: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.correlationId, + schemaFormat: { $ref: '#/visitors/value' }, + contentType: { $ref: '#/visitors/value' }, + name: { $ref: '#/visitors/value' }, + title: { $ref: '#/visitors/value' }, + summary: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + externalDocs: ExternalDocsVisitor, + bindings: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.bindings, + examples: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.examples, + }, + }, MessageExample: { $visitor: MessageExampleVisitor, fixedFields: { @@ -354,6 +608,22 @@ const specification = { $ref: { $ref: '#/visitors/value' }, }, }, + SecurityScheme: { + $visitor: SecuritySchemeVisitor, + fixedFields: { + type: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + name: { $ref: '#/visitors/value' }, + in: { $ref: '#/visitors/value' }, + scheme: { $ref: '#/visitors/value' }, + bearerFormat: { $ref: '#/visitors/value' }, + flows: { + $ref: '#/visitors/document/objects/OAuthFlows', + }, + openIdConnectUrl: { $ref: '#/visitors/value' }, + scopes: { $ref: '#/visitors/value' }, + }, + }, }, }, }, diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts index 68c4798098..5ba92707de 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts @@ -1,12 +1,9 @@ import { Mixin } from 'ts-mixer'; import { always } from 'ramda'; -import Amqp1ServerBindingElement from '../../../../../../elements/bindings/amqp1/Amqp1ServerBinding.ts'; -import FixedFieldsVisitor, { - FixedFieldsVisitorOptions, - SpecPath, -} from '../../../../generics/FixedFieldsVisitor.ts'; -import FallbackVisitor, { FallbackVisitorOptions } from '../../../../FallbackVisitor.ts'; +import { Amqp1ServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import FixedFieldsVisitor, { FixedFieldsVisitorOptions, SpecPath } from '../../generics/FixedFieldsVisitor.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expression/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expression/index.ts new file mode 100644 index 0000000000..12efee8cfc --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expression/index.ts @@ -0,0 +1,56 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import PatternedFieldsVisitor, { + PatternedFieldsVisitorOptions, + SpecPath, +} from '../../generics/PatternedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import MessageElement from '../../../../elements/Message.ts'; +import ReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface ChannelAddressExpressionsVisitorOptions + extends PatternedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class ChannelAddressExpressionsVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MessageElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Message'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: ChannelAddressExpressionsVisitorOptions) { + super(options); + this.element = new MessageElement(); + this.element.classes.push('servers'); + this.specPath = (element: unknown) => { + return isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Message']; + }; + this.canSupportSpecificationExtensions = false; + } + + ObjectElement(objectElement: ObjectElement) { + const result = PatternedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'message'); + }); + + return result; + } +} + +export default ChannelAddressExpressionsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-bindings/index.ts new file mode 100644 index 0000000000..6720b3b87b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-bindings/index.ts @@ -0,0 +1,36 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import ChannelBindingsElement from '../../../../elements/ChannelBindings.ts'; + +/** + * @public + */ +export interface ChannelBindingsVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class ChannelBindingsVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: ChannelBindingsElement; + + declare protected readonly specPath: SpecPath<['document', 'objects', 'ChannelBindings']>; + + declare protected readonly canSupportSpecificationExtensions: true; + + constructor(options: ChannelBindingsVisitorOptions) { + super(options); + this.element = new ChannelBindingsElement(); + this.specPath = always(['document', 'objects', 'ChannelBindings']); + this.canSupportSpecificationExtensions = true; + } +} + +export default ChannelBindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts index 0510aa9f48..6a4dcbe941 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts @@ -21,7 +21,7 @@ class OperationsVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { constructor(options:OperationsVisitorOptions) { super(options); - this.element = new + this.element = new ComponentOperationsElement(); } ArrayElement(arrayElement: ArrayElement) { diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation new file mode 100644 index 0000000000..3c6d1451d6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + ExternalDocumentationVisitorOptions, + ExternalDocumentationVisitor as ExternalDocumentationVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ExternalDocumentationElement from '../../../elements/ExternalDocumentation'; + +export const BaseExternalDocumentationVisitor: typeof ExternalDocumentationVisitorType = + AsyncApi2Specification.visitors.document.objects.ExternalDocumentation.$visitor; + +export type { ExternalDocumentationVisitorOptions }; + +class ExternalDocumentationVisitor extends BaseExternalDocumentationVisitor { + declare public readonly element: ExternalDocumentationElement; + + constructor(options: ExternalDocumentationVisitorOptions) { + super(options); + this.element = new ExternalDocumentationElement(); + } +} + +export default ExternalDocumentationVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts new file mode 100644 index 0000000000..2321f1a06a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts @@ -0,0 +1,49 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement, isSchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; + +/** + * @public + */ +export interface DefaultVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class DefaultVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: DefaultVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: isSchemaElement, specPath: ['document', 'objects', 'Schema'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'MultiformatSchema'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'ref-header'); + } + + if(isSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'header-schema'); + } + + if(isMultiFormatSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'header-multiformat-schema') + } + + return result; + } +} + +export default DefaultVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts new file mode 100644 index 0000000000..fb5bff7405 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + MessageTraitVisitorOptions, + MessageTraitVisitor as MessageTraitVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import MessageTraitElement from '../../../../elements/MessageTrait.ts'; + +export const BaseMessageTraitVisitor: typeof MessageTraitVisitorType = + AsyncApi2Specification.visitors.document.objects. MessageTrait.$visitor; + +export type { MessageTraitVisitorOptions }; + +class MessageTraitVisitor extends BaseMessageTraitVisitor { + declare public readonly element: MessageTraitElement; + + constructor(options: MessageTraitVisitorOptions) { + super(options); + this.element = new MessageTraitElement(); + } +} + +export default MessageTraitVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts index 5b66e541df..92951cbb16 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts @@ -7,6 +7,7 @@ import AlternatingVisitor, { } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import { isReferenceElement, isReferenceLikeElement, isSchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; /** * @public @@ -37,7 +38,7 @@ class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { this.element.setMetaProperty('schema', 'header-schema'); } - else { + if(isMultiFormatSchemaElement(this.element)) { this.element.setMetaProperty('schema', 'header-multiformat-schema') } diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts index 55a48f5163..3567b218f6 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts @@ -4,7 +4,7 @@ import { OAuthFlowVisitor as OAuthFlowVisitorType, } from '@swagger-api/apidom-ns-asyncapi-2'; -import OAuthFlowElement from '../../../../elements/OAuthFlow.ts'; +import OAuthFlowElement from '../../../../elements/OauthFlow.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts index ab91c92430..2d6bf5f616 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts @@ -4,7 +4,7 @@ import { OAuthFlowsVisitor as OAuthFlowsVisitorType, } from '@swagger-api/apidom-ns-asyncapi-2'; -import OAuthFlowsElement from '../../../../elements/OAuthFlows.ts'; +import OAuthFlowsElement from '../../../../elements/OauthFlows.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts new file mode 100644 index 0000000000..5a4a257ee4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + OperationBindingsVisitorOptions, + OperationBindingsVisitor as OperationBindingsVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import OperationBindingsElement from '../../../../elements/OperationBindings.ts'; + +export const BaseOperationBindingsVisitor: typeof OperationBindingsVisitorType = + AsyncApi2Specification.visitors.document.objects.OperationBindings.$visitor; + +export type { OperationBindingsVisitorOptions }; + +class OperationBindingsVisitor extends BaseOperationBindingsVisitor { + declare public readonly element: OperationBindingsElement; + + constructor(options: OperationBindingsVisitorOptions) { + super(options); + this.element = new OperationBindingsElement(); + } +} + +export default OperationBindingsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts new file mode 100644 index 0000000000..360cc4501e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + OperationTraitVisitorOptions, + OperationTraitVisitor as OperationTraitVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import OperationTraitElement from '../../../../elements/OperationTrait.ts'; + +export const BaseOperationTraitVisitor: typeof OperationTraitVisitorType = + AsyncApi2Specification.visitors.document.objects. OperationTrait.$visitor; + +export type { OperationTraitVisitorOptions }; + +class OperationTraitVisitor extends BaseOperationTraitVisitor { + declare public readonly element: OperationTraitElement; + + constructor(options: OperationTraitVisitorOptions) { + super(options); + this.element = new OperationTraitElement(); + } +} + +export default OperationTraitVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameter/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameter/index.ts new file mode 100644 index 0000000000..2ae9e1a6b5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameter/index.ts @@ -0,0 +1,36 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import ParameterElement from '../../../../elements/Parameter.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface ParameterVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class ParameterVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: ParameterElement; + + declare protected readonly specPath: SpecPath<['document', 'objects', 'Parameter']>; + + declare protected readonly canSupportSpecificationExtensions: true; + + constructor(options: ParameterVisitorOptions) { + super(options); + this.element = new ParameterElement(); + this.specPath = always(['document', 'objects', 'Parameter']); + this.canSupportSpecificationExtensions = true; + } +} + +export default ParameterVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts new file mode 100644 index 0000000000..89ac93e51f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + ParametersVisitorOptions, + ParametersVisitor as ParametersVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ParametersElement from '../../../../elements/Parameters.ts'; + +export const BaseParametersVisitor: typeof ParametersVisitorType = + AsyncApi2Specification.visitors.document.objects.Parameters.$visitor; + +export type { ParametersVisitorOptions }; + +class ParametersVisitor extends BaseParametersVisitor { + declare public readonly element: ParametersElement; + + constructor(options: ParametersVisitorOptions) { + super(options); + this.element = new ParametersElement(); + } +} + +export default ParametersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts new file mode 100644 index 0000000000..102c8f8939 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + SecuritySchemeVisitorOptions, + SecuritySchemeVisitor as SecuritySchemeVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import SecuritySchemeElement from '../../../../elements/SecurityScheme.ts'; + +export const BaseSecuritySchemeVisitor: typeof SecuritySchemeVisitorType = + AsyncApi2Specification.visitors.document.objects.SecurityScheme.$visitor; + +export type { SecuritySchemeVisitorOptions }; + +class SecuritySchemeVisitor extends BaseSecuritySchemeVisitor { + declare public readonly element: SecuritySchemeElement; + + constructor(options: SecuritySchemeVisitorOptions) { + super(options); + this.element = new SecuritySchemeElement(); + } +} + +export default SecuritySchemeVisitor; \ No newline at end of file From 909e34ed5ca5c6859b09f70a528d2060c5fc6017 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Wed, 29 Oct 2025 20:10:47 +0530 Subject: [PATCH 18/27] feat: add specification --- .../src/elements/OperationTrait.ts | 14 + .../src/elements/Server.ts | 28 +- .../src/elements/Servers.ts | 4 +- .../src/elements/nces/OperationMessage.ts | 2 +- .../elements/nces/OperationReplyMessage.ts | 15 + .../src/refractor/specification.ts | 399 ++++++++++-------- .../visitors/async-api-3/BindingsVisitor.ts | 5 - .../ExternalDocumentationVisitor.ts | 5 - .../async-api-3/channel/ServersVisitor.ts | 7 +- .../external-documentation-object/index.ts | 23 + .../message-trait/HeadersVisitor.ts | 8 +- .../operation-reply-address/index.ts | 21 + .../operation-reply/AddressVisitor.ts | 40 ++ .../operation-reply/MessagesVisitor.ts | 40 ++ .../index.ts | 0 .../schema/SchemaOrReferenceVisitor.ts | 39 ++ .../schema/inherited-fixed-fields.ts | 14 + .../index.ts} | 0 .../async-api-3/server/ServerVisitor.ts | 24 -- .../visitors/async-api-3/server/index.ts | 29 ++ .../ServersVisitor.ts => servers/index.ts} | 0 21 files changed, 480 insertions(+), 237 deletions(-) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessage.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/{operationReply => operation-reply}/index.ts (100%) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/{server/ServerVariableVisitor.ts => server-variable/index.ts} (100%) delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/index.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/{server/ServersVisitor.ts => servers/index.ts} (100%) diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts index 72ec99478d..e79acddb08 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts @@ -2,11 +2,13 @@ import { StringElement, Attributes, Meta, + ObjectElement, } from '@swagger-api/apidom-core'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; import { OperationTraitElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; /** * @public @@ -17,6 +19,18 @@ class OperationTrait extends OperationTraitElement { this.element = 'operationTrait'; } +get operationId(): ObjectElement | undefined { + throw new UnsupportedOperationError( + 'operationId keyword from Core vocabulary has been removed', + ); +} + +set operationId(operationId: ObjectElement | undefined) { + throw new UnsupportedOperationError( + 'operationId keyword from Core vocabulary has been removed', + ); +} + get title(): StringElement | undefined { return this.get('title'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts index 6657f9e2fe..78c2580643 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -1,8 +1,8 @@ -import { ArrayElement, Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; -import { ServerBindingsElement, ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import TagsElement from './Tags.ts'; +import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; +import { ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; /** * @public @@ -13,8 +13,20 @@ class Server extends ServerElement { this.element = 'server'; } + get url(): ObjectElement | undefined { + throw new UnsupportedOperationError( + 'url keyword from Core vocabulary has been removed', + ); + } + + set url(url: ObjectElement | undefined) { + throw new UnsupportedOperationError( + 'url keyword from Core vocabulary has been removed', + ); + } + get host(): StringElement | undefined { - return this.get('host'); + return this.get('host'); } set host(host: StringElement | undefined) { @@ -29,14 +41,6 @@ class Server extends ServerElement { this.set('pathName', pathName); } - get description(): StringElement | undefined { - return this.get('description'); - } - - set description(description: StringElement | undefined) { - this.set('description', description); - } - get title(): StringElement | undefined { return this.get('title'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts index 9092299522..e7b0024dbe 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts @@ -1,5 +1,5 @@ -import { ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; // TODO: Should be ServersElement ? +import { ServersElement } from '@swagger-api/apidom-ns-asyncapi-2'; -class Servers extends ServerElement {} +class Servers extends ServersElement {} export default Servers; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts index 59e697313e..50b73241a5 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts @@ -3,6 +3,6 @@ import { OperationMessageElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ -class OperationMessage extends OperationMessageElement { } +class OperationMessage extends OperationMessageElement {} export default OperationMessage; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessage.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessage.ts new file mode 100644 index 0000000000..27079df443 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessage.ts @@ -0,0 +1,15 @@ +import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class OperationReplyMessage extends ArrayElement { + static primaryClass = 'operation-reply-message'; + + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(OperationReplyMessage.primaryClass); + } +} + +export default OperationReplyMessage; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 365886b510..2356c72552 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -15,13 +15,12 @@ import ComponentsSchemasVisitor from './visitors/async-api-3/components/SchemasV import ComponentsOperationsVisitor from './visitors/async-api-3/components/OperationsVisitor.ts'; import DefaultContentTypeVisitor from '../elements/DefaultContentType.ts'; import SecuritySchemesVisitor from './visitors/async-api-3/SecuritySchemesVisitor.ts'; -import ServerVisitor from './visitors/async-api-3/server/ServerVisitor.ts'; -import ServerVariableVisitor from './visitors/async-api-3/server/ServerVariableVisitor.ts'; +import ServerVisitor from './visitors/async-api-3/server/index.ts'; +import ServerVariableVisitor from './visitors/async-api-3/server-variable/index.ts'; import ParametersVisitor from './visitors/async-api-3/parameters/index.ts'; import ParameterVisitor from './visitors/async-api-3/parameter/index.ts'; -import BindingsVisitor from './visitors/async-api-3/BindingsVisitor.ts'; import TagsVisitor from './visitors/async-api-3/tags/index.ts'; -import ExternalDocumentationVisitor from './visitors/async-api-3/ExternalDocumentationVisitor.ts'; +import ExternalDocumentationVisitor from './visitors/async-api-3/external-documentation-object/index.ts'; import OperationVisitor from './visitors/async-api-3/operation/OperationVisitor.ts'; import OperationsVisitor from './visitors/async-api-3/operations/index.ts'; @@ -42,8 +41,8 @@ import MessageBindingsVisitor from './visitors/async-api-3/message/BindingsVisit import MessageHeadersVisitor from './visitors/async-api-3/message/HeadersVisitor.ts'; import MessageTraitsVisitor from './visitors/async-api-3/message/TraitsVisitor.ts'; import MessageCorrelationIdVisitor from './visitors/async-api-3/message/CorrelationIdVisitor.ts'; -import OperationReplyVisitor from './visitors/async-api-3/operationReply/index.ts'; -import ServersVisitor from './visitors/async-api-3/server/ServersVisitor.ts'; +import OperationReplyVisitor from './visitors/async-api-3/operation-reply/index.ts'; +import ServersVisitor from './visitors/async-api-3/servers/index.ts'; import MultiFormatSchemaVisitor from './visitors/async-api-3/multiFormatSchema/index.ts' import ChannelBindingsVisitor from './visitors/async-api-3/channel-bindings/index.ts'; import MessageTraitVisitor from './visitors/async-api-3/message-trait/index.ts'; @@ -54,6 +53,35 @@ import OAuthFlowVisitor from './visitors/async-api-3/oauth-flow/index.ts'; import OAuthFlowsVisitor from './visitors/async-api-3/oauth-flows/index.ts'; import ServerBindingsVisitor from './visitors/async-api-3/server-bindings/index.ts'; import ChannelAddressExpressionsVisitor from './visitors/async-api-3/channel-address-expression/index.ts'; +import OperationTraitVisitor from './visitors/async-api-3/operation-trait/index.ts'; +import OperationReplyAddressVisitor from './visitors/async-api-3/operation-reply-address/index.ts'; +import OperationReplyAddressVisitor_ from './visitors/async-api-3/operation-reply/AddressVisitor.ts'; +import OperationReplyMessagesVisitor from './visitors/async-api-3/operation-reply/MessagesVisitor.ts'; +import { default as schemaInheritedFixedFields } from './visitors/async-api-3/schema/inherited-fixed-fields.ts' + +const SchemaSpecification = { + $visitor: SchemaVisitor, + fixedFields: { + ...schemaInheritedFixedFields, + // validation vocabulary + // validation keywords for Applying Subschemas With Boolean Logic + allOf: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.allOf, + anyOf: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.anyOf, + oneOf: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.oneOf, + // validation Keywords for Arrays + items: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.items, + // validation Keywords for Objects + properties: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.properties, + patternProperties: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.patternProperties, + dependencies: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.dependencies, + // validation Vocabulary for Schema Re-Use With "definitions" + definitions: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.definitions, + // AsyncAPI vocabulary + discriminator:AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.discriminator, + externalDocs: ExternalDocumentationVisitor, + deprecated: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.deprecated + }, +}; const specification = { visitors: { @@ -85,10 +113,10 @@ const specification = { Info: { $visitor: InfoVisitor, fixedFields: { - title: { $ref: '#/visitors/value' }, + title: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.title, version: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.version, - description: { $ref: '#/visitors/value' }, - termsOfService: { $ref: '#/visitors/value' }, + description: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.description, + termsOfService: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.termsOfService, contact: { $ref: '#/visitors/document/objects/Contact' }, license: { $ref: '#/visitors/document/objects/License' }, externalDocs: ExternalDocsVisitor, @@ -100,16 +128,16 @@ const specification = { Contact: { $visitor: ContactVisitor, fixedFields: { - name: { $ref: '#/visitors/value' }, - url: { $ref: '#/visitors/value' }, - email: { $ref: '#/visitors/value' }, + name: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.name, + url: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.url, + email: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.email }, }, License: { $visitor: LicenseVisitor, fixedFields: { - name: { $ref: '#/visitors/value' }, - url: { $ref: '#/visitors/value' }, + name: AsyncApi2_0Specification.visitors.document.objects.License.fixedFields.name, + url: AsyncApi2_0Specification.visitors.document.objects.License.fixedFields.url }, }, Servers: { @@ -119,14 +147,14 @@ const specification = { $visitor: ServerVisitor, fixedFields: { host: { $ref: '#/visitors/value' }, - protocol: { $ref: '#/visitors/value' }, - protocolVersion: { $ref: '#/visitors/value' }, + protocol: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.protocol, + protocolVersion: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.protocolVersion, pathname: { $ref: '#/visitors/value' }, - description: { $ref: '#/visitors/value' }, + description: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.description, title: { $ref: '#/visitors/value' }, summary: { $ref: '#/visitors/value' }, variables: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.variables, - security:AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.security, + security: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.security, tags: { $ref: '#/visitors/document/objects/Tags', }, @@ -137,10 +165,10 @@ const specification = { ServerVariable: { $visitor: ServerVariableVisitor, fixedFields: { - enum: { $ref: '#/visitors/value' }, - default: { $ref: '#/visitors/value' }, - description: { $ref: '#/visitors/value' }, - examples: { $ref: '#/visitors/value' }, + enum: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.enum, + default: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.default, + description: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.description, + examples: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.examples }, }, DefaultContentType: { @@ -167,6 +195,9 @@ const specification = { ChannelAddressExpressions: { $visitor: ChannelAddressExpressionsVisitor }, + Messages: { + $visitor: MessagesVisitor + }, Operations: { $visitor: OperationsVisitor, }, @@ -185,17 +216,37 @@ const specification = { traits: OperationTraitsVisitor, message: OperationMessagesVisitor, reply: OperationReplyVisitor, - }, }, + OperationTrait: { + $visitors: OperationTraitVisitor, + fixedFields: { + title: { $ref: '#/visitors/value' }, + summary: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.summary, + description: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.description, + security: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.security, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + externalDocs: ExternalDocumentationVisitor, + bindings: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.bindings, + } + }, OperationReply: { $visitor: OperationReplyVisitor, fixedFields: { - address: { $ref: '#/visitors/value' }, - channel: { $ref: '#/visitors/value' }, - messages: { $ref: '#/visitors/value' }, + address: OperationReplyAddressVisitor_, + channel: { $ref: '#/visitors/document/objects/Reference' }, + messages: OperationReplyMessagesVisitor }, }, + OperationReplyAddress: { + $visitor: OperationReplyAddressVisitor, + fixedFields: { + description: { $ref: '#/visitors/value' }, + location: {$ref: '#/visitors/value' } + } + }, Parameters: { $visitor: ParametersVisitor, }, @@ -206,11 +257,70 @@ const specification = { default: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, examples: { $ref: '#/visitors/value' }, - location: { $ref: '#/visitors/location' }, + location: { $ref: '#/visitors/value' }, }, }, - Bindings: { - $visitor: BindingsVisitor, + ServerBindings: { + $visitor: ServerBindingsVisitor, + fixedFields: { + http: { + $ref: '#/visitors/document/objects/bindings/http/ServerBinding', + }, + ws: { + $ref: '#/visitors/document/objects/bindings/ws/ServerBinding', + }, + kafka: { + $ref: '#/visitors/document/objects/bindings/kafka/ServerBinding', + }, + anypointmq: { + $ref: '#/visitors/document/objects/bindings/anypointmq/ServerBinding', + }, + amqp: { + $ref: '#/visitors/document/objects/bindings/amqp/ServerBinding', + }, + amqp1: { + $ref: '#/visitors/document/objects/bindings/amqp1/ServerBinding', + }, + mqtt: { + $ref: '#/visitors/document/objects/bindings/mqtt/ServerBinding', + }, + mqtt5: { + $ref: '#/visitors/document/objects/bindings/mqtt5/ServerBinding', + }, + nats: { + $ref: '#/visitors/document/objects/bindings/nats/ServerBinding', + }, + jms: { + $ref: '#/visitors/document/objects/bindings/jms/ServerBinding', + }, + sns: { + $ref: '#/visitors/document/objects/bindings/sns/ServerBinding', + }, + solace: { + $ref: '#/visitors/document/objects/bindings/solace/ServerBinding', + }, + sqs: { + $ref: '#/visitors/document/objects/bindings/sqs/ServerBinding', + }, + stomp: { + $ref: '#/visitors/document/objects/bindings/stomp/ServerBinding', + }, + redis: { + $ref: '#/visitors/document/objects/bindings/redis/ServerBinding', + }, + mercure: { + $ref: '#/visitors/document/objects/bindings/mercure/ServerBinding', + }, + ibmmq: { + $ref: '#/visitors/document/objects/bindings/ibmmq/ServerBinding', + }, + googlepubsub: { + $ref: '#/visitors/document/objects/bindings/googlepubsub/ServerBinding', + }, + pulsar: { + $ref: '#/visitors/document/objects/bindings/pulsar/ServerBinding', + }, + }, }, ChannelBindings: { $visitor: ChannelBindingsVisitor, @@ -398,127 +508,6 @@ const specification = { }, }, }, - Components: { - $visitor: ComponentsVisitor, - fixedFields: { - schemas: ComponentsSchemasVisitor, - servers: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.servers, - channels: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channels, - serverVariables: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverVariables, - operations: ComponentsOperationsVisitor, - messages: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messages, - securitySchemes: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.securitySchemes, - parameters: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.parameters, - correlationIds: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.correlationIds, - replies: { $ref: '#/visitors/value' }, - replyAddresses: { $ref: '#/visitors/value' }, - tags: { $ref: '#/visitors/document/objects/Tags' }, - externalDocs: ExternalDocumentationVisitor, - operationTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationTraits, - messageTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageTraits, - serverBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverBindings, - channelBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channelBindings, - operationBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationBindings, - messageBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageBindings - }, - }, - OAuthFlows: { - $visitor: OAuthFlowsVisitor, - fixedFields: { - implicit: { - $ref: '#/visitors/document/objects/OAuthFlow', - }, - password: { - $ref: '#/visitors/document/objects/OAuthFlow', - }, - clientCredentials: { - $ref: '#/visitors/document/objects/OAuthFlow', - }, - authorizationCode: { - $ref: '#/visitors/document/objects/OAuthFlow', - }, - }, - }, - OAuthFlow: { - $visitor: OAuthFlowVisitor, - fixedFields: { - authorizationUrl: { $ref: '#/visitors/value' }, - tokenUrl: { $ref: '#/visitors/value' }, - refreshUrl: { $ref: '#/visitors/value' }, - availableScopes: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.scopes - }, - }, - ServerBindings: { - $visitor: ServerBindingsVisitor, - fixedFields: { - http: { - $ref: '#/visitors/document/objects/bindings/http/ServerBinding', - }, - ws: { - $ref: '#/visitors/document/objects/bindings/ws/ServerBinding', - }, - kafka: { - $ref: '#/visitors/document/objects/bindings/kafka/ServerBinding', - }, - anypointmq: { - $ref: '#/visitors/document/objects/bindings/anypointmq/ServerBinding', - }, - amqp: { - $ref: '#/visitors/document/objects/bindings/amqp/ServerBinding', - }, - amqp1: { - $ref: '#/visitors/document/objects/bindings/amqp1/ServerBinding', - }, - mqtt: { - $ref: '#/visitors/document/objects/bindings/mqtt/ServerBinding', - }, - mqtt5: { - $ref: '#/visitors/document/objects/bindings/mqtt5/ServerBinding', - }, - nats: { - $ref: '#/visitors/document/objects/bindings/nats/ServerBinding', - }, - jms: { - $ref: '#/visitors/document/objects/bindings/jms/ServerBinding', - }, - sns: { - $ref: '#/visitors/document/objects/bindings/sns/ServerBinding', - }, - solace: { - $ref: '#/visitors/document/objects/bindings/solace/ServerBinding', - }, - sqs: { - $ref: '#/visitors/document/objects/bindings/sqs/ServerBinding', - }, - stomp: { - $ref: '#/visitors/document/objects/bindings/stomp/ServerBinding', - }, - redis: { - $ref: '#/visitors/document/objects/bindings/redis/ServerBinding', - }, - mercure: { - $ref: '#/visitors/document/objects/bindings/mercure/ServerBinding', - }, - ibmmq: { - $ref: '#/visitors/document/objects/bindings/ibmmq/ServerBinding', - }, - googlepubsub: { - $ref: '#/visitors/document/objects/bindings/googlepubsub/ServerBinding', - }, - pulsar: { - $ref: '#/visitors/document/objects/bindings/pulsar/ServerBinding', - }, - }, - }, - SecuritySchemes: { - $visitor: SecuritySchemesVisitor, - }, - OperationMessage: { - $visitor: MessageVisitor, - }, - Messages: { - $visitor: MessagesVisitor - }, Message: { $visitor: MessageVisitor, fixedFields: { @@ -542,15 +531,14 @@ const specification = { MessageTrait: { $visitor: MessageTraitVisitor, fixedFields: { - messageId: { $ref: '#/visitors/value' }, headers: MessageTraitHeadersVisitor, correlationId: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.correlationId, - schemaFormat: { $ref: '#/visitors/value' }, - contentType: { $ref: '#/visitors/value' }, - name: { $ref: '#/visitors/value' }, - title: { $ref: '#/visitors/value' }, - summary: { $ref: '#/visitors/value' }, - description: { $ref: '#/visitors/value' }, + schemaFormat: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.schemaFormat, + contentType:AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.contentType, + name: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.name, + title: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.title, + summary: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.summary, + description: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.description, tags: { $ref: '#/visitors/document/objects/Tags', }, @@ -562,15 +550,15 @@ const specification = { MessageExample: { $visitor: MessageExampleVisitor, fixedFields: { - headers: { $ref: '#/visitors/value' }, - payload: { $ref: '#/visitors/value' }, - name: { $ref: '#/visitors/value' }, - summary: { $ref: '#/visitors/value' }, + headers: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.headers, + payload: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.payload, + name: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.name, + summary: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.summary }, }, - tags: { - $visitor: TagsVisitor, - }, + Tags: { + $visitor: TagsVisitor, + }, Tag: { $visitor: TagVisitor, fixedFields: { @@ -582,16 +570,38 @@ const specification = { ExternalDocumentation: { $visitor: ExternalDocumentationVisitor, fixedFields: { - description: { $ref: '#/visitors/value' }, - url: { $ref: '#/visitors/value' }, + description: AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation.fixedFields.description, + url: AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation.fixedFields.url + }, + }, + Reference: { + $visitor: ReferenceVisitor, + fixedFields: { + $ref: AsyncApi2_0Specification.visitors.document.objects.Reference.fixedFields.$ref }, }, - Schema: { - $visitor: SchemaVisitor, + Components: { + $visitor: ComponentsVisitor, fixedFields: { - $ref: { $ref: '#/visitors/document/objects/Reference' }, - type: { $ref: '#/visitors/value' }, - properties: { $ref: '#/visitors/document/objects/Schema' }, + schemas: ComponentsSchemasVisitor, + servers: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.servers, + channels: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channels, + serverVariables: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverVariables, + operations: ComponentsOperationsVisitor, + messages: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messages, + securitySchemes: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.securitySchemes, + parameters: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.parameters, + correlationIds: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.correlationIds, + replies: { $ref: '#/visitors/value' }, + replyAddresses: { $ref: '#/visitors/value' }, + tags: { $ref: '#/visitors/document/objects/Tags' }, + externalDocs: ExternalDocumentationVisitor, + operationTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationTraits, + messageTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageTraits, + serverBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverBindings, + channelBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channelBindings, + operationBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationBindings, + messageBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageBindings }, }, MultiFormatSchema: { @@ -602,25 +612,52 @@ const specification = { properties: { $ref: '#/visitors/document/objects/MultiFormatSchema' }, }, }, - Reference: { - $visitor: ReferenceVisitor, + Schema: SchemaSpecification, + OAuthFlows: { + $visitor: OAuthFlowsVisitor, + fixedFields: { + implicit: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + password: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + clientCredentials: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + authorizationCode: { + $ref: '#/visitors/document/objects/OAuthFlow', + }, + }, + }, + OAuthFlow: { + $visitor: OAuthFlowVisitor, fixedFields: { - $ref: { $ref: '#/visitors/value' }, + authorizationUrl:AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.authorizationUrl, + tokenUrl: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.tokenUrl, + refreshUrl: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.refreshUrl, + availableScopes: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.scopes }, }, + SecuritySchemes: { + $visitor: SecuritySchemesVisitor, + }, + OperationMessage: { + $visitor: MessageVisitor, + }, SecurityScheme: { $visitor: SecuritySchemeVisitor, fixedFields: { - type: { $ref: '#/visitors/value' }, - description: { $ref: '#/visitors/value' }, - name: { $ref: '#/visitors/value' }, - in: { $ref: '#/visitors/value' }, - scheme: { $ref: '#/visitors/value' }, - bearerFormat: { $ref: '#/visitors/value' }, + type: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.type, + description: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.description, + name: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.name, + in: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.in, + scheme: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.scheme, + bearerFormat: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.bearerFormat, flows: { $ref: '#/visitors/document/objects/OAuthFlows', }, - openIdConnectUrl: { $ref: '#/visitors/value' }, + openIdConnectUrl: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.openIdConnectUrl, scopes: { $ref: '#/visitors/value' }, }, }, diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts deleted file mode 100644 index 57d1c26b0b..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/BindingsVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class BindingsVisitor extends Visitor {} - -export default BindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts deleted file mode 100644 index b85179f82c..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ExternalDocumentationVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class ExternalDocumentationVisitor extends Visitor {} - -export default ExternalDocumentationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts index ece7c3e0f8..25249a771e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts @@ -25,11 +25,12 @@ class ServersVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { } ArrayElement(arrayElement: ArrayElement) { - arrayElement.forEach((item: Element) => { - const element = cloneDeep(item); + arrayElement.forEach((item: Element): void => { + const specPath = ['document', 'objects', 'Reference']; + const element = this.toRefractedElement(specPath, item); if (isReferenceElement(element)) { - element.classes.push('server-name'); + element.setMetaProperty('referenced-element', 'channel-servers'); } this.element.push(element); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts new file mode 100644 index 0000000000..e0ce87cee9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts @@ -0,0 +1,23 @@ +import { + specificationObj as AsyncApi2Specification, + ExternalDocumentationVisitorOptions, + ExternalDocumentationVisitor as ExternalDocumentationVisitorType, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ExternalDocumentationElement from '../../../../elements/ExternalDocumentation.ts'; + +export const BaseExternalDocumentationVisitor: typeof ExternalDocumentationVisitorType = + AsyncApi2Specification.visitors.document.objects.ExternalDocumentation.$visitor; + +export type { ExternalDocumentationVisitorOptions }; + +class ExternalDocumentationVisitor extends BaseExternalDocumentationVisitor { + declare public readonly element: ExternalDocumentationElement; + + constructor(options: ExternalDocumentationVisitorOptions) { + super(options); + this.element = new ExternalDocumentationElement(); + } +} + +export default ExternalDocumentationVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts index 2321f1a06a..92951cbb16 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts @@ -12,13 +12,13 @@ import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; /** * @public */ -export interface DefaultVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} +export interface HeadersVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} /** * @public */ -class DefaultVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { - constructor(options: DefaultVisitorOptions) { +class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: HeadersVisitorOptions) { super(options); this.alternator = [ { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, @@ -46,4 +46,4 @@ class DefaultVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { } } -export default DefaultVisitor; +export default HeadersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts new file mode 100644 index 0000000000..8c116b0127 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts @@ -0,0 +1,21 @@ +// filepath: packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationReplyAddressVisitor.ts +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import OperationReplyAddressElement from '../../../../elements/OperationReplyAddress.ts'; +import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor from '../../FallbackVisitor.ts'; +import { always } from 'ramda'; + +class OperationReplyAddressVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: OperationReplyAddressElement; + + constructor(options: any) { + super(options); + this.element = new OperationReplyAddressElement(); + this.specPath = always(['document', 'objects', 'OperationReplyAddress']); + this.canSupportSpecificationExtensions = true; + } +} + +export default OperationReplyAddressVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts new file mode 100644 index 0000000000..adac8ee109 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts @@ -0,0 +1,40 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + + +/** + * @public + */ +export interface AddressVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class AddressVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: AddressVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'OperationReplyAddress'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'operationReplyAddress'); + } + + return result; + } +} + +export default AddressVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts new file mode 100644 index 0000000000..2f6d541ec0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts @@ -0,0 +1,40 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; + +import OperationReplyMessagesElement from '../../../../elements/nces/OperationReplyMessage.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +export interface MessagesVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} + +class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: OperationReplyMessagesElement; + + constructor(options: MessagesVisitorOptions) { + super(options); + this.element = new OperationReplyMessagesElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element): void => { + const specPath = ['document', 'objects', 'Reference']; + const element = this.toRefractedElement(specPath, item); + + if (isReferenceElement(element)) { + element.setMetaProperty('referenced-element', 'operation-reply-messages'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default MessagesVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operationReply/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts similarity index 100% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operationReply/index.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts new file mode 100644 index 0000000000..3f54728339 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts @@ -0,0 +1,39 @@ +import { Element } from '@swagger-api/apidom-core'; +import { + specificationObj as JSONSchemaDraft7Specification, + SchemaOrReferenceVisitorOptions, + SchemaOrReferenceVisitor as SchemaOrReferenceVisitorType, +} from '@swagger-api/apidom-ns-json-schema-draft-7'; + + +import SchemaElement from '../../../../elements/Schema.ts'; +import JSONReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +export type { SchemaOrReferenceVisitorOptions }; + +/** + * @public + */ +// eslint-disable-next-line prefer-destructuring +export const JSONSchemaOrJSONReferenceVisitor: typeof SchemaOrReferenceVisitorType = + JSONSchemaDraft7Specification.visitors.JSONSchemaOrJSONReferenceVisitor; + +/** + * @public + */ +class SchemaOrReferenceVisitor extends JSONSchemaOrJSONReferenceVisitor { + declare public element: SchemaElement | JSONReferenceElement; + + enter(element: Element) { + const result = JSONSchemaOrJSONReferenceVisitor.prototype.enter.call(this, element); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'schema'); + } + + return result; + } +} + +export default SchemaOrReferenceVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts new file mode 100644 index 0000000000..8dccadf5ee --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts @@ -0,0 +1,14 @@ +import { map } from 'ramda'; +import { specificationObj as JSONSchemaDraft7Specification } from '@swagger-api/apidom-ns-json-schema-draft-7'; + +import SchemaOrReferenceVisitor from './SchemaOrReferenceVisitor.ts'; + +// @ts-ignore +const inheritedFixedFields = map((visitor) => { + if (visitor === JSONSchemaDraft7Specification.visitors.JSONSchemaOrJSONReferenceVisitor) { + return SchemaOrReferenceVisitor; + } + return visitor; +}, JSONSchemaDraft7Specification.visitors.document.objects.JSONSchema.fixedFields); + +export default inheritedFixedFields; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVariableVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-variable/index.ts similarity index 100% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVariableVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-variable/index.ts diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts deleted file mode 100644 index 8404acc293..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServerVisitor.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ServerVisitorOptions } from '@swagger-api/apidom-ns-asyncapi-2'; - -import ServerElement from '../../../../elements/Server.ts'; -import Visitor from '../../Visitor.ts'; - -/** - * @public - */ - -export type { ServerVisitorOptions }; - -/** - * @public - */ -class ServerVisitor extends Visitor { - declare public readonly element: ServerElement; - - constructor(options: ServerVisitorOptions) { - super(options); - this.element = new ServerElement(); - } -} - -export default ServerVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/index.ts new file mode 100644 index 0000000000..24623e1c17 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/index.ts @@ -0,0 +1,29 @@ +import { + specificationObj as AsyncApi2Specification, + ServerVisitor as ServerVisitorType, + ServerVisitorOptions, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import ServerElement from '../../../../elements/Server.ts'; + +/** + * @public + */ +export const BaseServerVisitor: typeof ServerVisitorType = + AsyncApi2Specification.visitors.document.objects.Server.$visitor; + +export type { ServerVisitorOptions }; + +/** + * @public + */ +class ServerVisitor extends BaseServerVisitor { + declare public readonly element: ServerElement; + + constructor(options: ServerVisitorOptions) { + super(options); + this.element = new ServerElement(); + } +} + +export default ServerVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts similarity index 100% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/ServersVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts From 6b6a72e4613d46cee43e111914b67a90cf83aae9 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Mon, 3 Nov 2025 17:40:13 +0530 Subject: [PATCH 19/27] feat: add missing refractor files --- packages/apidom-ns-asyncapi-2/src/index.ts | 21 +- .../src/elements/AsyncApi3.ts | 1 - .../src/elements/ChannelAddressExpressions.ts | 13 + .../src/elements/MultiFormatSchema.ts | 14 +- .../src/elements/OauthFlow.ts | 12 +- .../src/elements/nces/ChannelServers.ts | 2 +- .../src/elements/nces/ComponentsChannels.ts | 8 + .../nces/ComponentsExternalDocumentation.ts | 14 + ...tOperations.ts => ComponentsOperations.ts} | 6 +- .../src/elements/nces/ComponentsReplies.ts | 14 + .../elements/nces/ComponentsReplyAddresses.ts | 14 + .../src/elements/nces/ComponentsTags.ts | 14 + .../elements/nces/OperationTraitSecurity.ts | 8 + .../src/elements/nces/SecuritySchemeScopes.ts | 15 + .../src/elements/nces/ServerSecurity.ts | 8 + packages/apidom-ns-asyncapi-3/src/index.ts | 145 +- .../apidom-ns-asyncapi-3/src/media-types.ts | 15 +- .../apidom-ns-asyncapi-3/src/predicates.ts | 263 +++- .../src/refractor/index.ts | 41 +- .../plugins/replace-empty-element.ts | 1236 +++++++++++++++++ .../src/refractor/predicates.ts | 30 +- .../src/refractor/specification.ts | 152 +- .../visitors/DefaultContentTypeVisitor.ts | 23 - .../async-api-3/DefaultContentTypeVisitor.ts | 31 + .../visitors/async-api-3/ParametersVisitor.ts | 5 - .../async-api-3/SecuritySchemesVisitor.ts | 5 - .../index.ts | 2 +- .../async-api-3/channel/BindingsVisitor.ts | 3 +- .../visitors/async-api-3/channels/index.ts | 53 +- .../async-api-3/components/ChannelsVisitor.ts | 45 + .../ExternalDocumentationVisitor.ts | 47 + .../components/OperationsVisitor.ts | 47 +- .../async-api-3/components/RepliesVisitor.ts | 45 + .../components/ReplyAddressesVisitor.ts | 45 + .../async-api-3/components/SchemasVisitor.ts | 36 +- .../async-api-3/components/TagsVisitor.ts | 45 + .../async-api-3/external-documentation | 23 - ...ExternalDocumentationOrReferenceVisitor.ts | 39 + .../message-trait/HeadersVisitor.ts | 24 +- .../async-api-3/message/BindingsVisitor.ts | 3 +- .../message/CorrelationIdVisitor.ts | 3 +- .../async-api-3/message/HeadersVisitor.ts | 24 +- .../async-api-3/message/PayloadVisitor.ts | 57 + .../async-api-3/message/TraitsVisitor.ts | 2 +- .../visitors/async-api-3/message/index.ts | 32 +- .../visitors/async-api-3/messages/index.ts | 57 +- .../async-api-3/multiFormatSchema/index.ts | 39 +- .../operation-reply/AddressVisitor.ts | 4 +- .../async-api-3/operation/BindingsVisitor.ts | 3 +- .../async-api-3/operation/ChannelVisitor.ts | 47 + .../async-api-3/operation/MessagesVisitor.ts | 13 +- .../async-api-3/operation/ReplyVisitor.ts | 3 +- .../async-api-3/operation/SecurityVisitor.ts | 3 +- .../async-api-3/operation/TraitsVisitor.ts | 2 +- .../{OperationVisitor.ts => index.ts} | 23 +- .../visitors/async-api-3/operations/index.ts | 47 +- .../visitors/async-api-3/schema/index.ts | 10 +- .../security-scheme/ScopesVisitor.ts | 43 + .../async-api-3/server/SecurityVisitor.ts | 47 + .../visitors/async-api-3/servers/index.ts | 3 +- .../visitors/async-api-3/tags/index.ts | 38 +- .../generics/ExternalDocumentationVisitor.ts | 9 +- .../src/refractor/visitors/registration.ts | 1230 ++++++++++++++++ .../src/traversal/visitor.ts | 158 +++ 64 files changed, 4105 insertions(+), 359 deletions(-) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsExternalDocumentation.ts rename packages/apidom-ns-asyncapi-3/src/elements/nces/{ComponentOperations.ts => ComponentsOperations.ts} (64%) create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplies.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplyAddresses.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraitSecurity.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/SecuritySchemeScopes.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/ServerSecurity.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/{channel-address-expression => channel-address-expressions}/index.ts (95%) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/{OperationVisitor.ts => index.ts} (62%) create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/refractor/visitors/registration.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts diff --git a/packages/apidom-ns-asyncapi-2/src/index.ts b/packages/apidom-ns-asyncapi-2/src/index.ts index 9f417de0de..bb76365e57 100644 --- a/packages/apidom-ns-asyncapi-2/src/index.ts +++ b/packages/apidom-ns-asyncapi-2/src/index.ts @@ -17,7 +17,7 @@ export type { Format } from './media-types.ts'; // eslint-disable-next-line no-restricted-exports export { default } from './namespace.ts'; -export type { default as specificationObj } from './refractor/specification.ts'; +export { default as specificationObj } from './refractor/specification.ts'; export { default as refractorPluginReplaceEmptyElement } from './refractor/plugins/replace-empty-element.ts'; @@ -646,8 +646,8 @@ export type { PropertiesVisitorOptions as SchemaPropertiesVisitorOptions, JSONSchemaPropertiesVisitor, } from './refractor/visitors/async-api-2/schema/PropertiesVisitor.ts'; +export { default as SchemaOrReferenceVisitor } from './refractor/visitors/async-api-2/schema/SchemaOrReferenceVisitor.ts'; export type { - default as SchemaOrReferenceVisitor, SchemaOrReferenceVisitorOptions, JSONSchemaOrJSONReferenceVisitor, } from './refractor/visitors/async-api-2/schema/SchemaOrReferenceVisitor.ts'; @@ -859,9 +859,17 @@ export { WebSocketServerBindingElement, } from './refractor/registration.ts'; +export { default as ComponentsChannelsElement } from './elements/nces/ComponentsChannels.ts'; +export { default as ComponentsSchemasElement } from './elements/nces/ComponentsSchemas.ts'; +export { default as MessageExamplesElement } from './elements/nces/MessageExamples.ts'; +export { default as MessageTraitsElement } from './elements/nces/MessageTraits.ts'; +export { default as OperationMessageElement } from './elements/nces/OperationMessage.ts'; +export { default as OperationSecurityElement } from './elements/nces/OperationSecurity.ts'; +export { default as OperationTraitsElement } from './elements/nces/OperationTraits.ts'; +export { default as ServerSecurityElement } from './elements/nces/ServerSecurity.ts'; + export type { default as ChannelItemsServersElement } from './elements/nces/ChannelItemsServers.ts'; export type { default as ComponentsChannelBindingsElement } from './elements/nces/ComponentsChannelBindings.ts'; -export type { default as ComponentsChannelsElement } from './elements/nces/ComponentsChannels.ts'; export type { default as ComponentsCorrelationIDsElement } from './elements/nces/ComponentsCorrelationIDs.ts'; export type { default as ComponentsMessageBindingsElement } from './elements/nces/ComponentsMessageBindings.ts'; export type { default as ComponentsMessagesElement } from './elements/nces/ComponentsMessages.ts'; @@ -869,19 +877,12 @@ export type { default as ComponentsMessageTraitsElement } from './elements/nces/ export type { default as ComponentsOperationBindingsElement } from './elements/nces/ComponentsOperationBindings.ts'; export type { default as ComponentsOperationTraitsElement } from './elements/nces/ComponentsOperationTraits.ts'; export type { default as ComponentsParametersElement } from './elements/nces/ComponentsParameters.ts'; -export type { default as ComponentsSchemasElement } from './elements/nces/ComponentsSchemas.ts'; export type { default as ComponentsSecuritySchemesElement } from './elements/nces/ComponentsSecuritySchemes.ts'; export type { default as ComponentsServerBindingsElement } from './elements/nces/ComponentsServerBindings.ts'; export type { default as ComponentsServersElement } from './elements/nces/ComponentsServers.ts'; export type { default as ComponentsServerVariablesElement } from './elements/nces/ComponentsServerVariables.ts'; -export type { default as MessageExamplesElement } from './elements/nces/MessageExamples.ts'; export type { default as MessageTraitExamplesElement } from './elements/nces/MessageTraitExamples.ts'; -export type { default as MessageTraitsElement } from './elements/nces/MessageTraits.ts'; export type { default as OAuthFlowScopesElement } from './elements/nces/OAuthFlowScopes.ts'; -export type { default as OperationMessageElement } from './elements/nces/OperationMessage.ts'; export type { default as OperationMessageMapElement } from './elements/nces/OperationMessageMap.ts'; -export type { default as OperationSecurityElement } from './elements/nces/OperationSecurity.ts'; -export type { default as OperationTraitsElement } from './elements/nces/OperationTraits.ts'; export type { default as OperationTraitSecurityElement } from './elements/nces/OperationTraitSecurity.ts'; -export type { default as ServerSecurityElement } from './elements/nces/ServerSecurity.ts'; export type { default as ServerVariablesElement } from './elements/nces/ServerVariables.ts'; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts index 33b93f25da..e5599ac221 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts @@ -10,7 +10,6 @@ class AsyncApi3 extends AsyncApi2Element { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'asyncApi3'; - this.classes.push('api'); } get tags(): TagsElement | undefined { diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts b/packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts new file mode 100644 index 0000000000..5c13998466 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts @@ -0,0 +1,13 @@ +import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class ChannelAddressExpressions extends ObjectElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'channelAddressExpressions'; + } +} + +export default ChannelAddressExpressions; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts index 101be5f70b..d39eb74f1f 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts @@ -6,24 +6,24 @@ import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/api class MultiFormatSchema extends ObjectElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); - this.element = 'MultiformatSchema'; + this.element = 'multiformatSchema'; } - get schemaForamt(): StringElement | undefined { + get schemaFormat(): StringElement | undefined { return this.get('schemaForamt') } - set schemaForamt(schemaForamt: StringElement | undefined ) { - this.set('schemaFormat', schemaForamt); + set schemaFormat(schemaFormat: StringElement | undefined ) { + this.set('schemaFormat', schemaFormat); } get schema() { - return this.get('schema') + return this.get('schema'); } set schema(schema) { - this.set('schema', schema); + this.set('schema', schema); } } -export default MultiFormatSchema; \ No newline at end of file +export default MultiFormatSchema; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts index fe86f2e256..82cb20311b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts @@ -3,12 +3,12 @@ import { UnsupportedOperationError } from '@swagger-api/apidom-error'; import { OAuthFlowElement } from '@swagger-api/apidom-ns-asyncapi-2'; class OAuthFlow extends OAuthFlowElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'oauthFlow'; - } + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'oAuthFlow'; + } - get scopes(): ObjectElement | undefined { + get scopes(): ObjectElement | undefined { throw new UnsupportedOperationError( 'scopes keyword from Core vocabulary has been renamed to availableScopes.', ); @@ -29,4 +29,4 @@ class OAuthFlow extends OAuthFlowElement { } } -export default OAuthFlow; \ No newline at end of file +export default OAuthFlow; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts index 7396c7595a..e827080fee 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts @@ -3,7 +3,7 @@ import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; * @public */ class ChannelServers extends ArrayElement { - static primaryClass = 'channel-server-names-list'; + static primaryClass = 'channel-servers'; constructor(content?: Array, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts new file mode 100644 index 0000000000..c46e6ad0a1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts @@ -0,0 +1,8 @@ +import { ComponentsChannelsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class ComponentsChannels extends ComponentsChannelsElement {} + +export default ComponentsChannels; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsExternalDocumentation.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsExternalDocumentation.ts new file mode 100644 index 0000000000..bdc1e074ad --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsExternalDocumentation.ts @@ -0,0 +1,14 @@ +import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; +/** + * @public + */ +class ComponentsExternalDocumentation extends ObjectElement { + static primaryClass = 'components-external-documentation'; + + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ComponentsExternalDocumentation.primaryClass); + } +} + +export default ComponentsExternalDocumentation; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentOperations.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts similarity index 64% rename from packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentOperations.ts rename to packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts index 24f8e5fb03..29b3e58225 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentOperations.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts @@ -3,12 +3,12 @@ import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; * @public */ class ComponentOperations extends ArrayElement { - static primaryClass = 'component-operations-list'; + static primaryClass = 'components-operations'; constructor(content?: Array, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); - this.classes.push( ComponentOperations.primaryClass); + this.classes.push(ComponentOperations.primaryClass); } } -export default ComponentOperations; \ No newline at end of file +export default ComponentOperations; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplies.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplies.ts new file mode 100644 index 0000000000..960f756713 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplies.ts @@ -0,0 +1,14 @@ +import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; +/** + * @public + */ +class ComponentsReplies extends ObjectElement { + static primaryClass = 'components-replies'; + + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ComponentsReplies.primaryClass); + } +} + +export default ComponentsReplies; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplyAddresses.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplyAddresses.ts new file mode 100644 index 0000000000..1b9bf19550 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsReplyAddresses.ts @@ -0,0 +1,14 @@ +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; +/** + * @public + */ +class ComponentsReplyAddresses extends ObjectElement { + static primaryClass = 'components-reply-addresses'; + + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ComponentsReplyAddresses.primaryClass); + } +} + +export default ComponentsReplyAddresses; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts new file mode 100644 index 0000000000..b62e1ccb7b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts @@ -0,0 +1,14 @@ +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; +/** + * @public + */ +class ComponentsTags extends ObjectElement { + static primaryClass = 'components-tags'; + + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ComponentsTags.primaryClass); + } +} + +export default ComponentsTags; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraitSecurity.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraitSecurity.ts new file mode 100644 index 0000000000..4a0ae89e0c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationTraitSecurity.ts @@ -0,0 +1,8 @@ +import { OperationTraitSecurityElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class OperationTraitSecurity extends OperationTraitSecurityElement {} + +export default OperationTraitSecurity; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/SecuritySchemeScopes.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/SecuritySchemeScopes.ts new file mode 100644 index 0000000000..0682319880 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/SecuritySchemeScopes.ts @@ -0,0 +1,15 @@ +import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class SecuritySchemeScopes extends ArrayElement { + static primaryClass = 'security-scheme-scopes'; + + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(SecuritySchemeScopes.primaryClass); + } +} + +export default SecuritySchemeScopes; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ServerSecurity.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ServerSecurity.ts new file mode 100644 index 0000000000..63134f5473 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ServerSecurity.ts @@ -0,0 +1,8 @@ +import { ServerSecurityElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class ServerSecurity extends ServerSecurityElement {} + +export default ServerSecurity; diff --git a/packages/apidom-ns-asyncapi-3/src/index.ts b/packages/apidom-ns-asyncapi-3/src/index.ts index ef1acea475..fb98449a7e 100644 --- a/packages/apidom-ns-asyncapi-3/src/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/index.ts @@ -4,4 +4,147 @@ export type { Format } from './media-types.ts'; // eslint-disable-next-line no-restricted-exports export { default } from './namespace.ts'; -// Re-exports and placeholders for predicates/refractor can be added as implementation progresses. +export { isAsyncApiVersionElement } from './predicates.ts'; + +export { + /** + * AsyncApi 3.0.0 specification elements. + */ + AsyncApi3Element, + AsyncApiVersionElement, + ChannelBindingsElement, + ChannelElement, + ChannelsElement, + ComponentsElement, + ContactElement, + CorrelationIDElement, + DefaultContentTypeElement, + ExternalDocumentationElement, + IdentifierElement, + InfoElement, + LicenseElement, + MessageElement, + MessageBindingsElement, + MessageExampleElement, + MessageTraitElement, + MessagesElement, + MultiFormatSchemaElement, + OAuthFlowElement, + OAuthFlowsElement, + OperationElement, + OperationBindingsElement, + OperationReplyElement, + OperationReplyAddressElement, + OperationTraitElement, + OperationsElement, + ParameterElement, + ParametersElement, + ReferenceElement, + SchemaElement, + SecuritySchemeElement, + ServerElement, + ServerBindingsElement, + ServersElement, + ServerVariableElement, + TagElement, + TagsElement, + /** + * Binding elements. + */ + // AMQP 0-9-1 + AmqpChannelBindingElement, + AmqpMessageBindingElement, + AmqpOperationBindingElement, + AmqpServerBindingElement, + // AMQP 1.0 + Amqp1ChannelBindingElement, + Amqp1MessageBindingElement, + Amqp1OperationBindingElement, + Amqp1ServerBindingElement, + // Anypoint MQ + AnypointmqChannelBindingElement, + AnypointmqMessageBindingElement, + AnypointmqOperationBindingElement, + AnypointmqServerBindingElement, + // Google Cloud Pub/Sub + GooglepubsubChannelBindingElement, + GooglepubsubMessageBindingElement, + GooglepubsubOperationBindingElement, + GooglepubsubServerBindingElement, + + // HTTP + HttpChannelBindingElement, + HttpMessageBindingElement, + HttpOperationBindingElement, + HttpServerBindingElement, + // IBM MQ + IbmmqChannelBindingElement, + IbmmqMessageBindingElement, + IbmmqOperationBindingElement, + IbmmqServerBindingElement, + // JMS + JmsChannelBindingElement, + JmsMessageBindingElement, + JmsOperationBindingElement, + JmsServerBindingElement, + // Kafka + KafkaChannelBindingElement, + KafkaMessageBindingElement, + KafkaOperationBindingElement, + KafkaServerBindingElement, + // Mercure + MercureChannelBindingElement, + MercureMessageBindingElement, + MercureOperationBindingElement, + MercureServerBindingElement, + // MQTT + MqttChannelBindingElement, + MqttMessageBindingElement, + MqttOperationBindingElement, + MqttServerBindingElement, + // MQTT 5 + Mqtt5ChannelBindingElement, + Mqtt5MessageBindingElement, + Mqtt5OperationBindingElement, + Mqtt5ServerBindingElement, + // NATS + NatsChannelBindingElement, + NatsMessageBindingElement, + NatsOperationBindingElement, + NatsServerBindingElement, + // Pulsar + PulsarChannelBindingElement, + PulsarMessageBindingElement, + PulsarOperationBindingElement, + PulsarServerBindingElement, + // Redis + RedisChannelBindingElement, + RedisMessageBindingElement, + RedisOperationBindingElement, + RedisServerBindingElement, + // SNS + SnsChannelBindingElement, + SnsMessageBindingElement, + SnsOperationBindingElement, + SnsServerBindingElement, + // Solace + SolaceChannelBindingElement, + SolaceMessageBindingElement, + SolaceOperationBindingElement, + SolaceServerBindingElement, + // SQS + SqsChannelBindingElement, + SqsMessageBindingElement, + SqsOperationBindingElement, + SqsServerBindingElement, + // STOMP + StompChannelBindingElement, + StompMessageBindingElement, + StompOperationBindingElement, + StompServerBindingElement, + // WebSocket + WebSocketChannelBindingElement, + WebSocketMessageBindingElement, + WebSocketOperationBindingElement, + WebSocketServerBindingElement, +} from './refractor/registration.ts' \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/media-types.ts b/packages/apidom-ns-asyncapi-3/src/media-types.ts index af513ad369..a2ced03f80 100644 --- a/packages/apidom-ns-asyncapi-3/src/media-types.ts +++ b/packages/apidom-ns-asyncapi-3/src/media-types.ts @@ -12,8 +12,8 @@ export class AsyncAPIMediaTypes extends MediaTypes { findBy(version = '3.0.0', format: Format = 'generic') { const search = format === 'generic' - ? `vnd.asyncapi;version=${version}` - : `vnd.asyncapi+${format};version=${version}`; + ? `vnd.aai.asyncapi;version=${version}` + : `vnd.aai.asyncapi+${format};version=${version}`; const found = this.find((mediaType) => mediaType.includes(search)); return found || this.unknownMediaType; @@ -25,19 +25,12 @@ export class AsyncAPIMediaTypes extends MediaTypes { } const mediaTypes = new AsyncAPIMediaTypes( - // Official AsyncAPI v3 vendor media types - 'application/vnd.asyncapi;version=3.0.0', - 'application/vnd.asyncapi+json;version=3.0.0', - 'application/vnd.asyncapi+yaml;version=3.0.0', - 'application/vnd.asyncapi;version=3.0.1', - 'application/vnd.asyncapi+json;version=3.0.1', - 'application/vnd.asyncapi+yaml;version=3.0.1', 'application/vnd.aai.asyncapi;version=3.0.0', 'application/vnd.aai.asyncapi+json;version=3.0.0', 'application/vnd.aai.asyncapi+yaml;version=3.0.0', 'application/vnd.aai.asyncapi;version=3.0.1', 'application/vnd.aai.asyncapi+json;version=3.0.1', - 'application/vnd.aai.asyncapi+yaml;version=3.0.1' + 'application/vnd.aai.asyncapi+yaml;version=3.0.1', ); -export default mediaTypes; +export default mediaTypes; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/predicates.ts b/packages/apidom-ns-asyncapi-3/src/predicates.ts index 206a582117..f645c2a322 100644 --- a/packages/apidom-ns-asyncapi-3/src/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/predicates.ts @@ -1,13 +1,266 @@ import { createPredicate, isElement } from '@swagger-api/apidom-core'; import MultiFormatSchemaElement from './elements/MultiFormatSchema.ts'; +import AsyncApiVersionElement from './elements/AsyncApiVersion.ts'; +import ChannelBindingsElement from './elements/ChannelBindings.ts'; +import ChannelElement from './elements/Channel.ts'; +import ChannelsElement from './elements/Channels.ts'; +import ComponentsElement from './elements/Components.ts'; +import ContactElement from './elements/Contact.ts'; +import IdentifierElement from './elements/Identifier.ts'; +import InfoElement from './elements/Info.ts'; +import LicenseElement from './elements/License.ts'; +import OperationElement from './elements/Operation.ts'; +import ParametersElement from './elements/Parameters.ts'; +import ParameterElement from './elements/Parameter.ts'; +import ReferenceElement from './elements/Reference.ts'; +import SchemaElement from './elements/Schema.ts'; +import ServerElement from './elements/Server.ts'; +import ServersElement from './elements/Server.ts'; +import ServerBindingsElement from './elements/ServerBindings.ts'; +import ServerVariableElement from './elements/ServerVariable.ts'; +/** + * @public + */ export const isAsyncApi3Element = (node: unknown) => isElement(node) && node.element === 'asyncApi3'; -export const isInfoElement = (node: unknown) => isElement(node) && node.element === 'info'; -export const isChannelsElement = (node: unknown) => isElement(node) && node.element === 'channels'; -export const isComponentsElement = (node: unknown) => - isElement(node) && node.element === 'components'; -export const isMessageElement = (node: unknown) => isElement(node) && node.element === 'message'; + +/** + * @public + */ +export const isAsyncApiVersionElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is AsyncApiVersionElement => + element instanceof AsyncApiVersionElement || + (hasBasicElementProps(element) && + isElementType('asyncApiVersion', element) && + primitiveEq('string', element)); + }, +); +/** + * @public + */ +export const isChannelBindingsElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ChannelBindingsElement => + element instanceof ChannelBindingsElement || + (hasBasicElementProps(element) && + isElementType('channelBindings', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isChannelElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ChannelElement => + element instanceof ChannelElement || + (hasBasicElementProps(element) && + isElementType('channel', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isChannelsElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ChannelsElement => + element instanceof ChannelsElement || + (hasBasicElementProps(element) && + isElementType('channels', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isComponentsElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ComponentsElement => + element instanceof ComponentsElement || + (hasBasicElementProps(element) && + isElementType('components', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isContactElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ContactElement => + element instanceof ContactElement || + (hasBasicElementProps(element) && + isElementType('contact', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isIdentifierElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is IdentifierElement => + element instanceof IdentifierElement || + (hasBasicElementProps(element) && + isElementType('identifier', element) && + primitiveEq('string', element)); + }, +); + +/** + * @public + */ +export const isInfoElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is InfoElement => + element instanceof InfoElement || + (hasBasicElementProps(element) && + isElementType('info', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isLicenseElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is LicenseElement => + element instanceof LicenseElement || + (hasBasicElementProps(element) && + isElementType('license', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isOperationElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is OperationElement => + element instanceof OperationElement || + (hasBasicElementProps(element) && + isElementType('operation', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isParameterElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ParameterElement => + element instanceof ParameterElement || + (hasBasicElementProps(element) && + isElementType('parameter', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isParametersElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ParametersElement => + element instanceof ParametersElement || + (hasBasicElementProps(element) && + isElementType('parameters', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isReferenceElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ReferenceElement => + element instanceof ReferenceElement || + (hasBasicElementProps(element) && + isElementType('reference', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isSchemaElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is SchemaElement => + element instanceof SchemaElement || + (hasBasicElementProps(element) && + isElementType('schema', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isServerElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ServerElement => + element instanceof ServerElement || + (hasBasicElementProps(element) && + isElementType('server', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isServerBindingsElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ServerBindingsElement => + element instanceof ServerBindingsElement || + (hasBasicElementProps(element) && + isElementType('serverBindings', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isServersElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ServersElement => + element instanceof ServersElement || + (hasBasicElementProps(element) && + isElementType('servers', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ +export const isServerVariableElement = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq }) => { + return (element: unknown): element is ServerVariableElement => + element instanceof ServerVariableElement || + (hasBasicElementProps(element) && + isElementType('serverVariable', element) && + primitiveEq('object', element)); + }, +); + +/** + * @public + */ export const isMultiFormatSchemaElement = createPredicate( ({ hasBasicElementProps, isElementType, primitiveEq }) => { return (element: unknown): element is MultiFormatSchemaElement => diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/index.ts index 565678aa17..2802254499 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/index.ts @@ -1,25 +1,46 @@ -import { path } from 'ramda'; import { Element, + visit, dereference, refract as baseRefract, + dispatchRefractorPlugins, } from '@swagger-api/apidom-core'; +import { path } from 'ramda'; +import type VisitorClass from './visitors/Visitor.ts'; import specification from './specification.ts'; +import { keyMap, getNodeType } from '../traversal/visitor.ts'; +import createToolbox from './toolbox.ts'; -const refract = (value: unknown, { specPath = ['visitors','document','objects','AsyncApi','$visitor'], plugins = [], specificationObj = specification } = {}): T => { +const refract = ( + value: unknown, + { specPath = ['visitors', 'document', 'objects', 'AsyncApi', '$visitor'], plugins = [] } = {}, +): T => { const element = baseRefract(value); - const resolvedSpec = dereference(specificationObj); + const resolvedSpec = dereference(specification); - const RootVisitorClass = path(specPath, resolvedSpec) as any; + /** + * This is where generic ApiDOM becomes semantic (namespace applied). + * We don't allow consumers to hook into this translation. + * Though we allow consumers to define their onw plugins on already transformed ApiDOM. + */ + const RootVisitorClass = path(specPath, resolvedSpec) as typeof VisitorClass; const rootVisitor = new RootVisitorClass({ specObj: resolvedSpec }); - // Our visitor implementations currently expect direct invocation on ApiDOM elements - // (they manually call child visitors). Call enter() directly to populate rootVisitor.element. - rootVisitor.enter(element); + visit(element, rootVisitor); - // Return the populated element directly (skip plugin dispatch for now). - return rootVisitor.element as unknown as T; + /** + * Running plugins visitors means extra single traversal === performance hit. + */ + return dispatchRefractorPlugins(rootVisitor.element, plugins, { + toolboxCreator: createToolbox, + visitorOptions: { keyMap, nodeTypeGetter: getNodeType }, + }) as T; }; -export default refract; +export const createRefractor = + (specPath: string[]) => + (value: unknown, options = {}) => + refract(value, { ...options, specPath }); + +export default refract; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts new file mode 100644 index 0000000000..a89de67b4c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts @@ -0,0 +1,1236 @@ +import { defaultTo } from 'ramda'; +import { + ArrayElement, + ObjectElement, + StringElement, + assignSourceMap, + cloneDeep, + includesClasses, + isArrayElement, + isElement, + isMemberElement, + isStringElement, + toValue, +} from '@swagger-api/apidom-core'; + +import mediaTypes from '../../media-types.ts'; +import AsyncApiVersionElement from '../../elements/AsyncApiVersion.ts'; +import IdentifierElement from '../../elements/Identifier.ts'; +import InfoElement from '../../elements/Info.ts'; +import ServersElement from '../../elements/Servers.ts'; +import DefaultContentTypeElement from '../../elements/DefaultContentType.ts'; +import ChannelsElement from '../../elements/Channels.ts'; +import ChannelAddressExpressionsElement from '../../elements/ChannelAddressExpressions.ts'; +import ComponentsElement from '../../elements/Components.ts'; +import TagsElement from '../../elements/Tags.ts'; +import ExternalDocumentationElement from '../../elements/ExternalDocumentation.ts'; +import ContactElement from '../../elements/Contact.ts'; +import LicenseElement from '../../elements/License.ts'; +import ServerElement from '../../elements/Server.ts'; +import ServerVariableElement from '../../elements/ServerVariable.ts'; +import ChannelElement from '../../elements/Channel.ts'; +import SchemaElement from '../../elements/Schema.ts'; +import MessageElement from '../../elements/Message.ts'; +import MessagesElement from '../../elements/Messages.ts'; +import SecuritySchemeElement from '../../elements/SecurityScheme.ts'; +import ParameterElement from '../../elements/Parameter.ts'; +import ParametersElement from '../../elements/Parameters.ts'; +import CorrelationIDElement from '../../elements/CorrelationID.ts'; +import OperationTraitElement from '../../elements/OperationTrait.ts'; +import MessageTraitElement from '../../elements/MessageTrait.ts'; +import ServerBindingsElement from '../../elements/ServerBindings.ts'; +import ChannelBindingsElement from '../../elements/ChannelBindings.ts'; +import OperationBindingsElement from '../../elements/OperationBindings.ts'; +import MessageBindingsElement from '../../elements/MessageBindings.ts'; +import OAuthFlowsElement from '../../elements/OauthFlows.ts'; +import OAuthFlowElement from '../../elements/OauthFlow.ts'; +import OperationElement from '../../elements/Operation.ts'; +import OperationReplyElement from '../../elements/OperationReply.ts'; +import OperationReplyAddressElement from '../../elements/OperationReplyAddress.ts'; +import OperationsElement from '../../elements/Operations.ts'; +import TagElement from '../../elements/Tag.ts'; +import MessageExampleElement from '../../elements/MessageExample.ts'; +import ReferenceElement from '../../elements/Reference.ts'; + +// binding elements +import AmqpChannelBindingElement from '../../elements/bindings/amqp/AmqpChannelBinding.ts'; +import AmqpMessageBindingElement from '../../elements/bindings/amqp/AmqpMessageBinding.ts'; +import AmqpOperationBindingElement from '../../elements/bindings/amqp/AmqpOperationBinding.ts'; +import AmqpServerBindingElement from '../../elements/bindings/amqp/AmqpServerBinding.ts'; +import Amqp1ChannelBindingElement from '../../elements/bindings/amqp1/Amqp1ChannelBinding.ts'; +import Amqp1MessageBindingElement from '../../elements/bindings/amqp1/Amqp1MessageBinding.ts'; +import Amqp1OperationBindingElement from '../../elements/bindings/amqp1/Amqp1OperationBinding.ts'; +import Amqp1ServerBindingElement from '../../elements/bindings/amqp1/Amqp1ServerBinding.ts'; +import AnypointmqChannelBindingElement from '../../elements/bindings/anypointmq/AnypointmqChannelBinding.ts'; +import AnypointmqMessageBindingElement from '../../elements/bindings/anypointmq/AnypointmqMessageBinding.ts'; +import AnypointmqOperationBindingElement from '../../elements/bindings/anypointmq/AnypointmqOperationBinding.ts'; +import AnypointmqServerBindingElement from '../../elements/bindings/anypointmq/AnypointmqServerBinding.ts'; +import GooglepubsubChannelBindingElement from '../../elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts'; +import GooglepubsubMessageBindingElement from '../../elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts'; +import GooglepubsubOperationBindingElement from '../../elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts'; +import GooglepubsubServerBindingElement from '../../elements/bindings/googlepubsub/GooglepubsubServerBinding.ts'; +import HttpChannelBindingElement from '../../elements/bindings/http/HttpChannelBinding.ts'; +import HttpMessageBindingElement from '../../elements/bindings/http/HttpMessageBinding.ts'; +import HttpOperationBindingElement from '../../elements/bindings/http/HttpOperationBinding.ts'; +import HttpServerBindingElement from '../../elements/bindings/http/HttpServerBinding.ts'; +import IbmmqChannelBindingElement from '../../elements/bindings/ibmmq/IbmmqChannelBinding.ts'; +import IbmmqMessageBindingElement from '../../elements/bindings/ibmmq/IbmmqMessageBinding.ts'; +import IbmmqOperationBindingElement from '../../elements/bindings/ibmmq/IbmmqOperationBinding.ts'; +import IbmmqServerBindingElement from '../../elements/bindings/ibmmq/IbmmqServerBinding.ts'; +import JmsChannelBindingElement from '../../elements/bindings/jms/JmsChannelBinding.ts'; +import JmsMessageBindingElement from '../../elements/bindings/jms/JmsMessageBinding.ts'; +import JmsOperationBindingElement from '../../elements/bindings/jms/JmsOperationBinding.ts'; +import JmsServerBindingElement from '../../elements/bindings/jms/JmsServerBinding.ts'; +import KafkaChannelBindingElement from '../../elements/bindings/kafka/KafkaChannelBinding.ts'; +import KafkaMessageBindingElement from '../../elements/bindings/kafka/KafkaMessageBinding.ts'; +import KafkaOperationBindingElement from '../../elements/bindings/kafka/KafkaOperationBinding.ts'; +import KafkaServerBindingElement from '../../elements/bindings/kafka/KafkaServerBinding.ts'; +import MercureChannelBindingElement from '../../elements/bindings/mercure/MercureChannelBinding.ts'; +import MercureMessageBindingElement from '../../elements/bindings/mercure/MercureMessageBinding.ts'; +import MercureOperationBindingElement from '../../elements/bindings/mercure/MercureOperationBinding.ts'; +import MercureServerBindingElement from '../../elements/bindings/mercure/MercureServerBinding.ts'; +import MqttChannelBindingElement from '../../elements/bindings/mqtt/MqttChannelBinding.ts'; +import MqttMessageBindingElement from '../../elements/bindings/mqtt/MqttMessageBinding.ts'; +import MqttOperationBindingElement from '../../elements/bindings/mqtt/MqttOperationBinding.ts'; +import MqttServerBindingElement from '../../elements/bindings/mqtt/MqttServerBinding.ts'; +import Mqtt5ChannelBindingElement from '../../elements/bindings/mqtt5/Mqtt5ChannelBinding.ts'; +import Mqtt5MessageBindingElement from '../../elements/bindings/mqtt5/Mqtt5MessageBinding.ts'; +import Mqtt5OperationBindingElement from '../../elements/bindings/mqtt5/Mqtt5OperationBinding.ts'; +import Mqtt5ServerBindingElement from '../../elements/bindings/mqtt5/Mqtt5ServerBinding.ts'; +import NatsChannelBindingElement from '../../elements/bindings/nats/NatsChannelBinding.ts'; +import NatsMessageBindingElement from '../../elements/bindings/nats/NatsMessageBinding.ts'; +import NatsOperationBindingElement from '../../elements/bindings/nats/NatsOperationBinding.ts'; +import NatsServerBindingElement from '../../elements/bindings/nats/NatsServerBinding.ts'; +import PulsarChannelBindingElement from '../../elements/bindings/pulsar/PulsarChannelBinding.ts'; +import PulsarMessageBindingElement from '../../elements/bindings/pulsar/PulsarMessageBinding.ts'; +import PulsarOperationBindingElement from '../../elements/bindings/pulsar/PulsarOperationBinding.ts'; +import PulsarServerBindingElement from '../../elements/bindings/pulsar/PulsarServerBinding.ts'; +import RedisChannelBindingElement from '../../elements/bindings/redis/RedisChannelBinding.ts'; +import RedisMessageBindingElement from '../../elements/bindings/redis/RedisMessageBinding.ts'; +import RedisOperationBindingElement from '../../elements/bindings/redis/RedisOperationBinding.ts'; +import RedisServerBindingElement from '../../elements/bindings/redis/RedisServerBinding.ts'; +import SnsChannelBindingElement from '../../elements/bindings/sns/SnsChannelBinding.ts'; +import SnsMessageBindingElement from '../../elements/bindings/sns/SnsMessageBinding.ts'; +import SnsOperationBindingElement from '../../elements/bindings/sns/SnsOperationBinding.ts'; +import SnsServerBindingElement from '../../elements/bindings/sns/SnsServerBinding.ts'; +import SolaceChannelBindingElement from '../../elements/bindings/solace/SolaceChannelBinding.ts'; +import SolaceMessageBindingElement from '../../elements/bindings/solace/SolaceMessageBinding.ts'; +import SolaceOperationBindingElement from '../../elements/bindings/solace/SolaceOperationBinding.ts'; +import SolaceServerBindingElement from '../../elements/bindings/solace/SolaceServerBinding.ts'; +import SqsChannelBindingElement from '../../elements/bindings/sqs/SqsChannelBinding.ts'; +import SqsMessageBindingElement from '../../elements/bindings/sqs/SqsMessageBinding.ts'; +import SqsOperationBindingElement from '../../elements/bindings/sqs/SqsOperationBinding.ts'; +import SqsServerBindingElement from '../../elements/bindings/sqs/SqsServerBinding.ts'; +import StompChannelBindingElement from '../../elements/bindings/stomp/StompChannelBinding.ts'; +import StompMessageBindingElement from '../../elements/bindings/stomp/StompMessageBinding.ts'; +import StompOperationBindingElement from '../../elements/bindings/stomp/StompOperationBinding.ts'; +import StompServerBindingElement from '../../elements/bindings/stomp/StompServerBinding.ts'; +import WebSocketChannelBindingElement from '../../elements/bindings/ws/WebSocketChannelBinding.ts'; +import WebSocketMessageBindingElement from '../../elements/bindings/ws/WebSocketMessageBinding.ts'; +import WebSocketOperationBindingElement from '../../elements/bindings/ws/WebSocketOperationBinding.ts'; +import WebSocketServerBindingElement from '../../elements/bindings/ws/WebSocketServerBinding.ts'; + +// nces / helper collections +import ComponentsOperationsElement from '../../elements/nces/ComponentsOperations.ts'; +import ChannelServersElement from '../../elements/nces/ChannelServers.ts'; +import ComponentsSchemasElement from '../../elements/nces/ComponentsSchemas.ts'; +import MessageExamplesElement from '../../elements/nces/MessageExamples.ts'; +import MessageTraitsElement from '../../elements/nces/MessageTraits.ts'; +import OperationMessageElement from '../../elements/nces/OperationMessage.ts'; +import OperationReplyMessageElement from '../../elements/nces/OperationReplyMessage.ts'; +import OperationSecurityElement from '../../elements/nces/OperationSecurity.ts'; +import OperationTraitsElement from '../../elements/nces/OperationTraits.ts'; +import OperationTraitSecurityElement from '../../elements/nces/OperationTraitSecurity.ts'; +import SecuritySchemeScopesElement from '../../elements/nces/SecuritySchemeScopes.ts'; + +// borrowed AsyncAPI 2 NCEs +import { + ComponentsChannelBindingsElement, + ComponentsCorrelationIDsElement, + ComponentsMessageBindingsElement, + ComponentsMessageTraitsElement, + ComponentsMessagesElement, + ComponentsOperationBindingsElement, + ComponentsOperationTraitsElement, + ComponentsParametersElement, + ComponentsSecuritySchemesElement, + ComponentsServerBindingsElement, + ComponentsServerVariablesElement, + ComponentsServersElement, + MessageTraitExamplesElement, + OperationMessageMapElement, + SecurityRequirementElement, + ServerSecurityElement, + ServerVariablesElement +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import { getNodeType } from '../../traversal/visitor.ts'; +/** + * This plugin targets YAML 1.2 empty nodes. When a mapping value is omitted, + * it substitutes the most suitable semantic AsyncAPI 3 element. + * + * https://yaml.org/spec/1.2.2/#72-empty-nodes + * + * @example + * + * ```yaml + * asyncapi: 3.0.0 + * operations: + * sendMessage: + * ``` + * Refracting result without this plugin: + * + * (AsyncApi3Element + * (MemberElement + * (StringElement) + * (OperationsElement + * (MemberElement + * (StringElement) + * (StringElement)))) + * + * Refracting result with this plugin: + * + * (AsyncApi3Element + * (MemberElement + * (StringElement) + * (OperationsElement + * (MemberElement + * (StringElement) + * (OperationElement)))) + */ + +const isEmptyElement = (element: unknown): element is StringElement => + isStringElement(element) && includesClasses(['yaml-e-node', 'yaml-e-scalar'], element); + +const schema: Record = { + AsyncApi3Element: { + asyncapi(...args: any[]) { + return new AsyncApiVersionElement(...args); + }, + identifier(...args: any[]) { + return new IdentifierElement(...args); + }, + info(...args: any[]) { + return new InfoElement(...args); + }, + servers(...args: any[]) { + return new ServersElement(...args); + }, + defaultContentType(...args: any[]) { + return new DefaultContentTypeElement(...args); + }, + channels(...args: any[]) { + return new ChannelsElement(...args); + }, + components(...args: any[]) { + return new ComponentsElement(...args); + }, + operations(...args: any[]) { + return new OperationsElement(...args); + }, + }, + + InfoElement: { + contact(...args: any[]) { + return new ContactElement(...args); + }, + license(...args: any[]) { + return new LicenseElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + ServersElement: { + '[key: *]': function key(...args: any[]) { + return new ServerElement(...args); + }, + }, + + ServerElement: { + variables(...args: any[]) { + return new ServerVariablesElement(...args); + }, + security(...args: any[]) { + return new ServerSecurityElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: any[]) { + return new ServerBindingsElement(...args); + }, + }, + + ServerVariableElement: { + enum(...args: any[]) { + return new ArrayElement(...args); + }, + examples(...args: any[]) { + return new ArrayElement(...args); + }, + }, + + ChannelsElement: { + '[key: *]': function key(...args: any[]) { + return new ChannelElement(...args); + }, + }, + + ChannelElement: { + servers(...args: any[]) { + return new ChannelServersElement(...args); + }, + parameters(...args: any[]) { + return new ParametersElement(...args); + }, + messages(...args: any[]) { + return new MessagesElement(...args); + }, + bindings(...args: any[]) { + return new ChannelBindingsElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + ChannelAddressExpressionsElement: { + '[key: *]': function key(...args: any[]) { + return new ChannelAddressExpressionsElement(...args); + }, + }, + + MessagesElement: { + '[key: *]': function key(...args: any[]) { + return new MessageElement(...args); + }, + }, + + OperationsElement: { + '[key: *]': function key(...args: any[]) { + return new OperationElement(...args); + }, + }, + + OperationElement: { + channel(...args: any[]) { + return new ReferenceElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: any[]) { + return new OperationBindingsElement(...args); + }, + traits(...args: any[]) { + return new OperationTraitsElement(...args); + }, + security(...args: any[]) { + return new OperationSecurityElement(...args); + }, + messages(...args: any[]) { + return new OperationMessageElement(...args); + }, + reply(...args: any[]) { + return new OperationReplyElement(...args); + }, + }, + + OperationTraitElement: { + security(...args: any[]) { + return new OperationTraitSecurityElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: any[]) { + return new OperationBindingsElement(...args); + }, + }, + + OperationReplyElement: { + address(...args: any[]) { + return new OperationReplyAddressElement(...args); + }, + channel(...args: any[]) { + return new ReferenceElement(...args); + }, + message(...args: any[]) { + return new OperationReplyMessageElement(...args); + }, + }, + + ParametersElement: { + '[key: *]': function key(...args: any[]) { + return new ParameterElement(...args); + }, + }, + + ParameterElement: { + enum(...args: any[]) { + return new ArrayElement(...args); + }, + examples(...args: any[]) { + return new ArrayElement(...args); + }, + }, + + ServerBindingsElement: { + http(...args: any[]) { + return new HttpServerBindingElement(...args); + }, + ws(...args: any[]) { + return new WebSocketServerBindingElement(...args); + }, + kafka(...args: any[]) { + return new KafkaServerBindingElement(...args); + }, + anypointmq(...args: any[]) { + return new AnypointmqServerBindingElement(...args); + }, + amqp(...args: any[]) { + return new AmqpServerBindingElement(...args); + }, + amqp1(...args: any[]) { + return new Amqp1ServerBindingElement(...args); + }, + mqtt(...args: any[]) { + return new MqttServerBindingElement(...args); + }, + mqtt5(...args: any[]) { + return new Mqtt5ServerBindingElement(...args); + }, + nats(...args: any[]) { + return new NatsServerBindingElement(...args); + }, + jms(...args: any[]) { + return new JmsServerBindingElement(...args); + }, + sns(...args: any[]) { + return new SnsServerBindingElement(...args); + }, + solace(...args: any[]) { + return new SolaceServerBindingElement(...args); + }, + sqs(...args: any[]) { + return new SqsServerBindingElement(...args); + }, + stomp(...args: any[]) { + return new StompServerBindingElement(...args); + }, + redis(...args: any[]) { + return new RedisServerBindingElement(...args); + }, + mercure(...args: any[]) { + return new MercureServerBindingElement(...args); + }, + ibmmq(...args: any[]) { + return new IbmmqServerBindingElement(...args); + }, + googlepubsub(...args: any[]) { + return new GooglepubsubServerBindingElement(...args); + }, + pulsar(...args: any[]) { + return new PulsarServerBindingElement(...args); + }, + }, + + ChannelBindingsElement: { + http(...args: any[]) { + return new HttpChannelBindingElement(...args); + }, + ws(...args: any[]) { + return new WebSocketChannelBindingElement(...args); + }, + kafka(...args: any[]) { + return new KafkaChannelBindingElement(...args); + }, + anypointmq(...args: any[]) { + return new AnypointmqChannelBindingElement(...args); + }, + amqp(...args: any[]) { + return new AmqpChannelBindingElement(...args); + }, + amqp1(...args: any[]) { + return new Amqp1ChannelBindingElement(...args); + }, + mqtt(...args: any[]) { + return new MqttChannelBindingElement(...args); + }, + mqtt5(...args: any[]) { + return new Mqtt5ChannelBindingElement(...args); + }, + nats(...args: any[]) { + return new NatsChannelBindingElement(...args); + }, + jms(...args: any[]) { + return new JmsChannelBindingElement(...args); + }, + sns(...args: any[]) { + return new SnsChannelBindingElement(...args); + }, + solace(...args: any[]) { + return new SolaceChannelBindingElement(...args); + }, + sqs(...args: any[]) { + return new SqsChannelBindingElement(...args); + }, + stomp(...args: any[]) { + return new StompChannelBindingElement(...args); + }, + redis(...args: any[]) { + return new RedisChannelBindingElement(...args); + }, + mercure(...args: any[]) { + return new MercureChannelBindingElement(...args); + }, + ibmmq(...args: any[]) { + return new IbmmqChannelBindingElement(...args); + }, + googlepubsub(...args: any[]) { + return new GooglepubsubChannelBindingElement(...args); + }, + pulsar(...args: any[]) { + return new PulsarChannelBindingElement(...args); + }, + }, + + + OperationBindingsElement: { + http(...args: any[]) { + return new HttpOperationBindingElement(...args); + }, + ws(...args: any[]) { + return new WebSocketOperationBindingElement(...args); + }, + kafka(...args: any[]) { + return new KafkaOperationBindingElement(...args); + }, + anypointmq(...args: any[]) { + return new AnypointmqOperationBindingElement(...args); + }, + amqp(...args: any[]) { + return new AmqpOperationBindingElement(...args); + }, + amqp1(...args: any[]) { + return new Amqp1OperationBindingElement(...args); + }, + mqtt(...args: any[]) { + return new MqttOperationBindingElement(...args); + }, + mqtt5(...args: any[]) { + return new Mqtt5OperationBindingElement(...args); + }, + nats(...args: any[]) { + return new NatsOperationBindingElement(...args); + }, + jms(...args: any[]) { + return new JmsOperationBindingElement(...args); + }, + sns(...args: any[]) { + return new SnsOperationBindingElement(...args); + }, + solace(...args: any[]) { + return new SolaceOperationBindingElement(...args); + }, + sqs(...args: any[]) { + return new SqsOperationBindingElement(...args); + }, + stomp(...args: any[]) { + return new StompOperationBindingElement(...args); + }, + redis(...args: any[]) { + return new RedisOperationBindingElement(...args); + }, + mercure(...args: any[]) { + return new MercureOperationBindingElement(...args); + }, + googlepubsub(...args: any[]) { + return new GooglepubsubOperationBindingElement(...args); + }, + ibmmq(...args: any[]) { + return new IbmmqOperationBindingElement(...args); + }, + pulsar(...args: any[]) { + return new PulsarOperationBindingElement(...args); + }, + }, + + MessageBindingsElement: { + http(...args: any[]) { + return new HttpMessageBindingElement(...args); + }, + ws(...args: any[]) { + return new WebSocketMessageBindingElement(...args); + }, + kafka(...args: any[]) { + return new KafkaMessageBindingElement(...args); + }, + anypointmq(...args: any[]) { + return new AnypointmqMessageBindingElement(...args); + }, + amqp(...args: any[]) { + return new AmqpMessageBindingElement(...args); + }, + amqp1(...args: any[]) { + return new Amqp1MessageBindingElement(...args); + }, + mqtt(...args: any[]) { + return new MqttMessageBindingElement(...args); + }, + mqtt5(...args: any[]) { + return new Mqtt5MessageBindingElement(...args); + }, + nats(...args: any[]) { + return new NatsMessageBindingElement(...args); + }, + jms(...args: any[]) { + return new JmsMessageBindingElement(...args); + }, + sns(...args: any[]) { + return new SnsMessageBindingElement(...args); + }, + solace(...args: any[]) { + return new SolaceMessageBindingElement(...args); + }, + sqs(...args: any[]) { + return new SqsMessageBindingElement(...args); + }, + stomp(...args: any[]) { + return new StompMessageBindingElement(...args); + }, + redis(...args: any[]) { + return new RedisMessageBindingElement(...args); + }, + mercure(...args: any[]) { + return new MercureMessageBindingElement(...args); + }, + ibmmq(...args: any[]) { + return new IbmmqMessageBindingElement(...args); + }, + googlepubsub(...args: any[]) { + return new GooglepubsubMessageBindingElement(...args); + }, + pulsar(...args: any[]) { + return new PulsarMessageBindingElement(...args); + }, + }, + + MessageElement: { + headers(...args: any[]) { + return new SchemaElement(...args); + }, + correlationId(...args: any[]) { + return new CorrelationIDElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: any[]) { + return new MessageBindingsElement(...args); + }, + examples(...args: any[]) { + return new MessageExamplesElement(...args); + }, + traits(...args: any[]) { + return new MessageTraitsElement(...args); + }, + payload(...args: any[]) { + const { context: messageElement } = this as { context: MessageElement }; + const schemaFormat = defaultTo(mediaTypes.latest(), toValue(messageElement.get('schemaFormat'))); + const multiFormatSchema = defaultTo(mediaTypes.latest(), toValue(messageElement.get('multiFormatSchema'))); + if (mediaTypes.includes(schemaFormat)) { + return new SchemaElement(...args); + } + + if (mediaTypes.includes(multiFormatSchema)) { + return new SchemaElement(...args); + } + + return new ObjectElement(...args); + }, + }, + + MessageTraitElement: { + headers(...args: any[]) { + return new SchemaElement(...args); + }, + correlationId(...args: any[]) { + return new CorrelationIDElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: any[]) { + return new MessageBindingsElement(...args); + }, + examples(...args: any[]) { + return new MessageExamplesElement(...args); + }, + }, + + MessageExampleElement: { + headers(...args: any[]) { + return new ObjectElement(...args); + }, + }, + + TagsElement: { + '<*>': function asterisk(...args: any[]) { + return new TagElement(...args); + }, + }, + + TagElement: { + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + ComponentsElement: { + schemas(...args: any[]) { + return new ComponentsSchemasElement(...args); + }, + servers(...args: any[]) { + return new ComponentsServersElement(...args); + }, + serverVariables(...args: any[]) { + return new ComponentsServerVariablesElement(...args); + }, + messages(...args: any[]) { + return new ComponentsMessagesElement(...args); + }, + securitySchemes(...args: any[]) { + return new ComponentsSecuritySchemesElement(...args); + }, + parameters(...args: any[]) { + return new ComponentsParametersElement(...args); + }, + correlationIds(...args: any[]) { + return new ComponentsCorrelationIDsElement(...args); + }, + operationTraits(...args: any[]) { + return new ComponentsOperationTraitsElement(...args); + }, + messageTraits(...args: any[]) { + return new ComponentsMessageTraitsElement(...args); + }, + serverBindings(...args: any[]) { + return new ComponentsServerBindingsElement(...args); + }, + channelBindings(...args: any[]) { + return new ComponentsChannelBindingsElement(...args); + }, + operationBindings(...args: any[]) { + return new ComponentsOperationBindingsElement(...args); + }, + messageBindings(...args: any[]) { + return new ComponentsMessageBindingsElement(...args); + }, + operations(...args: any[]) { + return new ComponentsOperationsElement(...args); + }, + replies(...args: any[]) { + return new OperationReplyElement(...args); + }, + replyAddresses(...args: any[]) { + return new OperationReplyAddressElement(...args); + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + tags(...args: any[]) { + return new TagsElement(...args); + }, + }, + + SchemaElement: { + allOf(...args: any[]) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-allOf'); + return element; + }, + anyOf(...args: any[]) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-anyOf'); + return element; + }, + oneOf(...args: any[]) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-oneOf'); + return element; + }, + not(...args: any[]) { + return new SchemaElement(...args); + }, + if(...args: any[]) { + return new SchemaElement(...args); + }, + then(...args: any[]) { + return new SchemaElement(...args); + }, + else(...args: any[]) { + return new SchemaElement(...args); + }, + enum(...args: any[]) { + return new ArrayElement(...args); + }, + items(...args: any[]) { + return new SchemaElement(...args); + }, + additionalItems(...args: any[]) { + return new SchemaElement(...args); + }, + contains(...args: any[]) { + return new SchemaElement(...args); + }, + required(...args: any[]) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-required'); + return element; + }, + properties(...args: any[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-properties'); + return element; + }, + patternProperties(...args: any[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-patternProperties'); + return element; + }, + additionalProperties(...args: any[]) { + return new SchemaElement(...args); + }, + dependencies(...args: any[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-dependencies'); + return element; + }, + propertyNames(...args: any[]) { + return new SchemaElement(...args); + }, + examples(...args: any[]) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-examples'); + return element; + }, + definitions(...args: any[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-definitions'); + return element; + }, + externalDocs(...args: any[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + + SecuritySchemeElement: { + flows(...args: any[]) { + return new OAuthFlowsElement(...args); + }, + scopes(...args: any[]) { + return new ArrayElement(...args); + }, + }, + + OAuthFlowsElement: { + implicit(...args: any[]) { + return new OAuthFlowElement(...args); + }, + password(...args: any[]) { + return new OAuthFlowElement(...args); + }, + clientCredentials(...args: any[]) { + return new OAuthFlowElement(...args); + }, + authorizationCode(...args: any[]) { + return new OAuthFlowElement(...args); + }, + }, + + OAuthFlowElement: { + availableScopes(...args: any[]) { + return new SecuritySchemeScopesElement(...args); + }, + }, + + HttpOperationBindingElement: { + query(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + HttpMessageBindingElement: { + headers(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + WebSocketChannelBindingElement: { + query(...args: any[]) { + return new SchemaElement(...args); + }, + headers(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + KafkaOperationBindingElement: { + groupId(...args: any[]) { + return new SchemaElement(...args); + }, + clientId(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + KafkaMessageBindingElement: { + key(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + AnypointmqMessageBindingElement: { + headers(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + AmqpChannelBindingElement: { + exchange(...args: any[]) { + return new ObjectElement(...args); + }, + queue(...args: any[]) { + return new ObjectElement(...args); + }, + }, + + AmqpOperationBindingElement: { + cc(...args: any[]) { + return new ArrayElement(...args); + }, + bcc(...args: any[]) { + return new ArrayElement(...args); + }, + }, + + IbmmqChannelBindingElement: { + queue(...args: any[]) { + return new ObjectElement(...args); + }, + topic(...args: any[]) { + return new ObjectElement(...args); + }, + }, + + MqttServerBindingElement: { + lastWill(...args: any[]) { + return new ObjectElement(...args); + }, + }, + + SolaceOperationBindingElement: { + destinations(...args: any[]) { + return new ArrayElement(...args); + }, + }, + + GooglepubsubChannelBindingElement: { + labels(...args: any[]) { + return new ObjectElement(...args); + }, + messageStoragePolicy(...args: any[]) { + return new ObjectElement(...args); + }, + schemaSettings(...args: any[]) { + return new ObjectElement(...args); + }, + }, + + GooglepubsubMessageBindingElement: { + attributes(...args: any[]) { + return new ObjectElement(...args); + }, + schema(...args: any[]) { + return new ObjectElement(...args); + }, + }, + + PulsarChannelBindingElement: { + 'geo-replication': function geoReplication(...args: any[]) { + return new ArrayElement(...args); + }, + retention(...args: any[]) { + return new ObjectElement(...args); + }, + }, + + [ComponentsSchemasElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + [ComponentsServersElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new ServerElement(...args); + }, + }, + + [ComponentsServerVariablesElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new ServerVariableElement(...args); + }, + }, + + [ComponentsMessagesElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new MessageElement(...args); + }, + }, + + [ComponentsSecuritySchemesElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new SecuritySchemeElement(...args); + }, + }, + + [ComponentsParametersElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new ParameterElement(...args); + }, + }, + + [ComponentsCorrelationIDsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new CorrelationIDElement(...args); + }, + }, + + [ComponentsOperationTraitsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new OperationTraitElement(...args); + }, + }, + + [ComponentsMessageTraitsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new MessageTraitElement(...args); + }, + }, + + [ComponentsServerBindingsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new ServerBindingsElement(...args); + }, + }, + + [ComponentsChannelBindingsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new ChannelBindingsElement(...args); + }, + }, + + [ComponentsOperationBindingsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new OperationBindingsElement(...args); + }, + }, + + [ComponentsOperationsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new OperationBindingsElement(...args); + }, + }, + + [ComponentsMessageBindingsElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new MessageBindingsElement(...args); + }, + }, + + [ComponentsOperationsElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new OperationElement(...args); + }, + }, + + [ServerVariablesElement.primaryClass]: { + '[key: *]': function key(...args: any[]) { + return new ServerVariableElement(...args); + }, + }, + + [ServerSecurityElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new SecurityRequirementElement(...args); + }, + }, + + [OperationTraitsElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new OperationTraitElement(...args); + }, + }, + + [OperationSecurityElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new SecurityRequirementElement(...args); + }, + }, + + [OperationMessageMapElement.primaryClass]: { + oneOf(...args: any[]) { + return new OperationMessageElement(...args); + }, + }, + + [OperationMessageElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new MessageElement(...args); + }, + }, + + [OperationReplyMessageElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new ReferenceElement(...args); + }, + }, + + [MessageExamplesElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new MessageExampleElement(...args); + }, + }, + + [MessageTraitsElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new MessageTraitElement(...args); + }, + }, + + [MessageTraitExamplesElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new MessageTraitExamplesElement(...args); + }, + }, + + [ChannelServersElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new StringElement(...args); + }, + }, + + [SecuritySchemeScopesElement.primaryClass]: { + '<*>': function asterisk(...args: any[]) { + return new StringElement(...args); + }, + }, + + 'components-operation-replies': { + '[key: *]': function key(...args: any[]) { + return new OperationReplyElement(...args); + }, + }, + + 'components-operation-reply-addresses': { + '[key: *]': function key(...args: any[]) { + return new OperationReplyAddressElement(...args); + }, + }, + + 'json-schema-properties': { + '[key: *]': function key(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + 'json-schema-allOf': { + '<*>': function asterisk(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + 'json-schema-anyOf': { + '<*>': function asterisk(...args: any[]) { + return new SchemaElement(...args); + }, + }, + + 'json-schema-oneOf': { + '<*>': function asterisk(...args: any[]) { + return new SchemaElement(...args); + }, + }, +}; + +const findElementFactory = (ancestor: any, keyName: string) => { + const elementType = getNodeType(ancestor); // @ts-ignore + const keyMapping = schema[elementType] || schema[toValue(ancestor.classes.first)]; + + return typeof keyMapping === 'undefined' + ? undefined + : Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') + ? keyMapping['[key: *]'] + : keyMapping[keyName]; +}; + +const plugin = () => () => ({ + visitor: { + StringElement(element: StringElement, key: any, parent: any, path: any, ancestors: any[]) { + if (!isEmptyElement(element)) return undefined; + + const lineage = [...ancestors, parent].filter(isElement); + const parentElement = lineage[lineage.length - 1]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future + let elementFactory; + let context; + + if (isArrayElement(parentElement)) { + context = element; + elementFactory = findElementFactory(parentElement, '<*>'); + } else if (isMemberElement(parentElement)) { + context = lineage[lineage.length - 2]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future + elementFactory = findElementFactory(context, toValue(parentElement.key)); + } + + // no element factory found + if (typeof elementFactory !== 'function') return undefined; + + const result = elementFactory.call( + { context }, + undefined, + cloneDeep(element.meta), + cloneDeep(element.attributes), + ); + + return assignSourceMap(result, element); + }, + }, +}); + +export default plugin; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts index 2a55d049f2..703fcec32b 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts @@ -1,5 +1,5 @@ import { startsWith } from 'ramda'; -import { MemberElement, isStringElement, toValue } from '@swagger-api/apidom-core'; +import { MemberElement, ObjectElement, isObjectElement, isStringElement, toValue } from '@swagger-api/apidom-core'; export const isReferenceObject = (node: any) => { if (!node || typeof node !== 'object') return false; @@ -7,6 +7,17 @@ export const isReferenceObject = (node: any) => { return typeof node.$ref === 'string' || (typeof node.get === 'function' && node.get('$ref')); }; +export interface ReferenceLikeElement extends ObjectElement { + hasKey: (value: '$ref') => true; +} + +/** + * @public + */ +export const isReferenceLikeElement = (element: unknown): element is ReferenceLikeElement => { + return isObjectElement(element) && element.hasKey('$ref'); +}; + /** * @public */ @@ -14,6 +25,23 @@ export const isAsyncApiExtension = (element: MemberElement): boolean => { return isStringElement(element.key) && startsWith('x-', toValue(element.key)); }; +/** + * @public + */ +export interface MultiFormatSchemaLikeElement extends ObjectElement { + hasKey: (value: 'schemaFormat') => true; +} + +/** + * @public + */ +export const isMultiFormatSchemaLikeElement = ( + element: unknown, +): element is MultiFormatSchemaLikeElement => { + return isObjectElement(element) && element.hasKey('schemaFormat'); +}; + + export default { isReferenceObject, }; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 2356c72552..51d6e10a65 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -1,63 +1,66 @@ import { specificationObj as AsyncApi2_0Specification } from '@swagger-api/apidom-ns-asyncapi-2'; -import FallbackVisitor from './visitors/FallbackVisitor.ts'; import AsyncApi3Visitor from './visitors/async-api-3/index.ts'; import AsyncApiVersionVisitor from './visitors/async-api-3/AsyncApiVersionVisitor.ts'; -import IdentifierVisitor from './visitors/async-api-3/IdentifierVisitor.ts'; -import InfoVisitor from './visitors/async-api-3/info/info.ts'; -import ChannelsVisitor from './visitors/async-api-3/channels/index.ts'; -import ChannelVisitor from './visitors/async-api-3/channel/index.ts'; -import ChannelServersVisitor from './visitors/async-api-3/channel/ServersVisitor.ts'; -import ExternalDocsVisitor from './visitors/generics/ExternalDocumentationVisitor.ts'; import ChanneBindingsVisitor from './visitors/async-api-3/channel/BindingsVisitor.ts'; -import ComponentsVisitor from './visitors/async-api-3/components/index.ts'; -import ComponentsSchemasVisitor from './visitors/async-api-3/components/SchemasVisitor.ts'; +import ChannelAddressExpressionsVisitor from './visitors/async-api-3/channel-address-expressions/index.ts'; +import ChannelBindingsVisitor from './visitors/async-api-3/channel-bindings/index.ts'; +import ChannelServersVisitor from './visitors/async-api-3/channel/ServersVisitor.ts'; +import ChannelVisitor from './visitors/async-api-3/channel/index.ts'; +import ChannelsVisitor from './visitors/async-api-3/channels/index.ts'; import ComponentsOperationsVisitor from './visitors/async-api-3/components/OperationsVisitor.ts'; +import ComponentsSchemasVisitor from './visitors/async-api-3/components/SchemasVisitor.ts'; +import ComponentsVisitor from './visitors/async-api-3/components/index.ts'; +import ContactVisitor from './visitors/async-api-3/contact/index.ts'; +import CorrelationIDVisitor from './visitors/async-api-3/correlation-id/index.ts'; import DefaultContentTypeVisitor from '../elements/DefaultContentType.ts'; -import SecuritySchemesVisitor from './visitors/async-api-3/SecuritySchemesVisitor.ts'; -import ServerVisitor from './visitors/async-api-3/server/index.ts'; -import ServerVariableVisitor from './visitors/async-api-3/server-variable/index.ts'; -import ParametersVisitor from './visitors/async-api-3/parameters/index.ts'; -import ParameterVisitor from './visitors/async-api-3/parameter/index.ts'; -import TagsVisitor from './visitors/async-api-3/tags/index.ts'; import ExternalDocumentationVisitor from './visitors/async-api-3/external-documentation-object/index.ts'; - -import OperationVisitor from './visitors/async-api-3/operation/OperationVisitor.ts'; -import OperationsVisitor from './visitors/async-api-3/operations/index.ts'; -import OperationMessagesVisitor from './visitors/async-api-3/operation/MessagesVisitor.ts'; -import OperationBindingsVisitor_ from './visitors/async-api-3/operation/BindingsVisitor.ts'; -import OperationTraitsVisitor from './visitors/async-api-3/operation/TraitsVisitor.ts'; -import OperationSecurityVisitor from './visitors/async-api-3/operation/SecurityVisitor.ts'; -import SchemaVisitor from './visitors/async-api-3/schema/index.ts'; -import ReferenceVisitor from './visitors/async-api-3/reference/index.ts'; -import ContactVisitor from './visitors/async-api-3/contact/index.ts'; +import FallbackVisitor from './visitors/FallbackVisitor.ts'; +import IdentifierVisitor from './visitors/async-api-3/IdentifierVisitor.ts'; +import InfoVisitor from './visitors/async-api-3/info/info.ts'; import LicenseVisitor from './visitors/async-api-3/license/index.ts'; -import TagVisitor from './visitors/async-api-3/tag/index.ts'; -import MessagesVisitor from './visitors/async-api-3/messages/index.ts'; -import MessageVisitor from './visitors/async-api-3/message/index.ts'; -import MessageExamplesVisitor from './visitors/async-api-3/message/ExamplesVisitor.ts'; -import MessageExampleVisitor from './visitors/async-api-3/message-example/index.ts'; import MessageBindingsVisitor from './visitors/async-api-3/message/BindingsVisitor.ts'; +import MessageCorrelationIdVisitor from './visitors/async-api-3/message/CorrelationIdVisitor.ts'; +import MessageExampleVisitor from './visitors/async-api-3/message-example/index.ts'; +import MessageExamplesVisitor from './visitors/async-api-3/message/ExamplesVisitor.ts'; import MessageHeadersVisitor from './visitors/async-api-3/message/HeadersVisitor.ts'; +import MessageTraitHeadersVisitor from './visitors/async-api-3/message-trait/HeadersVisitor.ts'; +import MessageTraitVisitor from './visitors/async-api-3/message-trait/index.ts'; import MessageTraitsVisitor from './visitors/async-api-3/message/TraitsVisitor.ts'; -import MessageCorrelationIdVisitor from './visitors/async-api-3/message/CorrelationIdVisitor.ts'; -import OperationReplyVisitor from './visitors/async-api-3/operation-reply/index.ts'; -import ServersVisitor from './visitors/async-api-3/servers/index.ts'; +import MessageVisitor from './visitors/async-api-3/message/index.ts'; +import MessagesVisitor from './visitors/async-api-3/messages/index.ts'; import MultiFormatSchemaVisitor from './visitors/async-api-3/multiFormatSchema/index.ts' -import ChannelBindingsVisitor from './visitors/async-api-3/channel-bindings/index.ts'; -import MessageTraitVisitor from './visitors/async-api-3/message-trait/index.ts'; -import MessageTraitHeadersVisitor from './visitors/async-api-3/message-trait/HeadersVisitor.ts'; -import SecuritySchemeVisitor from './visitors/async-api-3/security-scheme/index.ts'; -import OperationBindingsVisitor from './visitors/async-api-3/operation-bindings/index.ts'; import OAuthFlowVisitor from './visitors/async-api-3/oauth-flow/index.ts'; import OAuthFlowsVisitor from './visitors/async-api-3/oauth-flows/index.ts'; -import ServerBindingsVisitor from './visitors/async-api-3/server-bindings/index.ts'; -import ChannelAddressExpressionsVisitor from './visitors/async-api-3/channel-address-expression/index.ts'; -import OperationTraitVisitor from './visitors/async-api-3/operation-trait/index.ts'; +import OperationBindingsVisitor from './visitors/async-api-3/operation-bindings/index.ts'; +import OperationBindingsVisitor_ from './visitors/async-api-3/operation/BindingsVisitor.ts'; +import OperationChannelVisitor from './visitors/async-api-3/operation/ChannelVisitor.ts'; +import OperationMessagesVisitor from './visitors/async-api-3/operation/MessagesVisitor.ts'; +import OperationReplyVisitor_ from './visitors/async-api-3/operation/ReplyVisitor.ts'; import OperationReplyAddressVisitor from './visitors/async-api-3/operation-reply-address/index.ts'; import OperationReplyAddressVisitor_ from './visitors/async-api-3/operation-reply/AddressVisitor.ts'; import OperationReplyMessagesVisitor from './visitors/async-api-3/operation-reply/MessagesVisitor.ts'; +import OperationReplyVisitor from './visitors/async-api-3/operation-reply/index.ts'; +import OperationSecurityVisitor from './visitors/async-api-3/operation/SecurityVisitor.ts'; +import OperationTraitVisitor from './visitors/async-api-3/operation-trait/index.ts'; +import OperationTraitsVisitor from './visitors/async-api-3/operation/TraitsVisitor.ts'; +import OperationVisitor from './visitors/async-api-3/operation/index.ts'; +import OperationsVisitor from './visitors/async-api-3/operations/index.ts'; +import ParameterVisitor from './visitors/async-api-3/parameter/index.ts'; +import ParametersVisitor from './visitors/async-api-3/parameters/index.ts'; +import ReferenceVisitor from './visitors/async-api-3/reference/index.ts'; +import SchemaVisitor from './visitors/async-api-3/schema/index.ts'; +import SecuritySchemeScopesVisitor from './visitors/async-api-3/security-scheme/ScopesVisitor.ts'; +import SecuritySchemeVisitor from './visitors/async-api-3/security-scheme/index.ts'; +import ServerBindingsVisitor from './visitors/async-api-3/server-bindings/index.ts'; +import ServerVariableVisitor from './visitors/async-api-3/server-variable/index.ts'; +import ServerVisitor from './visitors/async-api-3/server/index.ts'; +import ServersVisitor from './visitors/async-api-3/servers/index.ts'; +import TagVisitor from './visitors/async-api-3/tag/index.ts'; +import TagsVisitor from './visitors/async-api-3/tags/index.ts'; import { default as schemaInheritedFixedFields } from './visitors/async-api-3/schema/inherited-fixed-fields.ts' +import DefaultContentType from '../elements/DefaultContentType.ts'; +import ExternalDocumentationOrReferenceVisitor from './visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts'; const SchemaSpecification = { $visitor: SchemaVisitor, @@ -94,13 +97,15 @@ const specification = { AsyncApi: { $visitor: AsyncApi3Visitor, fixedFields: { - asyncapi: { $ref: '#/visitors/value' }, - id: { $ref: '#/visitors/value' }, + asyncapi: { $ref: '#/visitors/docuemnt/objects/AsyncApiVersion' }, + id: { $ref: '#/visitors/docuemnt/objects/Identifier' }, info: { $ref: '#/visitors/document/objects/Info' }, servers: { $ref: '#/visitors/document/objects/Servers' }, - defaultContentType: { $ref: '#/visitors/value' }, + defaultContentType: { + $ref: '#/visitors/document/objects/DefaultContentType', + }, channels: { $ref: '#/visitors/document/objects/Channels' }, - operations: { $ref: '#/visitors/document/objects/Operation' }, + operations: { $ref: '#/visitors/document/objects/Operations' }, components: { $ref: '#/visitors/document/objects/Components' }, }, }, @@ -119,10 +124,10 @@ const specification = { termsOfService: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.termsOfService, contact: { $ref: '#/visitors/document/objects/Contact' }, license: { $ref: '#/visitors/document/objects/License' }, - externalDocs: ExternalDocsVisitor, tags: { $ref: '#/visitors/document/objects/Tags', }, + externalDocs: ExternalDocumentationOrReferenceVisitor, }, }, Contact: { @@ -158,7 +163,7 @@ const specification = { tags: { $ref: '#/visitors/document/objects/Tags', }, - externalDocs: ExternalDocumentationVisitor, + externalDocs: ExternalDocumentationOrReferenceVisitor, bindings: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.bindings, }, }, @@ -188,7 +193,7 @@ const specification = { servers: ChannelServersVisitor, parameters: { $ref: '#/visitors/document/object/Parameters' }, tags: { $ref: '#/visitors/document/objects/Tags' }, - externalDocs: ExternalDocsVisitor, + externalDocs: ExternalDocumentationOrReferenceVisitor, bindings: ChanneBindingsVisitor, }, }, @@ -205,13 +210,13 @@ const specification = { $visitor: OperationVisitor, fixedFields: { action: { $ref: '#/visitors/value' }, - channel: { $ref: '#/visitors/value' }, + channel: OperationChannelVisitor, title: { $ref: '#/visitors/value' }, summary: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, security: OperationSecurityVisitor, tags: { $ref: '#/visitors/document/objects/Tags' }, - externalDocs: ExternalDocsVisitor, + externalDocs: ExternalDocumentationOrReferenceVisitor, bindings: OperationBindingsVisitor_, traits: OperationTraitsVisitor, message: OperationMessagesVisitor, @@ -228,7 +233,7 @@ const specification = { tags: { $ref: '#/visitors/document/objects/Tags', }, - externalDocs: ExternalDocumentationVisitor, + externalDocs: ExternalDocumentationOrReferenceVisitor, bindings: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.bindings, } }, @@ -236,7 +241,7 @@ const specification = { $visitor: OperationReplyVisitor, fixedFields: { address: OperationReplyAddressVisitor_, - channel: { $ref: '#/visitors/document/objects/Reference' }, + channel: OperationChannelVisitor, messages: OperationReplyMessagesVisitor }, }, @@ -542,7 +547,7 @@ const specification = { tags: { $ref: '#/visitors/document/objects/Tags', }, - externalDocs: ExternalDocsVisitor, + externalDocs: ExternalDocumentationOrReferenceVisitor, bindings: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.bindings, examples: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.examples, }, @@ -564,7 +569,7 @@ const specification = { fixedFields: { name: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, - externalDocs: ExternalDocsVisitor, + externalDocs: ExternalDocumentationOrReferenceVisitor, }, }, ExternalDocumentation: { @@ -613,6 +618,22 @@ const specification = { }, }, Schema: SchemaSpecification, + SecurityScheme: { + $visitor: SecuritySchemeVisitor, + fixedFields: { + type: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.type, + description: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.description, + name: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.name, + in: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.in, + scheme: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.scheme, + bearerFormat: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.bearerFormat, + flows: { + $ref: '#/visitors/document/objects/OAuthFlows', + }, + openIdConnectUrl: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.openIdConnectUrl, + scopes: SecuritySchemeScopesVisitor + }, + }, OAuthFlows: { $visitor: OAuthFlowsVisitor, fixedFields: { @@ -639,26 +660,11 @@ const specification = { availableScopes: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.scopes }, }, - SecuritySchemes: { - $visitor: SecuritySchemesVisitor, - }, - OperationMessage: { - $visitor: MessageVisitor, - }, - SecurityScheme: { - $visitor: SecuritySchemeVisitor, + CorrelationID: { + $visitor: CorrelationIDVisitor, fixedFields: { - type: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.type, - description: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.description, - name: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.name, - in: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.in, - scheme: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.scheme, - bearerFormat: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.bearerFormat, - flows: { - $ref: '#/visitors/document/objects/OAuthFlows', - }, - openIdConnectUrl: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.openIdConnectUrl, - scopes: { $ref: '#/visitors/value' }, + description: AsyncApi2_0Specification.visitors.document.objects.CorrelationID.fixedFields.description, + location: AsyncApi2_0Specification.visitors.document.objects.CorrelationID.fixedFields.location }, }, }, diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts deleted file mode 100644 index 4d073f8f6a..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/DefaultContentTypeVisitor.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { - specificationObj as AsyncApi2Specification, - DefaultContentTypeVisitorOptions, - DefaultContentTypeVisitor as DefaultContentTypeVisitorType, -} from '@swagger-api/apidom-ns-asyncapi-2'; - -import DefaultContentTypeElement from '../../elements/DefaultContentType.ts'; - -export const BaseDefaultContentTypeVisitor: typeof DefaultContentTypeVisitorType = - AsyncApi2Specification.visitors.document.objects.DefaultContentType.$visitor; - -export type { DefaultContentTypeVisitorOptions }; - -class DefaultContentTypeVisitor extends BaseDefaultContentTypeVisitor { - declare public readonly element: DefaultContentTypeElement; - - constructor(options: DefaultContentTypeVisitorOptions) { - super(options); - this.element = new DefaultContentTypeElement(); - } -} - -export default DefaultContentTypeVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts new file mode 100644 index 0000000000..09c5bba13d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts @@ -0,0 +1,31 @@ +import { Mixin } from 'ts-mixer'; +import { StringElement, BREAK, toValue } from '@swagger-api/apidom-core'; + +import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; +import DefaultContentTypeElement from '../../../elements/DefaultContentType.ts' + +/** + * @public + */ +export interface DefaultContentTypeVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class DefaultContentTypeVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public element: DefaultContentTypeElement; + + StringElement(stringElement: StringElement) { + const defaultContentTypeElement = new DefaultContentTypeElement(toValue(stringElement)); + + this.copyMetaAndAttributes(stringElement, defaultContentTypeElement); + + this.element = defaultContentTypeElement; + return BREAK; + } +} + +export default DefaultContentTypeVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts deleted file mode 100644 index 4e75273079..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/ParametersVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class ParametersVisitor extends Visitor {} - -export default ParametersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts deleted file mode 100644 index 3277f9e6f3..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/SecuritySchemesVisitor.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Visitor from '../Visitor.ts'; - -class SecuritySchemesVisitor extends Visitor {} - -export default SecuritySchemesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expression/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expressions/index.ts similarity index 95% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expression/index.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expressions/index.ts index 12efee8cfc..9bb10728f8 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expression/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expressions/index.ts @@ -8,7 +8,7 @@ import PatternedFieldsVisitor, { import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import MessageElement from '../../../../elements/Message.ts'; import ReferenceElement from '../../../../elements/Reference.ts'; -import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts index b38e0ba808..493ada42e7 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts @@ -6,7 +6,8 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts index 69103e18cf..ce3f518a6e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts @@ -1,22 +1,55 @@ -import { - specificationObj as AsyncApi2Specification, - ChannelsVisitorOptions, - ChannelsVisitor as ChannelsVisitorType, -} from '@swagger-api/apidom-ns-asyncapi-2'; +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import PatternedFieldsVisitor, { + PatternedFieldsVisitorOptions, + SpecPath, +} from '../../generics/PatternedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import ChannelsElement from '../../../../elements/Channels.ts'; +import ReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceLikeElement } from '../../../predicates.ts'; -export const BaseChannelsVisitor: typeof ChannelsVisitorType = - AsyncApi2Specification.visitors.document.objects.Channels.$visitor; +/** + * @public + */ +export interface ChannelsVisitorOptions + extends PatternedFieldsVisitorOptions, + FallbackVisitorOptions {} -export type { ChannelsVisitorOptions }; - -class ChannelsVisitor extends BaseChannelsVisitor { +/** + * @public + */ +class ChannelsVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { declare public readonly element: ChannelsElement; + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Channel'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + constructor(options: ChannelsVisitorOptions) { super(options); this.element = new ChannelsElement(); + this.element.classes.push('servers'); + this.specPath = (element: unknown) => { + return isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Channel']; + }; + this.canSupportSpecificationExtensions = false; + } + + ObjectElement(objectElement: ObjectElement) { + const result = PatternedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'channel'); + }); + + return result; } } diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts new file mode 100644 index 0000000000..cfd35fad89 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts @@ -0,0 +1,45 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import ComponentsChannelsElement from '../../../../elements/nces/ComponentsChannels.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface ChannelsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class ChannelsVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsChannelsElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Channel'] + >; + + constructor(options: ChannelsVisitorOptions) { + super(options); + this.element = new ComponentsChannelsElement(); + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Channel']; + } + + ObjectElement(objectElement: ObjectElement) { + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'channel'); + }); + + return result; + } +} + +export default ChannelsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts new file mode 100644 index 0000000000..26b2ca6786 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts @@ -0,0 +1,47 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import ComponentsExternalDocumentationElement from '../../../../elements/nces/ComponentsExternalDocumentation.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface ExternalDocumentationVisitorOptions + extends MapVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class ExternalDocumentationVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsExternalDocumentationElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'ExternalDocumentation'] + >; + + constructor(options: ExternalDocumentationVisitorOptions) { + super(options); + this.element = new ComponentsExternalDocumentationElement(); + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'ExternalDocumentation']; + } + + ObjectElement(objectElement: ObjectElement) { + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'externalDocumentation'); + }); + + return result; + } +} + +export default ExternalDocumentationVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts index 6a4dcbe941..94cc96a7ee 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts @@ -1,44 +1,45 @@ import { Mixin } from 'ts-mixer'; -import { ArrayElement, Element, BREAK, cloneDeep } from '@swagger-api/apidom-core'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import ComponentOperationsElement from '../../../../elements/nces/ComponentOperations.ts'; -import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import ComponentsOperationsElement from '../../../../elements/nces/ComponentsOperations.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ -export interface OperationsVisitorOptions - extends SpecificationVisitorOptions, - FallbackVisitorOptions {} +export interface OperationsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} /** * @public */ -class OperationsVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { - declare public readonly element: ComponentOperationsElement; +class OperationsVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsOperationsElement; - constructor(options:OperationsVisitorOptions) { + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Operation'] + >; + + constructor(options: OperationsVisitorOptions) { super(options); - this.element = new ComponentOperationsElement(); + this.element = new ComponentsOperationsElement(); + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Operation']; } - ArrayElement(arrayElement: ArrayElement) { - arrayElement.forEach((item: Element) => { - const element = cloneDeep(item); - - if (isReferenceElement(element)) { - element.classes.push('operations-name'); - } + ObjectElement(objectElement: ObjectElement) { + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); - this.element.push(element); + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'operation'); }); - this.copyMetaAndAttributes(arrayElement, this.element); - - return BREAK; + return result; } } -export default OperationsVisitor; +export default OperationsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts new file mode 100644 index 0000000000..750464d95c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts @@ -0,0 +1,45 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import ComponentsRepliesElement from '../../../../elements/nces/ComponentsReplies.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface RepliesVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class RepliesVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsRepliesElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'OperationReply'] + >; + + constructor(options: RepliesVisitorOptions) { + super(options); + this.element = new ComponentsRepliesElement(); + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'OperationReply']; + } + + ObjectElement(objectElement: ObjectElement) { + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'operationReply'); + }); + + return result; + } +} + +export default RepliesVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts new file mode 100644 index 0000000000..9e5602402c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts @@ -0,0 +1,45 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import ComponentsReplyAddressesElement from '../../../../elements/nces/ComponentsReplyAddresses.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface ReplyAddressesVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class ReplyAddressesVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsReplyAddressesElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'OperationReplyAddress'] + >; + + constructor(options: ReplyAddressesVisitorOptions) { + super(options); + this.element = new ComponentsReplyAddressesElement(); + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'OperationReplyAddress']; + } + + ObjectElement(objectElement: ObjectElement) { + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'operation-reply-address'); + }); + + return result; + } +} + +export default ReplyAddressesVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts index 9495795a51..874212c120 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts @@ -1,12 +1,13 @@ import { Mixin } from 'ts-mixer'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; import ReferenceElement from '../../../../elements/Reference.ts'; import ComponentsSchemasElement from '../../../../elements/nces/ComponentsSchemas.ts'; import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceLikeElement, isSchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; +import { isMultiFormatSchemaElement, isReferenceElement } from '../../../../predicates.ts'; +import { isMultiFormatSchemaLikeElement } from '../../../predicates.ts'; import MultiFormatSchema from '../../../../elements/MultiFormatSchema.ts'; /** @@ -21,21 +22,22 @@ class SchemasVisitor extends Mixin(MapVisitor, FallbackVisitor) { declare public readonly element: ComponentsSchemasElement; declare protected readonly specPath: SpecPath< - ['document', 'objects', 'Reference'] | ['document', 'objects', 'Schema'] | ['document', 'objects', 'MultiFormatSchema'] + | ['document', 'objects', 'Reference'] + | ['document', 'objects', 'Schema'] + | ['document', 'objects', 'MultiFormatSchema'] >; constructor(options: SchemasVisitorOptions) { super(options); this.element = new ComponentsSchemasElement(); - this.specPath = (element: unknown) => isReferenceLikeElement(element) - ? ['document', 'objects', 'Reference'] - : isMultiFormatSchemaElement(element) - ? ['document', 'objects', 'MultiFormatSchema'] - : isSchemaElement(element) - ? ['document', 'objects', 'Schema'] - : ['document', 'objects', 'Schema']; + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : isMultiFormatSchemaLikeElement(element) + ? ['document', 'objects', 'MultiFormatSchema'] + : ['document', 'objects', 'Schema']; } - + ObjectElement(objectElement: ObjectElement) { const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); @@ -44,13 +46,15 @@ class SchemasVisitor extends Mixin(MapVisitor, FallbackVisitor) { referenceElement.setMetaProperty('referenced-element', 'schema'); }); - // @ts-ignore - this.element.filter(isMultiFormatSchemaElement).forEach((multiFormatSchemaElement: MultiFormatSchema) => { - multiFormatSchemaElement.setMetaProperty('multiformat-schema-element', 'schema'); - }); + this.element + .filter(isMultiFormatSchemaElement) + // @ts-ignore + .forEach((multiFormatSchemaElement: MultiFormatSchema) => { + multiFormatSchemaElement.setMetaProperty('multiformat-schema-element', 'schema'); + }); return result; } } -export default SchemasVisitor; +export default SchemasVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts new file mode 100644 index 0000000000..77ea94463f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts @@ -0,0 +1,45 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import ComponentsTagsElement from '../../../../elements/nces/ComponentsTags.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface TagsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class TagsVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsTagsElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Tag'] + >; + + constructor(options: TagsVisitorOptions) { + super(options); + this.element = new ComponentsTagsElement(); + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Tag']; + } + + ObjectElement(objectElement: ObjectElement) { + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'tag'); + }); + + return result; + } +} + +export default TagsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation deleted file mode 100644 index 3c6d1451d6..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation +++ /dev/null @@ -1,23 +0,0 @@ -import { - specificationObj as AsyncApi2Specification, - ExternalDocumentationVisitorOptions, - ExternalDocumentationVisitor as ExternalDocumentationVisitorType, -} from '@swagger-api/apidom-ns-asyncapi-2'; - -import ExternalDocumentationElement from '../../../elements/ExternalDocumentation'; - -export const BaseExternalDocumentationVisitor: typeof ExternalDocumentationVisitorType = - AsyncApi2Specification.visitors.document.objects.ExternalDocumentation.$visitor; - -export type { ExternalDocumentationVisitorOptions }; - -class ExternalDocumentationVisitor extends BaseExternalDocumentationVisitor { - declare public readonly element: ExternalDocumentationElement; - - constructor(options: ExternalDocumentationVisitorOptions) { - super(options); - this.element = new ExternalDocumentationElement(); - } -} - -export default ExternalDocumentationVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts new file mode 100644 index 0000000000..12b3cca4cf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts @@ -0,0 +1,39 @@ +import { T as stubTrue } from 'ramda'; +import { Element } from '@swagger-api/apidom-core'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; +import ExternalDocumentationElement from '../../../../elements/ExternalDocumentation.ts'; +import ReferenceElement from '../../../../elements/Reference.ts'; + +export type { AlternatingVisitorOptions as ExternalDocumentationOrReferenceVisitorOptions }; + +/** + * @public + */ +class ExternalDocumentationOrReferenceVisitor extends AlternatingVisitor { + declare public element: ExternalDocumentationElement | ReferenceElement; + + constructor(options: AlternatingVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { predicate: stubTrue, specPath: ['document', 'objects', 'ExternalDocumentation'] }, + ]; + } + + enter(element: Element) { + const result = AlternatingVisitor.prototype.enter.call(this, element); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'externalDocumentation'); + } + + return result; + } +} + +export default ExternalDocumentationOrReferenceVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts index 92951cbb16..2702057f4b 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts @@ -6,8 +6,13 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement, isSchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { + isReferenceElement, + isReferenceLikeElement, + isSchemaElement, +} from '@swagger-api/apidom-ns-asyncapi-2'; import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; +import { isMultiFormatSchemaLikeElement } from '../../../predicates.ts'; /** * @public @@ -22,8 +27,11 @@ class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { super(options); this.alternator = [ { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, - { predicate: isSchemaElement, specPath: ['document', 'objects', 'Schema'] }, - { predicate: stubTrue, specPath: ['document', 'objects', 'MultiformatSchema'] }, + { + predicate: isMultiFormatSchemaLikeElement, + specPath: ['document', 'objects', 'MultiFormatSchema'], + }, + { predicate: stubTrue, specPath: ['document', 'objects', 'Schema'] }, ]; } @@ -34,16 +42,16 @@ class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { this.element.setMetaProperty('referenced-element', 'ref-header'); } - if(isSchemaElement(this.element)) { - this.element.setMetaProperty('schema', 'header-schema'); + if (isSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'header-schema'); } - if(isMultiFormatSchemaElement(this.element)) { - this.element.setMetaProperty('schema', 'header-multiformat-schema') + if (isMultiFormatSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'header-multiformat-schema'); } return result; } } -export default HeadersVisitor; +export default HeadersVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts index 91e5adb3b3..b695cb6d8a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts @@ -6,7 +6,8 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts index c9ae13f874..18f7a26c45 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts @@ -6,7 +6,8 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts index 92951cbb16..2702057f4b 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts @@ -6,8 +6,13 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement, isSchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { + isReferenceElement, + isReferenceLikeElement, + isSchemaElement, +} from '@swagger-api/apidom-ns-asyncapi-2'; import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; +import { isMultiFormatSchemaLikeElement } from '../../../predicates.ts'; /** * @public @@ -22,8 +27,11 @@ class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { super(options); this.alternator = [ { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, - { predicate: isSchemaElement, specPath: ['document', 'objects', 'Schema'] }, - { predicate: stubTrue, specPath: ['document', 'objects', 'MultiformatSchema'] }, + { + predicate: isMultiFormatSchemaLikeElement, + specPath: ['document', 'objects', 'MultiFormatSchema'], + }, + { predicate: stubTrue, specPath: ['document', 'objects', 'Schema'] }, ]; } @@ -34,16 +42,16 @@ class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { this.element.setMetaProperty('referenced-element', 'ref-header'); } - if(isSchemaElement(this.element)) { - this.element.setMetaProperty('schema', 'header-schema'); + if (isSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'header-schema'); } - if(isMultiFormatSchemaElement(this.element)) { - this.element.setMetaProperty('schema', 'header-multiformat-schema') + if (isMultiFormatSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'header-multiformat-schema'); } return result; } } -export default HeadersVisitor; +export default HeadersVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts new file mode 100644 index 0000000000..b7b54d184e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts @@ -0,0 +1,57 @@ +import { Mixin } from 'ts-mixer'; +import { T as stubTrue } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { + isReferenceElement, + isReferenceLikeElement, + isSchemaElement, +} from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; +import { isMultiFormatSchemaLikeElement } from '../../../predicates.ts'; + +/** + * @public + */ +export interface PayloadVisitorOptions extends AlternatingVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class PayloadVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { + constructor(options: PayloadVisitorOptions) { + super(options); + this.alternator = [ + { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, + { + predicate: isMultiFormatSchemaLikeElement, + specPath: ['document', 'objects', 'MultiFormatSchema'], + }, + { predicate: stubTrue, specPath: ['document', 'objects', 'Schema'] }, + ]; + } + + ObjectElement(objectElement: ObjectElement) { + const result = AlternatingVisitor.prototype.enter.call(this, objectElement); + + if (isReferenceElement(this.element)) { + this.element.setMetaProperty('referenced-element', 'ref-payload'); + } + + if (isSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'payload-schema'); + } + + if (isMultiFormatSchemaElement(this.element)) { + this.element.setMetaProperty('schema', 'payload-multiformat-schema'); + } + + return result; + } +} + +export default PayloadVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts index 320c949604..6d3393dff3 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/TraitsVisitor.ts @@ -4,7 +4,7 @@ import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import MessageTraitsElement from '../../../../elements/nces/MessageTraits.ts'; -import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts index 6de296f19f..eff76cd3d5 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts @@ -1,20 +1,14 @@ import { Mixin } from 'ts-mixer'; -import { always, defaultTo, includes } from 'ramda'; -import { ObjectElement, isObjectElement, toValue } from '@swagger-api/apidom-core'; +import { always } from 'ramda'; -import mediaTypes from '../../../../media-types.ts'; import MessageElement from '../../../../elements/Message.ts'; import FixedFieldsVisitor, { FixedFieldsVisitorOptions, SpecPath, } from '../../generics/FixedFieldsVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; - /** - * Implementation of refracting according `schemaFormat` fixed field is now limited, - * and currently only supports `AsyncAPI Schema Object >= 2.0.0 <=2.6.0.` * @public */ export interface MessageVisitorOptions extends FixedFieldsVisitorOptions, FallbackVisitorOptions {} @@ -35,28 +29,6 @@ class MessageVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { this.specPath = always(['document', 'objects', 'Message']); this.canSupportSpecificationExtensions = true; } - - ObjectElement(objectElement: ObjectElement) { - const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); - const payload = this.element.get('payload'); - const schemaFormat = defaultTo(mediaTypes.latest(), toValue(objectElement.get('schemaFormat'))); - const multiFormatSchema = objectElement.hasKey('multiFormatSchema') ? objectElement.get('multiFormatSchema') : undefined; - if (mediaTypes.includes(schemaFormat) && isReferenceLikeElement(payload)) { - // refract to ReferenceElement - const referenceElement = this.toRefractedElement( - ['document', 'objects', 'Reference'], - payload, - ); - referenceElement.meta.set('referenced-element', 'schema'); - this.element.payload = referenceElement; - } else if (mediaTypes.includes(schemaFormat) && isObjectElement(this.element.payload)) { - this.element.payload = this.toRefractedElement(['document', 'objects', 'Schema'], payload); - } else if (mediaTypes.includes(multiFormatSchema)) { - this.element.payload = this.toRefractedElement(['document', 'objects', 'MultiformatSchema'], payload); - } - - return result; - } } -export default MessageVisitor; +export default MessageVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts index bd65898e8d..6b8c61d338 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts @@ -1,22 +1,59 @@ import { Mixin } from 'ts-mixer'; -import { always } from 'ramda'; +import { test } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import PatternedFieldsVisitor, { + PatternedFieldsVisitorOptions, + SpecPath, +} from '../../generics/PatternedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import MessagesElement from '../../../../elements/Messages.ts'; -import FallbackVisitor from '../../FallbackVisitor.ts'; -import MapVisitor from '../../generics/MapVisitor.ts'; -import { SpecPath } from '../../generics/FixedFieldsVisitor.ts'; +import ReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; +/** + * @public + */ +export interface MessagesVisitorOptions + extends PatternedFieldsVisitorOptions, + FallbackVisitorOptions {} -class MessagesVisitor extends Mixin(MapVisitor, FallbackVisitor) { +/** + * @public + */ +class MessagesVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { declare public readonly element: MessagesElement; - declare protected readonly specPath: SpecPath<['document', 'objects', 'Messages']>; - declare protected readonly canSupportSpecificationExtensions: true; - constructor(options: any) { + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Message'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: MessagesVisitorOptions) { super(options); this.element = new MessagesElement(); - this.specPath = always(['document', 'objects', 'Messages']); - this.canSupportSpecificationExtensions = true; + this.element.classes.push('messages'); + this.specPath = (element: unknown) => { + return isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Message']; + }; + this.canSupportSpecificationExtensions = false; + // @ts-ignore + this.fieldPatternPredicate = test(/^[A-Za-z0-9_-]+$/); + } + + ObjectElement(objectElement: ObjectElement) { + const result = PatternedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'message'); + }); + + return result; } } diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts index c2644085ab..a5a4183192 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts @@ -1,7 +1,9 @@ import { Mixin } from 'ts-mixer'; -import { always } from 'ramda'; -import { ObjectElement, BooleanElement } from '@swagger-api/apidom-core'; +import { always, defaultTo } from 'ramda'; +import { ObjectElement, toValue, isObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import mediaTypes from '../../../../media-types.ts'; import MultiFormatSchemaElement from '../../../../elements/MultiFormatSchema.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import FixedFieldsVisitor, { @@ -10,9 +12,13 @@ import FixedFieldsVisitor, { } from '../../generics/FixedFieldsVisitor.ts'; /** + * Implementation of refracting according `schemaFormat` fixed field is now limited, + * and currently only supports `AsyncAPI Schema Object 3.0.0` * @public */ -export interface MultiFormatSchemaVisitorOptions extends FixedFieldsVisitorOptions, FallbackVisitorOptions {} +export interface MultiFormatSchemaVisitorOptions + extends FixedFieldsVisitorOptions, + FallbackVisitorOptions {} /** * @public @@ -26,22 +32,33 @@ class MultiFormatSchemaVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor constructor(options: MultiFormatSchemaVisitorOptions) { super(options); + this.element = new MultiFormatSchemaElement(); this.specPath = always(['document', 'objects', 'MultiFormatSchema']); this.canSupportSpecificationExtensions = true; } ObjectElement(objectElement: ObjectElement) { - this.element = new MultiFormatSchemaElement(); - - return FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); - } + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + const schema = this.element.get('schema'); + const schemaFormat = defaultTo(mediaTypes.latest(), toValue(objectElement.get('schemaFormat'))); - BooleanElement(booleanElement: BooleanElement) { - const result = super.enter(booleanElement); - this.element.classes.push('boolean-json-MultiFormatSchema'); + if (mediaTypes.includes(schemaFormat) && isReferenceLikeElement(schema)) { + // refract to ReferenceElement + const referenceElement = this.toRefractedElement( + ['document', 'objects', 'Reference'], + schema, + ); + referenceElement.meta.set('referenced-element', 'schema'); + this.element.schema = referenceElement; + } else if (mediaTypes.includes(schemaFormat) && isObjectElement(this.element.schema)) { + this.element.schema = this.toRefractedElement( + ['document', 'objects', 'Schema'], + this.element.schema, + ); + } return result; } } -export default MultiFormatSchemaVisitor; +export default MultiFormatSchemaVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts index adac8ee109..e76172d7d0 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts @@ -6,8 +6,8 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; - +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts index 7efca710c3..a64e29ba0b 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts @@ -6,7 +6,8 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts new file mode 100644 index 0000000000..ba46daf80e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts @@ -0,0 +1,47 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; +import { ObjectElement, isStringElement } from '@swagger-api/apidom-core'; + +import ReferenceElement from '../../../../elements/Reference.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface ChannelVisitorOptions extends FixedFieldsVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class ChannelVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { + declare public readonly element: ReferenceElement; + + declare protected readonly specPath: SpecPath<['document', 'objects', 'Reference']>; + + declare protected readonly canSupportSpecificationExtensions: false; + + constructor(options: ChannelVisitorOptions) { + super(options); + this.element = new ReferenceElement(); + this.specPath = always(['document', 'objects', 'Reference']); + this.canSupportSpecificationExtensions = false; + } + + ObjectElement(objectElement: ObjectElement) { + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + // mark this ReferenceElement with reference metadata + if (isStringElement(this.element.$ref)) { + this.element.classes.push('reference-element'); + this.element.setMetaProperty('referenced-element', 'channel'); + } + + return result; + } +} + +export default ChannelVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts index cb57407b39..29ac564251 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts @@ -1,9 +1,10 @@ import { Mixin } from 'ts-mixer'; import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; + import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import OperationMessagesElement from '../../../../elements/nces/OperationMessage.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; /** * @public @@ -25,11 +26,11 @@ class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { ArrayElement(arrayElement: ArrayElement) { arrayElement.forEach((item: Element) => { - - let element; - if (isReferenceElement(item)) { - element = this.toRefractedElement(['document', 'objects', 'Messages'], item); - element.setMetaProperty('referenced-element', 'operationMessages') + const specPath = ['document', 'objects', 'Reference']; + const element = this.toRefractedElement(specPath, item); + + if (isReferenceElement(element)) { + element.setMetaProperty('referenced-element', 'operation-message'); } this.element.push(element); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts index f7a0eef819..7f30d8bb21 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts @@ -6,7 +6,8 @@ import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts index 828ca28c5b..a2a4301046 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts @@ -4,7 +4,8 @@ import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import OperationSecurityElement from '../../../../elements/nces/OperationSecurity.ts'; -import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; + /** * @public */ diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts index cd22627db4..f022649898 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/TraitsVisitor.ts @@ -4,7 +4,7 @@ import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; import OperationTraitsElement from '../../../../elements/nces/OperationTraits.ts'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceLikeElement } from '../../../predicates.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts similarity index 62% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts index be4ca9e56f..f6256e041a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/OperationVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts @@ -20,27 +20,20 @@ class OperationVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { this.canSupportSpecificationExtensions = true; } - ObjectElement(objectElement: ObjectElement) { - const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement) as OperationElement; + ObjectElement(objectElement: ObjectElement) { + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); - // Retrieve the action from the objectElement const action = objectElement.get('action'); if (isStringElement(action)) { - const actionValue = action.toValue(); - if (actionValue === 'send' || actionValue === 'receive') { - result.setMetaProperty('operation-action', actionValue); - } else { - throw new Error(`Invalid action type: ${actionValue}. Expected "send" or "receive".`); - } + const actionValue = action.toValue(); + if (actionValue === 'send' || actionValue === 'receive') { + this.element.setMetaProperty('operation-action', actionValue); + } } - // Set the element to the result after processing - this.element = result; - this.copyMetaAndAttributes(objectElement, this.element); - - return this.element; -} + return result; + } } export default OperationVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts index 16c0eaa8d3..5f08502dcd 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts @@ -1,29 +1,60 @@ import { Mixin } from 'ts-mixer'; +import { test } from 'ramda'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import OperationsElement from '../../../../elements/Operations.ts'; -import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import PatternedFieldsVisitor, { + PatternedFieldsVisitorOptions, + SpecPath, +} from '../../generics/PatternedFieldsVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { always } from 'ramda'; +import OperationsElement from '../../../../elements/Operations.ts'; +import ReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; /** * @public */ -export interface OperationsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} +export interface OperationsVisitorOptions + extends PatternedFieldsVisitorOptions, + FallbackVisitorOptions {} + /** * @public */ -class OperationsVisitor extends Mixin(MapVisitor, FallbackVisitor) { - +class OperationsVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { declare public readonly element: OperationsElement; - declare protected readonly specPath: SpecPath<['document', 'objects', 'Operation']>; + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Operation'] + >; + + declare protected readonly canSupportSpecificationExtensions: false; constructor(options: OperationsVisitorOptions) { super(options); this.element = new OperationsElement(); - this.specPath = always(['document', 'objects', 'Operation']); + this.element.classes.push('operations'); + this.specPath = (element: unknown) => { + return isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Operation']; + }; + this.canSupportSpecificationExtensions = false; + // @ts-ignore + this.fieldPatternPredicate = test(/^[A-Za-z0-9_-]+$/); } + ObjectElement(objectElement: ObjectElement) { + const result = PatternedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + + // @ts-ignore + this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { + referenceElement.setMetaProperty('referenced-element', 'operation'); + }); + + return result; + } } export default OperationsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts index faaf49ce14..97c715390a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts @@ -1,3 +1,4 @@ +import { ObjectElement } from '@swagger-api/apidom-core'; import { specificationObj as AsyncApi2Specification, SchemaVisitorOptions, @@ -5,6 +6,7 @@ import { } from '@swagger-api/apidom-ns-asyncapi-2'; import SchemaElement from '../../../../elements/Schema.ts'; +import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; export const BaseSchemaVisitor: typeof SchemaVisitorType = AsyncApi2Specification.visitors.document.objects.Schema.$visitor; @@ -12,12 +14,18 @@ export const BaseSchemaVisitor: typeof SchemaVisitorType = export type { SchemaVisitorOptions }; class SchemaVisitor extends BaseSchemaVisitor { - declare public readonly element: SchemaElement; + declare public element: SchemaElement; constructor(options: SchemaVisitorOptions) { super(options); this.element = new SchemaElement(); } + + ObjectElement(objectElement: ObjectElement) { + this.element = new SchemaElement(); + + return FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + } } export default SchemaVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts new file mode 100644 index 0000000000..af4eb50e55 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts @@ -0,0 +1,43 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, isStringElement, BREAK, cloneDeep } from '@swagger-api/apidom-core'; + +import SecuritySchemeScopes from '../../../../elements/nces/SecuritySchemeScopes.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface ScopesVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class ScopesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: SecuritySchemeScopes; + + constructor(options: ScopesVisitorOptions) { + super(options); + this.element = new SecuritySchemeScopes(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + const element = cloneDeep(item); + + if (isStringElement(element)) { + element.classes.push('scope-name'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default ScopesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts new file mode 100644 index 0000000000..8f5dd8f8e4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts @@ -0,0 +1,47 @@ +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import ServerSecurityElement from '../../../../elements/nces/ServerSecurity.ts'; + +/** + * @public + */ +export interface SecurityVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class SecurityVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { + declare public readonly element: ServerSecurityElement; + + constructor(options: SecurityVisitorOptions) { + super(options); + this.element = new ServerSecurityElement(); + } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + let element; + + if (isReferenceLikeElement(item)) { + element = this.toRefractedElement(['document', 'objects', 'Reference'], item); + element.setMetaProperty('referenced-element', 'serverSecurity'); + } else { + element = this.toRefractedElement(['document', 'objects', 'SecurityScheme'], item); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +export default SecurityVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts index aef1aab6ef..46029cd0d1 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts @@ -23,7 +23,8 @@ class ServersVisitor extends BaseServersVisitor { constructor(options: ServersVisitorOptions) { super(options); this.element = new ServersElement(); + this.element.classes.push('servers'); } } -export default ServersVisitor; +export default ServersVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts index 16d97b58a7..b8802184db 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts @@ -1,29 +1,45 @@ -import { - specificationObj as AsyncApi2Specification, - TagsVisitor as TagsVisitorType, - TagsVisitorOptions -} from '@swagger-api/apidom-ns-asyncapi-2'; +import { Mixin } from 'ts-mixer'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; +import { isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import TagsElement from '../../../../elements/Tags.ts'; /** * @public */ -export const BaseTagsVisitor: typeof TagsVisitorType = - AsyncApi2Specification.visitors.document.objects.Tags.$visitor; - -export type { TagsVisitorOptions }; +export interface TagsVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} /** * @public */ -class TagsVisitor extends BaseTagsVisitor { +class TagsVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { declare public readonly element: TagsElement; constructor(options: TagsVisitorOptions) { super(options); this.element = new TagsElement(); } + + ArrayElement(arrayElement: ArrayElement) { + arrayElement.forEach((item: Element) => { + let element; + + if (isReferenceLikeElement(item)) { + element = this.toRefractedElement(['document', 'objects', 'Reference'], item); + element.setMetaProperty('referenced-element', 'tag'); + } else { + element = this.toRefractedElement(['document', 'objects', 'Tag'], item); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } } -export default TagsVisitor; +export default TagsVisitor; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts index be3fee11c9..cc1f5fb549 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts @@ -1,12 +1,11 @@ import { Mixin } from 'ts-mixer'; -import { ObjectElement, BREAK } from '@swagger-api/apidom-core'; -import ExternalDocumentationElement from '../../../elements/ExternalDocumentation.ts'; -import ReferenceElement from '../../../elements/Reference.ts'; -import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; +import { ObjectElement } from '@swagger-api/apidom-core'; +import { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; -import { isReferenceElement, isReferenceLikeElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor from './AlternatingVisitor.ts'; import { T as stubTrue } from 'ramda'; +import { isReferenceLikeElement } from '../../predicates.ts'; export interface ExternalDocumentationVisitorOptions extends SpecificationVisitorOptions, diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/registration.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/registration.ts new file mode 100644 index 0000000000..c1a4e0cf1b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/registration.ts @@ -0,0 +1,1230 @@ +import { createRefractor } from './index.ts'; +/** + * AsyncApi 3.0.0 specification elements. + */ +import AsyncApi3Element from '../elements/AsyncApi3.ts'; +import AsyncApiVersionElement from '../elements/AsyncApiVersion.ts'; +import ChannelBindingsElement from '../elements/ChannelBindings.ts'; +import ChannelElement from '../elements/Channel.ts'; +import ChannelsElement from '../elements/Channels.ts'; +import ComponentsElement from '../elements/Components.ts'; +import ContactElement from '../elements/Contact.ts'; +import CorrelationIDElement from '../elements/CorrelationID.ts'; +import DefaultContentTypeElement from '../elements/DefaultContentType.ts'; +import ExternalDocumentationElement from '../elements/ExternalDocumentation.ts'; +import IdentifierElement from '../elements/Identifier.ts'; +import InfoElement from '../elements/Info.ts'; +import LicenseElement from '../elements/License.ts'; +import MessageElement from '../elements/Message.ts'; +import MessageBindingsElement from '../elements/MessageBindings.ts'; +import MessageExampleElement from '../elements/MessageExample.ts'; +import MessageTraitElement from '../elements/MessageTrait.ts'; +import MessagesElement from '../elements/Messages.ts'; +import MultiFormatSchemaElement from '../elements/MultiFormatSchema.ts'; +import OAuthFlowElement from '../elements/OauthFlow.ts'; +import OAuthFlowsElement from '../elements/OauthFlows.ts'; +import OperationElement from '../elements/Operation.ts'; +import OperationBindingsElement from '../elements/OperationBindings.ts'; +import OperationReplyElement from '../elements/OperationReply.ts'; +import OperationReplyAddressElement from '../elements/OperationReplyAddress.ts'; +import OperationTraitElement from '../elements/OperationTrait.ts'; +import OperationsElement from '../elements/Operations.ts'; +import ParameterElement from '../elements/Parameter.ts'; +import ParametersElement from '../elements/Parameters.ts'; +import ReferenceElement from '../elements/Reference.ts'; +import SchemaElement from '../elements/Schema.ts'; +import SecuritySchemeElement from '../elements/SecurityScheme.ts'; +import ServerElement from '../elements/Server.ts'; +import ServerBindingsElement from '../elements/ServerBindings.ts'; +import ServersElement from '../elements/Servers.ts'; +import ServerVariableElement from '../elements/ServerVariable.ts'; +import TagElement from '../elements/Tag.ts'; +import TagsElement from '../elements/Tags.ts'; +/** + * Binding elements. + */ +// AMQP 0-9-1 +import AmqpChannelBindingElement from '../elements/bindings/amqp/AmqpChannelBinding.ts'; +import AmqpMessageBindingElement from '../elements/bindings/amqp/AmqpMessageBinding.ts'; +import AmqpOperationBindingElement from '../elements/bindings/amqp/AmqpOperationBinding.ts'; +import AmqpServerBindingElement from '../elements/bindings/amqp/AmqpServerBinding.ts'; +// AMQP 1.0 +import Amqp1ChannelBindingElement from '../elements/bindings/amqp1/Amqp1ChannelBinding.ts'; +import Amqp1MessageBindingElement from '../elements/bindings/amqp1/Amqp1MessageBinding.ts'; +import Amqp1OperationBindingElement from '../elements/bindings/amqp1/Amqp1OperationBinding.ts'; +import Amqp1ServerBindingElement from '../elements/bindings/amqp1/Amqp1ServerBinding.ts'; +// Anypoint MQ +import AnypointmqChannelBindingElement from '../elements/bindings/anypointmq/AnypointmqChannelBinding.ts'; +import AnypointmqMessageBindingElement from '../elements/bindings/anypointmq/AnypointmqMessageBinding.ts'; +import AnypointmqOperationBindingElement from '../elements/bindings/anypointmq/AnypointmqOperationBinding.ts'; +import AnypointmqServerBindingElement from '../elements/bindings/anypointmq/AnypointmqServerBinding.ts'; +// HTTP +import HttpChannelBindingElement from '../elements/bindings/http/HttpChannelBinding.ts'; +import HttpMessageBindingElement from '../elements/bindings/http/HttpMessageBinding.ts'; +import HttpOperationBindingElement from '../elements/bindings/http/HttpOperationBinding.ts'; +import HttpServerBindingElement from '../elements/bindings/http/HttpServerBinding.ts'; +// Google Cloud Pub/Sub +import GooglepubsubChannelBindingElement from '../elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts'; +import GooglepubsubMessageBindingElement from '../elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts'; +import GooglepubsubOperationBindingElement from '../elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts'; +import GooglepubsubServerBindingElement from '../elements/bindings/googlepubsub/GooglepubsubServerBinding.ts'; +// IBM MQ +import IbmmqChannelBindingElement from '../elements/bindings/ibmmq/IbmmqChannelBinding.ts'; +import IbmmqMessageBindingElement from '../elements/bindings/ibmmq/IbmmqMessageBinding.ts'; +import IbmmqOperationBindingElement from '../elements/bindings/ibmmq/IbmmqOperationBinding.ts'; +import IbmmqServerBindingElement from '../elements/bindings/ibmmq/IbmmqServerBinding.ts'; +// JMS +import JmsChannelBindingElement from '../elements/bindings/jms/JmsChannelBinding.ts'; +import JmsMessageBindingElement from '../elements/bindings/jms/JmsMessageBinding.ts'; +import JmsOperationBindingElement from '../elements/bindings/jms/JmsOperationBinding.ts'; +import JmsServerBindingElement from '../elements/bindings/jms/JmsServerBinding.ts'; +// Kafka +import KafkaChannelBindingElement from '../elements/bindings/kafka/KafkaChannelBinding.ts'; +import KafkaMessageBindingElement from '../elements/bindings/kafka/KafkaMessageBinding.ts'; +import KafkaOperationBindingElement from '../elements/bindings/kafka/KafkaOperationBinding.ts'; +import KafkaServerBindingElement from '../elements/bindings/kafka/KafkaServerBinding.ts'; +// Mercure +import MercureChannelBindingElement from '../elements/bindings/mercure/MercureChannelBinding.ts'; +import MercureMessageBindingElement from '../elements/bindings/mercure/MercureMessageBinding.ts'; +import MercureOperationBindingElement from '../elements/bindings/mercure/MercureOperationBinding.ts'; +import MercureServerBindingElement from '../elements/bindings/mercure/MercureServerBinding.ts'; +// MQTT +import MqttChannelBindingElement from '../elements/bindings/mqtt/MqttChannelBinding.ts'; +import MqttMessageBindingElement from '../elements/bindings/mqtt/MqttMessageBinding.ts'; +import MqttOperationBindingElement from '../elements/bindings/mqtt/MqttOperationBinding.ts'; +import MqttServerBindingElement from '../elements/bindings/mqtt/MqttServerBinding.ts'; +// MQTT 5 +import Mqtt5ChannelBindingElement from '../elements/bindings/mqtt5/Mqtt5ChannelBinding.ts'; +import Mqtt5MessageBindingElement from '../elements/bindings/mqtt5/Mqtt5MessageBinding.ts'; +import Mqtt5OperationBindingElement from '../elements/bindings/mqtt5/Mqtt5OperationBinding.ts'; +import Mqtt5ServerBindingElement from '../elements/bindings/mqtt5/Mqtt5ServerBinding.ts'; +// NATS +import NatsChannelBindingElement from '../elements/bindings/nats/NatsChannelBinding.ts'; +import NatsMessageBindingElement from '../elements/bindings/nats/NatsMessageBinding.ts'; +import NatsOperationBindingElement from '../elements/bindings/nats/NatsOperationBinding.ts'; +import NatsServerBindingElement from '../elements/bindings/nats/NatsServerBinding.ts'; +// Pulsar +import PulsarChannelBindingElement from '../elements/bindings/pulsar/PulsarChannelBinding.ts'; +import PulsarMessageBindingElement from '../elements/bindings/pulsar/PulsarMessageBinding.ts'; +import PulsarOperationBindingElement from '../elements/bindings/pulsar/PulsarOperationBinding.ts'; +import PulsarServerBindingElement from '../elements/bindings/pulsar/PulsarServerBinding.ts'; +// Redis +import RedisChannelBindingElement from '../elements/bindings/redis/RedisChannelBinding.ts'; +import RedisMessageBindingElement from '../elements/bindings/redis/RedisMessageBinding.ts'; +import RedisOperationBindingElement from '../elements/bindings/redis/RedisOperationBinding.ts'; +import RedisServerBindingElement from '../elements/bindings/redis/RedisServerBinding.ts'; +// SNS +import SnsChannelBindingElement from '../elements/bindings/sns/SnsChannelBinding.ts'; +import SnsMessageBindingElement from '../elements/bindings/sns/SnsMessageBinding.ts'; +import SnsOperationBindingElement from '../elements/bindings/sns/SnsOperationBinding.ts'; +import SnsServerBindingElement from '../elements/bindings/sns/SnsServerBinding.ts'; +// Solace +import SolaceChannelBindingElement from '../elements/bindings/solace/SolaceChannelBinding.ts'; +import SolaceMessageBindingElement from '../elements/bindings/solace/SolaceMessageBinding.ts'; +import SolaceOperationBindingElement from '../elements/bindings/solace/SolaceOperationBinding.ts'; +import SolaceServerBindingElement from '../elements/bindings/solace/SolaceServerBinding.ts'; +// SQS +import SqsChannelBindingElement from '../elements/bindings/sqs/SqsChannelBinding.ts'; +import SqsMessageBindingElement from '../elements/bindings/sqs/SqsMessageBinding.ts'; +import SqsOperationBindingElement from '../elements/bindings/sqs/SqsOperationBinding.ts'; +import SqsServerBindingElement from '../elements/bindings/sqs/SqsServerBinding.ts'; +// STOMP +import StompChannelBindingElement from '../elements/bindings/stomp/StompChannelBinding.ts'; +import StompMessageBindingElement from '../elements/bindings/stomp/StompMessageBinding.ts'; +import StompOperationBindingElement from '../elements/bindings/stomp/StompOperationBinding.ts'; +import StompServerBindingElement from '../elements/bindings/stomp/StompServerBinding.ts'; +// WebSocket +import WebSocketChannelBindingElement from '../elements/bindings/ws/WebSocketChannelBinding.ts'; +import WebSocketMessageBindingElement from '../elements/bindings/ws/WebSocketMessageBinding.ts'; +import WebSocketOperationBindingElement from '../elements/bindings/ws/WebSocketOperationBinding.ts'; +import WebSocketServerBindingElement from '../elements/bindings/ws/WebSocketServerBinding.ts'; + +/** + * AsyncApi 3.0.0 specification elements. + */ +AsyncApi3Element.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'AsyncApi', + '$visitor', +]); +AsyncApiVersionElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'AsyncApiVersion', + '$visitor', +]); +ChannelBindingsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'ChannelBindings', + '$visitor', +]); +ChannelElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Channel', + '$visitor', +]); +ChannelsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Channels', + '$visitor', +]); +ComponentsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Components', + '$visitor', +]); +ContactElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Contact', + '$visitor', +]); +CorrelationIDElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'CorrelationID', + '$visitor', +]); +DefaultContentTypeElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'DefaultContentType', + '$visitor', +]); +ExternalDocumentationElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'ExternalDocumentation', + '$visitor', +]); +IdentifierElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Identifier', + '$visitor', +]); +InfoElement.refract = createRefractor(['visitors', 'document', 'objects', 'Info', '$visitor']); +LicenseElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'License', + '$visitor', +]); +MessageElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Message', + '$visitor', +]); +MessageBindingsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'MessageBindings', + '$visitor', +]); +MessageExampleElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'MessageExample', + '$visitor', +]); +MessageTraitElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'MessageTrait', + '$visitor', +]); +MessagesElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Messages', + '$visitor', +]); +MultiFormatSchemaElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'MultiFormatSchema', + '$visitor', +]); +OAuthFlowElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'OAuthFlow', + '$visitor', +]); +OAuthFlowsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'OAuthFlows', + '$visitor', +]); +OperationElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Operation', + '$visitor', +]); +OperationBindingsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'OperationBindings', + '$visitor', +]); +OperationReplyElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'OperationReply', + '$visitor', +]); +OperationReplyAddressElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'OperationReplyAddress', + '$visitor', +]); +OperationTraitElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'OperationTrait', + '$visitor', +]); +OperationsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Operations', + '$visitor', +]); +ParameterElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Parameter', + '$visitor', +]); +ParametersElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Parameters', + '$visitor', +]); +ReferenceElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Reference', + '$visitor', +]); +SchemaElement.refract = createRefractor(['visitors', 'document', 'objects', 'Schema', '$visitor']); +SecuritySchemeElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'SecurityScheme', + '$visitor', +]); +ServerElement.refract = createRefractor(['visitors', 'document', 'objects', 'Server', '$visitor']); +ServerBindingsElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'ServerBindings', + '$visitor', +]); +ServersElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'Servers', + '$visitor', +]); +ServerVariableElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'ServerVariable', + '$visitor', +]); +TagElement.refract = createRefractor(['visitors', 'document', 'objects', 'Tag', '$visitor']); +TagsElement.refract = createRefractor(['visitors', 'document', 'objects', 'Tags', '$visitor']); + +/** + * Binding elements. + */ +// AMQP 0-9-1 +AmqpChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp', + 'ChannelBinding', + '$visitor', +]); +AmqpMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp', + 'MessageBinding', + '$visitor', +]); +AmqpOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp', + 'OperationBinding', + '$visitor', +]); +AmqpServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp', + 'ServerBinding', + '$visitor', +]); +// AMQP 1.0 +Amqp1ChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp1', + 'ChannelBinding', + '$visitor', +]); +Amqp1MessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp1', + 'MessageBinding', + '$visitor', +]); +Amqp1OperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp1', + 'OperationBinding', + '$visitor', +]); +Amqp1ServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'amqp1', + 'ServerBinding', + '$visitor', +]); +// HTTP +HttpChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'http', + 'ChannelBinding', + '$visitor', +]); +HttpMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'http', + 'MessageBinding', + '$visitor', +]); +HttpOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'http', + 'OperationBinding', + '$visitor', +]); +HttpServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'http', + 'ServerBinding', + '$visitor', +]); +// Google Cloud Pub/Sub +GooglepubsubChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'googlepubsub', + 'ChannelBinding', + '$visitor', +]); +GooglepubsubMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'googlepubsub', + 'MessageBinding', + '$visitor', +]); +GooglepubsubOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'googlepubsub', + 'OperationBinding', + '$visitor', +]); +GooglepubsubServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'googlepubsub', + 'ServerBinding', + '$visitor', +]); +// IBM MQ +IbmmqChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ibmmq', + 'ChannelBinding', + '$visitor', +]); +IbmmqMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ibmmq', + 'MessageBinding', + '$visitor', +]); +IbmmqOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ibmmq', + 'OperationBinding', + '$visitor', +]); +IbmmqServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ibmmq', + 'ServerBinding', + '$visitor', +]); +// JMS +JmsChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'jms', + 'ChannelBinding', + '$visitor', +]); +JmsMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'jms', + 'MessageBinding', + '$visitor', +]); +JmsOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'jms', + 'OperationBinding', + '$visitor', +]); +JmsServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'jms', + 'ServerBinding', + '$visitor', +]); +// Kafka +KafkaChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'kafka', + 'ChannelBinding', + '$visitor', +]); +KafkaMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'kafka', + 'MessageBinding', + '$visitor', +]); +KafkaOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'kafka', + 'OperationBinding', + '$visitor', +]); +KafkaServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'kafka', + 'ServerBinding', + '$visitor', +]); +// Anypoint MQ +AnypointmqChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'anypointmq', + 'ChannelBinding', + '$visitor', +]); +AnypointmqMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'anypointmq', + 'MessageBinding', + '$visitor', +]); +AnypointmqOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'anypointmq', + 'OperationBinding', + '$visitor', +]); +AnypointmqServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'anypointmq', + 'ServerBinding', + '$visitor', +]); +// Mercure +MercureChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mercure', + 'ChannelBinding', + '$visitor', +]); +MercureMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mercure', + 'MessageBinding', + '$visitor', +]); +MercureOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mercure', + 'OperationBinding', + '$visitor', +]); +MercureServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mercure', + 'ServerBinding', + '$visitor', +]); +// MQTT +MqttChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt', + 'ChannelBinding', + '$visitor', +]); +MqttMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt', + 'MessageBinding', + '$visitor', +]); +MqttOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt', + 'OperationBinding', + '$visitor', +]); +MqttServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt', + 'ServerBinding', + '$visitor', +]); +// MQTT 5 +Mqtt5ChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt5', + 'ChannelBinding', + '$visitor', +]); +Mqtt5MessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt5', + 'MessageBinding', + '$visitor', +]); +Mqtt5OperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt5', + 'OperationBinding', + '$visitor', +]); +Mqtt5ServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'mqtt5', + 'ServerBinding', + '$visitor', +]); +// NATS +NatsChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'nats', + 'ChannelBinding', + '$visitor', +]); +NatsMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'nats', + 'MessageBinding', + '$visitor', +]); +NatsOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'nats', + 'OperationBinding', + '$visitor', +]); +NatsServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'nats', + 'ServerBinding', + '$visitor', +]); +// Pulsar +PulsarChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'pulsar', + 'ChannelBinding', + '$visitor', +]); +PulsarMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'pulsar', + 'MessageBinding', + '$visitor', +]); +PulsarOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'pulsar', + 'OperationBinding', + '$visitor', +]); +PulsarServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'pulsar', + 'ServerBinding', + '$visitor', +]); +// Redis +RedisChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'redis', + 'ChannelBinding', + '$visitor', +]); +RedisMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'redis', + 'MessageBinding', + '$visitor', +]); +RedisOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'redis', + 'OperationBinding', + '$visitor', +]); +RedisServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'redis', + 'ServerBinding', + '$visitor', +]); +// SNS +SnsChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sns', + 'ChannelBinding', + '$visitor', +]); +SnsMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sns', + 'MessageBinding', + '$visitor', +]); +SnsOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sns', + 'OperationBinding', + '$visitor', +]); +SnsServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sns', + 'ServerBinding', + '$visitor', +]); +// Solace +SolaceChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'solace', + 'ChannelBinding', + '$visitor', +]); +SolaceMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'solace', + 'MessageBinding', + '$visitor', +]); +SolaceOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'solace', + 'OperationBinding', + '$visitor', +]); +SolaceServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'solace', + 'ServerBinding', + '$visitor', +]); +// SQS +SqsChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sqs', + 'ChannelBinding', + '$visitor', +]); +SqsMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sqs', + 'MessageBinding', + '$visitor', +]); +SqsOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sqs', + 'OperationBinding', + '$visitor', +]); +SqsServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'sqs', + 'ServerBinding', + '$visitor', +]); +// STOMP +StompChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'stomp', + 'ChannelBinding', + '$visitor', +]); +StompMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'stomp', + 'MessageBinding', + '$visitor', +]); +StompOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'stomp', + 'OperationBinding', + '$visitor', +]); +StompServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'stomp', + 'ServerBinding', + '$visitor', +]); +// WebSocket +WebSocketChannelBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ws', + 'ChannelBinding', + '$visitor', +]); +WebSocketMessageBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ws', + 'MessageBinding', + '$visitor', +]); +WebSocketOperationBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ws', + 'OperationBinding', + '$visitor', +]); +WebSocketServerBindingElement.refract = createRefractor([ + 'visitors', + 'document', + 'objects', + 'bindings', + 'ws', + 'ServerBinding', + '$visitor', +]); + +export { + /** + * AsyncApi 3.0.0 specification elements. + */ + AsyncApi3Element, + AsyncApiVersionElement, + ChannelBindingsElement, + ChannelElement, + ChannelsElement, + ComponentsElement, + ContactElement, + CorrelationIDElement, + DefaultContentTypeElement, + ExternalDocumentationElement, + IdentifierElement, + InfoElement, + LicenseElement, + MessageElement, + MessageBindingsElement, + MessageExampleElement, + MessageTraitElement, + MessagesElement, + MultiFormatSchemaElement, + OAuthFlowElement, + OAuthFlowsElement, + OperationElement, + OperationBindingsElement, + OperationReplyElement, + OperationReplyAddressElement, + OperationTraitElement, + OperationsElement, + ParameterElement, + ParametersElement, + ReferenceElement, + SchemaElement, + SecuritySchemeElement, + ServerElement, + ServerBindingsElement, + ServersElement, + ServerVariableElement, + TagElement, + TagsElement, + /** + * Binding elements. + */ + // AMQP 0-9-1 + AmqpChannelBindingElement, + AmqpMessageBindingElement, + AmqpOperationBindingElement, + AmqpServerBindingElement, + // AMQP 1.0 + Amqp1ChannelBindingElement, + Amqp1MessageBindingElement, + Amqp1OperationBindingElement, + Amqp1ServerBindingElement, + // Anypoint MQ + AnypointmqChannelBindingElement, + AnypointmqMessageBindingElement, + AnypointmqOperationBindingElement, + AnypointmqServerBindingElement, + // Google Cloud Pub/Sub + GooglepubsubChannelBindingElement, + GooglepubsubMessageBindingElement, + GooglepubsubOperationBindingElement, + GooglepubsubServerBindingElement, + + // HTTP + HttpChannelBindingElement, + HttpMessageBindingElement, + HttpOperationBindingElement, + HttpServerBindingElement, + // IBM MQ + IbmmqChannelBindingElement, + IbmmqMessageBindingElement, + IbmmqOperationBindingElement, + IbmmqServerBindingElement, + // JMS + JmsChannelBindingElement, + JmsMessageBindingElement, + JmsOperationBindingElement, + JmsServerBindingElement, + // Kafka + KafkaChannelBindingElement, + KafkaMessageBindingElement, + KafkaOperationBindingElement, + KafkaServerBindingElement, + // Mercure + MercureChannelBindingElement, + MercureMessageBindingElement, + MercureOperationBindingElement, + MercureServerBindingElement, + // MQTT + MqttChannelBindingElement, + MqttMessageBindingElement, + MqttOperationBindingElement, + MqttServerBindingElement, + // MQTT 5 + Mqtt5ChannelBindingElement, + Mqtt5MessageBindingElement, + Mqtt5OperationBindingElement, + Mqtt5ServerBindingElement, + // NATS + NatsChannelBindingElement, + NatsMessageBindingElement, + NatsOperationBindingElement, + NatsServerBindingElement, + // Pulsar + PulsarChannelBindingElement, + PulsarMessageBindingElement, + PulsarOperationBindingElement, + PulsarServerBindingElement, + // Redis + RedisChannelBindingElement, + RedisMessageBindingElement, + RedisOperationBindingElement, + RedisServerBindingElement, + // SNS + SnsChannelBindingElement, + SnsMessageBindingElement, + SnsOperationBindingElement, + SnsServerBindingElement, + // Solace + SolaceChannelBindingElement, + SolaceMessageBindingElement, + SolaceOperationBindingElement, + SolaceServerBindingElement, + // SQS + SqsChannelBindingElement, + SqsMessageBindingElement, + SqsOperationBindingElement, + SqsServerBindingElement, + // STOMP + StompChannelBindingElement, + StompMessageBindingElement, + StompOperationBindingElement, + StompServerBindingElement, + // WebSocket + WebSocketChannelBindingElement, + WebSocketMessageBindingElement, + WebSocketOperationBindingElement, + WebSocketServerBindingElement, +}; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts b/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts new file mode 100644 index 0000000000..756ba5def9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts @@ -0,0 +1,158 @@ +import { isElement, keyMap as keyMapBase, Element } from '@swagger-api/apidom-core'; + +/** + * @public + */ +export const getNodeType = (element: T): string | undefined => { + if (!isElement(element)) { + return undefined; + } + return `${element.element.charAt(0).toUpperCase() + element.element.slice(1)}Element`; +}; + +/** + * @public + */ +export const keyMap = { + AsyncApi3Element: ['content'], + AsyncApiVersionElement: [], + ChannelBindingsElement: ['content'], + ChannelElement: ['content'], + ChannelsElement: ['content'], + ChannelAddressExpressionsElement: ['content'], + ComponentsElement: ['content'], + ContactElement: ['content'], + CorrelationIDElement: ['content'], + DefaultContentTypeElement: [], + ExternalDocumentationElement: ['content'], + InfoElement: ['content'], + LicenseElement: ['content'], + MessagesElement: ['content'], + MessageElement: ['content'], + MessageExampleElement: ['content'], + MessageBindingsElement: ['content'], + MessageTraitElement: ['content'], + OAuthFlowElement: ['content'], + OAuthFlowsElement: ['content'], + OperationsElement: ['content'], + OperationElement: ['content'], + OperationBindingsElement: ['content'], + OperationTraitElement: ['content'], + ParameterElement: ['content'], + ParametersElement: ['content'], + ReferenceElement: ['content'], + SchemaElement: ['content'], + MultiFormatSchemaElement: ['content'], + SecurityRequirementElement: ['content'], + SecuritySchemeElement: ['content'], + ServerElement: ['content'], + ServerBindingsElement: ['content'], + ServersElement: ['content'], + ServerVariableElement: ['content'], + TagElement: ['content'], + TagsElement: ['content'], + + // operation-reply/address + OperationReplyElement: ['content'], + OperationReplyAddressElement: ['content'], + + /** + * Binding elements. + */ + // AMQP 0-9-1 + AmqpChannelBindingElement: ['content'], + AmqpMessageBindingElement: ['content'], + AmqpOperationBindingElement: ['content'], + AmqpServerBindingElement: ['content'], + // AMQP 1.0 + Amqp1ChannelBindingElement: ['content'], + Amqp1MessageBindingElement: ['content'], + Amqp1OperationBindingElement: ['content'], + Amqp1ServerBindingElement: ['content'], + // Anypoint MQ + AnypointmqChannelBindingElement: ['content'], + AnypointmqMessageBindingElement: ['content'], + AnypointmqOperationBindingElement: ['content'], + AnypointmqServerBindingElement: ['content'], + // Google Cloud Pub/Sub Server Binding + GooglepubsubChannelBindingElement: ['content'], + GooglepubsubMessageBindingElement: ['content'], + GooglepubsubOperationBindingElement: ['content'], + GooglepubsubServerBindingElement: ['content'], + // HTTP + HttpChannelBindingElement: ['content'], + HttpMessageBindingElement: ['content'], + HttpOperationBindingElement: ['content'], + HttpServerBindingElement: ['content'], + // IBM MQ + IbmmqChannelBindingElement: ['content'], + IbmmqMessageBindingElement: ['content'], + IbmmqChannelOperationElement: ['content'], + IbmmqServerBindingElement: ['content'], + // JMS + JmsChannelBindingElement: ['content'], + JmsMessageBindingElement: ['content'], + JmsOperationBindingElement: ['content'], + JmsServerBindingElement: ['content'], + // Kafka + KafkaChannelBindingElement: ['content'], + KafkaMessageBindingElement: ['content'], + KafkaOperationBindingElement: ['content'], + KafkaServerBindingElement: ['content'], + // Mercure + MercureChannelBindingElement: ['content'], + MercureMessageBindingElement: ['content'], + MercureOperationBindingElement: ['content'], + MercureServerBindingElement: ['content'], + // MQTT + MqttChannelBindingElement: ['content'], + MqttMessageBindingElement: ['content'], + MqttOperationBindingElement: ['content'], + MqttServerBindingElement: ['content'], + // MQTT 5 + Mqtt5ChannelBindingElement: ['content'], + Mqtt5MessageBindingElement: ['content'], + Mqtt5OperationBindingElement: ['content'], + Mqtt5ServerBindingElement: ['content'], + // NATS + NatsChannelBindingElement: ['content'], + NatsMessageBindingElement: ['content'], + NatsOperationBindingElement: ['content'], + NatsServerBindingElement: ['content'], + // Pulsar + PulsarChannelBindingElement: ['content'], + PulsarMessageBindingElement: ['content'], + PulsarOperationBindingElement: ['content'], + PulsarServerBindingElement: ['content'], + // Redis + RedisChannelBindingElement: ['content'], + RedisMessageBindingElement: ['content'], + RedisOperationBindingElement: ['content'], + RedisServerBindingElement: ['content'], + // SNS + SnsChannelBindingElement: ['content'], + SnsMessageBindingElement: ['content'], + SnsOperationBindingElement: ['content'], + SnsServerBindingElement: ['content'], + // Solace + SolaceChannelBindingElement: ['content'], + SolaceMessageBindingElement: ['content'], + SolaceOperationBindingElement: ['content'], + SolaceServerBindingElement: ['content'], + // SQS + SqsChannelBindingElement: ['content'], + SqsMessageBindingElement: ['content'], + SqsOperationBindingElement: ['content'], + SqsServerBindingElement: ['content'], + // STOMP + StompChannelBindingElement: ['content'], + StompMessageBindingElement: ['content'], + StompOperationBindingElement: ['content'], + StompServerBindingElement: ['content'], + // WebSocket + WebSocketChannelBindingElement: ['content'], + WebSocketMessageBindingElement: ['content'], + WebSocketOperationBindingElement: ['content'], + WebSocketServerBindingElement: ['content'], + ...keyMapBase, +}; From 172a53719d26191a7d452ef81b6c41dd4abaa7b8 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Tue, 4 Nov 2025 16:38:20 +0530 Subject: [PATCH 20/27] feat: update namespace and public tags --- package-lock.json | 18 + .../src/elements/OauthFlow.ts | 3 + .../src/elements/OauthFlows.ts | 3 + .../src/elements/SecurityScheme.ts | 3 + .../src/elements/ServerBindings.ts | 3 + .../src/elements/Servers.ts | 3 + .../apidom-ns-asyncapi-3/src/elements/Tag.ts | 5 +- .../bindings/amqp/AmqpChannelBinding.ts | 3 + .../bindings/amqp/AmqpMessageBinding.ts | 3 + .../bindings/amqp/AmqpOperationBinding.ts | 3 + .../bindings/amqp/AmqpServerBinding.ts | 3 + .../bindings/amqp1/Amqp1ChannelBinding.ts | 3 + .../bindings/amqp1/Amqp1MessageBinding.ts | 3 + .../bindings/amqp1/Amqp1OperationBinding.ts | 3 + .../bindings/amqp1/Amqp1ServerBinding.ts | 3 + .../anypointmq/AnypointmqChannelBinding.ts | 3 + .../anypointmq/AnypointmqMessageBinding.ts | 3 + .../anypointmq/AnypointmqOperationBinding.ts | 3 + .../anypointmq/AnypointmqServerBinding.ts | 3 + .../GooglepubsubChannelBinding.ts | 3 + .../GooglepubsubMessageBinding.ts | 3 + .../GooglepubsubOperationBinding.ts | 3 + .../googlepubsub/GooglepubsubServerBinding.ts | 3 + .../bindings/http/HttpChannelBinding.ts | 3 + .../bindings/http/HttpMessageBinding.ts | 3 + .../bindings/http/HttpOperationBinding.ts | 3 + .../bindings/http/HttpServerBinding.ts | 3 + .../bindings/ibmmq/IbmmqChannelBinding.ts | 3 + .../bindings/ibmmq/IbmmqMessageBinding.ts | 3 + .../bindings/ibmmq/IbmmqOperationBinding.ts | 3 + .../bindings/ibmmq/IbmmqServerBinding.ts | 3 + .../bindings/jms/JmsChannelBinding.ts | 3 + .../bindings/jms/JmsMessageBinding.ts | 3 + .../bindings/jms/JmsOperationBinding.ts | 3 + .../elements/bindings/jms/JmsServerBinding.ts | 3 + .../bindings/kafka/KafkaChannelBinding.ts | 3 + .../bindings/kafka/KafkaMessageBinding.ts | 3 + .../bindings/kafka/KafkaOperationBinding.ts | 3 + .../bindings/kafka/KafkaServerBinding.ts | 3 + .../bindings/mercure/MercureChannelBinding.ts | 3 + .../bindings/mercure/MercureMessageBinding.ts | 3 + .../mercure/MercureOperationBinding.ts | 3 + .../bindings/mercure/MercureServerBinding.ts | 3 + .../bindings/mqtt/MqttChannelBinding.ts | 3 + .../bindings/mqtt/MqttMessageBinding.ts | 3 + .../bindings/mqtt/MqttOperationBinding.ts | 3 + .../bindings/mqtt/MqttServerBinding.ts | 3 + .../bindings/mqtt5/Mqtt5ChannelBinding.ts | 3 + .../bindings/mqtt5/Mqtt5MessageBinding.ts | 3 + .../bindings/mqtt5/Mqtt5OperationBinding.ts | 3 + .../bindings/mqtt5/Mqtt5ServerBinding.ts | 3 + .../bindings/nats/NatsChannelBinding.ts | 3 + .../bindings/nats/NatsMessageBinding.ts | 3 + .../bindings/nats/NatsOperationBinding.ts | 3 + .../bindings/nats/NatsServerBinding.ts | 3 + .../bindings/pulsar/PulsarChannelBinding.ts | 3 + .../bindings/pulsar/PulsarMessageBinding.ts | 3 + .../bindings/pulsar/PulsarOperationBinding.ts | 3 + .../bindings/pulsar/PulsarServerBinding.ts | 3 + .../bindings/redis/RedisChannelBinding.ts | 3 + .../bindings/redis/RedisMessageBinding.ts | 3 + .../bindings/redis/RedisOperationBinding.ts | 3 + .../bindings/redis/RedisServerBinding.ts | 3 + .../bindings/sns/SnsChannelBinding.ts | 3 + .../bindings/sns/SnsMessageBinding.ts | 3 + .../bindings/sns/SnsOperationBinding.ts | 3 + .../elements/bindings/sns/SnsServerBinding.ts | 3 + .../bindings/solace/SolaceChannelBinding.ts | 3 + .../bindings/solace/SolaceMessageBinding.ts | 3 + .../bindings/solace/SolaceOperationBinding.ts | 3 + .../bindings/solace/SolaceServerBinding.ts | 3 + .../bindings/sqs/SqsChannelBinding.ts | 3 + .../bindings/sqs/SqsMessageBinding.ts | 3 + .../bindings/sqs/SqsOperationBinding.ts | 3 + .../elements/bindings/sqs/SqsServerBinding.ts | 3 + .../bindings/stomp/StompChannelBinding.ts | 3 + .../bindings/stomp/StompMessageBinding.ts | 3 + .../bindings/stomp/StompOperationBinding.ts | 3 + .../bindings/stomp/StompServerBinding.ts | 3 + .../bindings/ws/WebSocketChannelBinding.ts | 3 + .../bindings/ws/WebSocketMessageBinding.ts | 3 + .../bindings/ws/WebSocketOperationBinding.ts | 3 + .../bindings/ws/WebSocketServerBinding.ts | 3 + packages/apidom-ns-asyncapi-3/src/index.ts | 2 +- .../apidom-ns-asyncapi-3/src/media-types.ts | 9 + .../apidom-ns-asyncapi-3/src/namespace.ts | 289 ++++++- .../refractor/{visitors => }/registration.ts | 0 .../src/refractor/specification.ts | 732 +++++++++++++++++- .../visitors/async-api-3/channel/index.ts | 3 + .../visitors/async-api-3/components/index.ts | 3 + .../{RepliesVisitor.ts => repliesVisitor.ts} | 0 ...sesVisitor.ts => replyAddressesVisitor.ts} | 0 .../async-api-3/correlation-id/index.ts | 3 + .../external-documentation-object/index.ts | 3 + .../visitors/async-api-3/info/info.ts | 3 + .../async-api-3/message-bindings/index.ts | 3 + .../async-api-3/message-example/index.ts | 3 + .../async-api-3/message-trait/index.ts | 3 + .../async-api-3/operation-bindings/index.ts | 3 + .../operation-reply-address/index.ts | 3 + .../operation-reply/MessagesVisitor.ts | 3 + .../async-api-3/operation-reply/index.ts | 3 + .../async-api-3/operation-trait/index.ts | 3 + .../visitors/async-api-3/parameters/index.ts | 3 + .../visitors/async-api-3/schema/index.ts | 3 + .../async-api-3/security-scheme/index.ts | 3 + .../async-api-3/server-bindings/index.ts | 3 + .../generics/ExternalDocumentationVisitor.ts | 3 + 108 files changed, 1317 insertions(+), 35 deletions(-) rename packages/apidom-ns-asyncapi-3/src/refractor/{visitors => }/registration.ts (100%) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/{RepliesVisitor.ts => repliesVisitor.ts} (100%) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/{ReplyAddressesVisitor.ts => replyAddressesVisitor.ts} (100%) diff --git a/package-lock.json b/package-lock.json index cf1e51565c..8a56905d23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6876,6 +6876,10 @@ "resolved": "packages/apidom-ns-asyncapi-2", "link": true }, + "node_modules/@swagger-api/apidom-ns-asyncapi-3": { + "resolved": "packages/apidom-ns-asyncapi-3", + "link": true + }, "node_modules/@swagger-api/apidom-ns-json-schema-2019-09": { "resolved": "packages/apidom-ns-json-schema-2019-09", "link": true @@ -26065,6 +26069,20 @@ "ts-mixer": "^6.0.3" } }, + "packages/apidom-ns-asyncapi-3": { + "name": "@swagger-api/apidom-ns-asyncapi-3", + "version": "1.0.0-beta.0", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.0.0-beta.51", + "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-beta.51", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, "packages/apidom-ns-json-schema-2019-09": { "name": "@swagger-api/apidom-ns-json-schema-2019-09", "version": "1.0.0-rc.1", diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts index 82cb20311b..3f5c609090 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts @@ -2,6 +2,9 @@ import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; import { UnsupportedOperationError } from '@swagger-api/apidom-error'; import { OAuthFlowElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class OAuthFlow extends OAuthFlowElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts index c5b82199e9..271d6c7541 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts @@ -1,5 +1,8 @@ import { OAuthFlowsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class OAuthFlows extends OAuthFlowsElement {} export default OAuthFlows; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts index b5385fbf17..f420ea0d52 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts @@ -2,6 +2,9 @@ import { Attributes, Meta } from '@swagger-api/apidom-core'; import { SecuritySchemeElement } from '@swagger-api/apidom-ns-asyncapi-2'; import type { ArrayElement } from '@swagger-api/apidom-core'; +/** + * @public + */ class SecurityScheme extends SecuritySchemeElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts index ff258683f4..66f95bf51b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts @@ -1,5 +1,8 @@ import { ServerBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; +/** + * @public + */ class ServerBindings extends ServerBindingsElement {} export default ServerBindings; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts index e7b0024dbe..5174ee1d53 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts @@ -1,5 +1,8 @@ import { ServersElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Servers extends ServersElement {} export default Servers; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts index 9b3ee36e3b..a09ead1100 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts @@ -1,8 +1,11 @@ -import { ObjectElement, Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; +import { Attributes, Meta } from '@swagger-api/apidom-core'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; import { TagElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Tag extends TagElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts index 7bff41796e..b96603cbbe 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts @@ -1,5 +1,8 @@ import { AmqpChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AmqpChannelBinding extends AmqpChannelBindingElement {} export default AmqpChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts index 51693d5e83..133dceef58 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts @@ -1,5 +1,8 @@ import { AmqpMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AmqpMessageBinding extends AmqpMessageBindingElement {} export default AmqpMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts index b38ed27300..0a62ad64e8 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts @@ -1,5 +1,8 @@ import { AmqpOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AmqpOperationBinding extends AmqpOperationBindingElement {} export default AmqpOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts index c7e0856daf..9e99a5ea47 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts @@ -1,5 +1,8 @@ import { AmqpServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AmqpServerBinding extends AmqpServerBindingElement {} export default AmqpServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts index 5ff90666a0..63e911d1b4 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts @@ -1,5 +1,8 @@ import { Amqp1ChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Amqp1ChannelBinding extends Amqp1ChannelBindingElement {} export default Amqp1ChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts index 71acf387d7..e6e7d6f5ec 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts @@ -1,5 +1,8 @@ import { Amqp1MessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Amqp1MessageBinding extends Amqp1MessageBindingElement {} export default Amqp1MessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts index 6809cf8e42..ae2f16b40c 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts @@ -1,5 +1,8 @@ import { Amqp1OperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Amqp1OperationBinding extends Amqp1OperationBindingElement {} export default Amqp1OperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts index 6b6282ffdf..7f1e5117e1 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts @@ -1,5 +1,8 @@ import { Amqp1ServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Amqp1ServerBinding extends Amqp1ServerBindingElement {} export default Amqp1ServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts index 2fbbe9ac5c..03af87cdfa 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts @@ -1,5 +1,8 @@ import { AnypointmqChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AnypointmqChannelBinding extends AnypointmqChannelBindingElement {} export default AnypointmqChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts index 85b00393a7..dd90dccb96 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts @@ -1,5 +1,8 @@ import { AnypointmqMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AnypointmqMessageBinding extends AnypointmqMessageBindingElement {} export default AnypointmqMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts index fdca90b55b..c1792c978c 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts @@ -1,5 +1,8 @@ import { AnypointmqOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AnypointmqOperationBinding extends AnypointmqOperationBindingElement {} export default AnypointmqOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts index 8dbab48529..364a66d5dd 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts @@ -1,5 +1,8 @@ import { AnypointmqServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class AnypointmqServerBinding extends AnypointmqServerBindingElement {} export default AnypointmqServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts index 191b2b96db..ff434ed1fb 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts @@ -1,5 +1,8 @@ import { GooglepubsubChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class GooglepubsubChannelBinding extends GooglepubsubChannelBindingElement {} export default GooglepubsubChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts index b97ee1348d..0a8274aafe 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts @@ -1,5 +1,8 @@ import { GooglepubsubMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class GooglepubsubMessageBinding extends GooglepubsubMessageBindingElement {} export default GooglepubsubMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts index 0c93d4aad3..e5299631e0 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts @@ -1,5 +1,8 @@ import { GooglepubsubOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class GooglepubsubOperationBinding extends GooglepubsubOperationBindingElement {} export default GooglepubsubOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts index 730a22cf52..1294db1238 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts @@ -1,5 +1,8 @@ import { GooglepubsubServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class GooglepubsubServerBinding extends GooglepubsubServerBindingElement {} export default GooglepubsubServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts index 6907f20b5e..154a1139e2 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts @@ -1,5 +1,8 @@ import { HttpChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class HttpChannelBinding extends HttpChannelBindingElement {} export default HttpChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts index 1b086f293d..066f3e184c 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts @@ -1,5 +1,8 @@ import { HttpMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class HttpMessageBinding extends HttpMessageBindingElement {} export default HttpMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts index 2a413fdc51..4fa56acfb2 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts @@ -1,5 +1,8 @@ import { HttpOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class HttpOperationBinding extends HttpOperationBindingElement {} export default HttpOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts index 16a3329d6d..864189da02 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts @@ -1,5 +1,8 @@ import { HttpServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class HttpServerBinding extends HttpServerBindingElement {} export default HttpServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts index af4bbedf2d..9bb33ef77a 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts @@ -1,5 +1,8 @@ import { IbmmqChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class IbmmqChannelBinding extends IbmmqChannelBindingElement {} export default IbmmqChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts index 115dc189bf..53b6014109 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts @@ -1,5 +1,8 @@ import { IbmmqMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class IbmmqMessageBinding extends IbmmqMessageBindingElement {} export default IbmmqMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts index 342409e147..dbb1b9a8f8 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts @@ -1,5 +1,8 @@ import { IbmmqOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class IbmmqOperationBinding extends IbmmqOperationBindingElement {} export default IbmmqOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts index 599e0daa71..c2eb1d3ff7 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts @@ -1,5 +1,8 @@ import { IbmmqServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class IbmmqServerBinding extends IbmmqServerBindingElement {} export default IbmmqServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts index 7834a73851..3c3f8ece3b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts @@ -1,5 +1,8 @@ import { JmsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class JmsChannelBinding extends JmsChannelBindingElement {} export default JmsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts index 57e157be28..09ba163b6c 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts @@ -1,5 +1,8 @@ import { JmsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class JmsMessageBinding extends JmsMessageBindingElement {} export default JmsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts index eb4f0c9147..3db69e93a1 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts @@ -1,5 +1,8 @@ import { JmsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class JmsOperationBinding extends JmsOperationBindingElement {} export default JmsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts index 6555290e6f..43a15b549d 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts @@ -1,5 +1,8 @@ import { JmsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class JmsServerBinding extends JmsServerBindingElement {} export default JmsServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts index 411150b0b9..d4c1490dea 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts @@ -1,5 +1,8 @@ import { KafkaChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class KafkaChannelBinding extends KafkaChannelBindingElement {} export default KafkaChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts index 65fa9a570f..66dc7874e9 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts @@ -1,5 +1,8 @@ import { KafkaMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class KafkaMessageBinding extends KafkaMessageBindingElement {} export default KafkaMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts index e2d7c2d6bf..1ef41f691f 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts @@ -1,5 +1,8 @@ import { KafkaOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class KafkaOperationBinding extends KafkaOperationBindingElement {} export default KafkaOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts index 7d13e987e9..8380f61880 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts @@ -1,5 +1,8 @@ import { KafkaServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class KafkaServerBinding extends KafkaServerBindingElement {} export default KafkaServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts index 78442b6e24..2b6156b78f 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts @@ -1,5 +1,8 @@ import { MercureChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MercureChannelBinding extends MercureChannelBindingElement {} export default MercureChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts index 6e3c3ff68e..42777a4885 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts @@ -1,5 +1,8 @@ import { MercureMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MercureMessageBinding extends MercureMessageBindingElement {} export default MercureMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts index 7d73a88b8c..08e88e4e34 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts @@ -1,5 +1,8 @@ import { MercureOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MercureOperationBinding extends MercureOperationBindingElement {} export default MercureOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts index 291a0934f4..e6d2b3e2b8 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts @@ -1,5 +1,8 @@ import { MercureServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MercureServerBinding extends MercureServerBindingElement {} export default MercureServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts index c993d7b6e4..3d738efb81 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts @@ -1,5 +1,8 @@ import { MqttChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MqttChannelBinding extends MqttChannelBindingElement {} export default MqttChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts index 2a0d4e8430..04b86e4ba6 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts @@ -1,5 +1,8 @@ import { MqttMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MqttMessageBinding extends MqttMessageBindingElement {} export default MqttMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts index d1bafd378d..0e19d99832 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts @@ -1,5 +1,8 @@ import { MqttOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MqttOperationBinding extends MqttOperationBindingElement {} export default MqttOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts index 1bc3d8b244..36aff65d36 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts @@ -1,5 +1,8 @@ import { MqttServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class MqttServerBinding extends MqttServerBindingElement {} export default MqttServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts index 1ece0a6bb7..1f50cc4985 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts @@ -1,5 +1,8 @@ import { Mqtt5ChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Mqtt5ChannelBinding extends Mqtt5ChannelBindingElement {} export default Mqtt5ChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts index d47aac633b..3b1676167a 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts @@ -1,5 +1,8 @@ import { Mqtt5MessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Mqtt5MessageBinding extends Mqtt5MessageBindingElement {} export default Mqtt5MessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts index d3474a91a2..2392deaf0b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts @@ -1,5 +1,8 @@ import { Mqtt5OperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Mqtt5OperationBinding extends Mqtt5OperationBindingElement {} export default Mqtt5OperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts index eda2f72521..0e78f3bf0e 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts @@ -1,5 +1,8 @@ import { Mqtt5ServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class Mqtt5ServerBinding extends Mqtt5ServerBindingElement {} export default Mqtt5ServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts index e748727941..58134245a4 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts @@ -1,5 +1,8 @@ import { NatsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class NatsChannelBinding extends NatsChannelBindingElement {} export default NatsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts index 279a3f838d..99f05f0f4d 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts @@ -1,5 +1,8 @@ import { NatsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class NatsMessageBinding extends NatsMessageBindingElement {} export default NatsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts index db0f732caf..82552e65a0 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts @@ -1,5 +1,8 @@ import { NatsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class NatsOperationBinding extends NatsOperationBindingElement {} export default NatsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts index 28879d465b..a8dfbccf43 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts @@ -1,5 +1,8 @@ import { NatsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class NatsServerBinding extends NatsServerBindingElement {} export default NatsServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts index d5f4a4cc29..da1bab337b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts @@ -1,5 +1,8 @@ import { PulsarChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class PulsarChannelBinding extends PulsarChannelBindingElement {} export default PulsarChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts index 38e3c952aa..4508d63cea 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts @@ -1,5 +1,8 @@ import { PulsarMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class PulsarMessageBinding extends PulsarMessageBindingElement {} export default PulsarMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts index 594a12f97d..1aa75b3143 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts @@ -1,5 +1,8 @@ import { PulsarOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class PulsarOperationBinding extends PulsarOperationBindingElement {} export default PulsarOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts index 8ef57f4077..4add975537 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts @@ -1,5 +1,8 @@ import { PulsarServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class PulsarServerBinding extends PulsarServerBindingElement {} export default PulsarServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts index ae2ea390a0..66e7d3b725 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts @@ -1,5 +1,8 @@ import { RedisChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class RedisChannelBinding extends RedisChannelBindingElement {} export default RedisChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts index 764852e071..65e08cc4c2 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts @@ -1,5 +1,8 @@ import { RedisMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class RedisMessageBinding extends RedisMessageBindingElement {} export default RedisMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts index 81838f715e..5283b6863d 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts @@ -1,5 +1,8 @@ import { RedisOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class RedisOperationBinding extends RedisOperationBindingElement {} export default RedisOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts index 0b4357c7e4..d25a8aa537 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts @@ -1,5 +1,8 @@ import { RedisServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class RedisServerBinding extends RedisServerBindingElement {} export default RedisServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts index 6c981e8011..be1e816a5c 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts @@ -1,5 +1,8 @@ import { SnsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SnsChannelBinding extends SnsChannelBindingElement {} export default SnsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts index 73f24861a0..9db00451b7 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts @@ -1,5 +1,8 @@ import { SnsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SnsMessageBinding extends SnsMessageBindingElement {} export default SnsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts index bd0fc637d5..c6c2e0c7f6 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts @@ -1,5 +1,8 @@ import { SnsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SnsOperationBinding extends SnsOperationBindingElement {} export default SnsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts index ccc637271d..922fabbd11 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts @@ -1,5 +1,8 @@ import { SnsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SnsServerBinding extends SnsServerBindingElement {} export default SnsServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts index 35458c91d7..bc5ccdace4 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts @@ -1,5 +1,8 @@ import { SolaceChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SolaceChannelBinding extends SolaceChannelBindingElement {} export default SolaceChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts index 2161c76c25..9be5f3e0e4 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts @@ -1,5 +1,8 @@ import { SolaceMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SolaceMessageBinding extends SolaceMessageBindingElement {} export default SolaceMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts index f914366f72..6d327a2d43 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts @@ -1,5 +1,8 @@ import { SolaceOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SolaceOperationBinding extends SolaceOperationBindingElement {} export default SolaceOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts index d8a9a63522..001188ebee 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts @@ -1,5 +1,8 @@ import { SolaceServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SolaceServerBinding extends SolaceServerBindingElement {} export default SolaceServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts index d10b58cea9..b70e5d1e63 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts @@ -1,5 +1,8 @@ import { SqsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SqsChannelBinding extends SqsChannelBindingElement {} export default SqsChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts index afa75b296a..a710662f97 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts @@ -1,5 +1,8 @@ import { SqsMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SqsMessageBinding extends SqsMessageBindingElement {} export default SqsMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts index 0c0432d150..205f9210c2 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts @@ -1,5 +1,8 @@ import { SqsOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SqsOperationBinding extends SqsOperationBindingElement {} export default SqsOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts index 112cd8ad31..abc56e95ad 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts @@ -1,5 +1,8 @@ import { SqsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class SqsServerBinding extends SqsServerBindingElement {} export default SqsServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts index d09dd2e915..d38075ea0e 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts @@ -1,5 +1,8 @@ import { StompChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class StompChannelBinding extends StompChannelBindingElement {} export default StompChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts index b9583a559a..1cfac258e5 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts @@ -1,5 +1,8 @@ import { StompMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class StompMessageBinding extends StompMessageBindingElement {} export default StompMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts index 725c42e86d..5fba946776 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts @@ -1,5 +1,8 @@ import { StompOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class StompOperationBinding extends StompOperationBindingElement {} export default StompOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts index fcf1432e49..bb53e4e583 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts @@ -1,5 +1,8 @@ import { StompServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class StompServerBinding extends StompServerBindingElement {} export default StompServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts index ca56ca1e09..cd847499d6 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts @@ -1,5 +1,8 @@ import { WebSocketChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class WebSocketChannelBinding extends WebSocketChannelBindingElement {} export default WebSocketChannelBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts index 84da058c69..f15964ce8d 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts @@ -1,5 +1,8 @@ import { WebSocketMessageBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class WebSocketMessageBinding extends WebSocketMessageBindingElement {} export default WebSocketMessageBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts index c573a0a0e3..9072d0774f 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts @@ -1,5 +1,8 @@ import { WebSocketOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class WebSocketOperationBinding extends WebSocketOperationBindingElement {} export default WebSocketOperationBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts index c01ff990bb..1bd0ff9667 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts @@ -1,5 +1,8 @@ import { WebSocketServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/** + * @public + */ class WebSocketServerBinding extends WebSocketServerBindingElement {} export default WebSocketServerBinding; diff --git a/packages/apidom-ns-asyncapi-3/src/index.ts b/packages/apidom-ns-asyncapi-3/src/index.ts index fb98449a7e..49f19b30d4 100644 --- a/packages/apidom-ns-asyncapi-3/src/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/index.ts @@ -147,4 +147,4 @@ export { WebSocketMessageBindingElement, WebSocketOperationBindingElement, WebSocketServerBindingElement, -} from './refractor/registration.ts' \ No newline at end of file +} from './refractor/registration.ts'; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/media-types.ts b/packages/apidom-ns-asyncapi-3/src/media-types.ts index a2ced03f80..71f364562f 100644 --- a/packages/apidom-ns-asyncapi-3/src/media-types.ts +++ b/packages/apidom-ns-asyncapi-3/src/media-types.ts @@ -1,8 +1,14 @@ import { last } from 'ramda'; import { MediaTypes } from '@swagger-api/apidom-core'; +/** + * @public + */ export type Format = 'generic' | 'json' | 'yaml'; +/** + * @public + */ export class AsyncAPIMediaTypes extends MediaTypes { filterByFormat(format: Format = 'generic') { const effectiveFormat = format === 'generic' ? 'asyncapi;version' : format; @@ -24,6 +30,9 @@ export class AsyncAPIMediaTypes extends MediaTypes { } } +/** + * @public + */ const mediaTypes = new AsyncAPIMediaTypes( 'application/vnd.aai.asyncapi;version=3.0.0', 'application/vnd.aai.asyncapi+json;version=3.0.0', diff --git a/packages/apidom-ns-asyncapi-3/src/namespace.ts b/packages/apidom-ns-asyncapi-3/src/namespace.ts index 80bb1368fe..650182f284 100644 --- a/packages/apidom-ns-asyncapi-3/src/namespace.ts +++ b/packages/apidom-ns-asyncapi-3/src/namespace.ts @@ -1,38 +1,289 @@ import { NamespacePluginOptions } from '@swagger-api/apidom-core'; import AsyncApi3Element from './elements/AsyncApi3.ts'; -import InfoElement from './elements/Info.ts'; -import ServersElement from './elements/Servers.ts'; +import AsyncApiVersionElement from './elements/AsyncApiVersion.ts'; +import ChannelElement from './elements/Channel.ts'; +import ChannelAddressExpressionsElement from './elements/ChannelAddressExpressions.ts'; +import ChannelBindingsElement from './elements/ChannelBindings.ts'; import ChannelsElement from './elements/Channels.ts'; import ComponentsElement from './elements/Components.ts'; -import MessageElement from './elements/Message.ts'; -import TagElement from './elements/Tag.ts'; +import ContactElement from './elements/Contact.ts'; +import CorrelationIDElement from './elements/CorrelationID.ts'; +import DefaultContentTypeElement from './elements/DefaultContentType.ts'; import ExternalDocumentationElement from './elements/ExternalDocumentation.ts'; import IdentifierElement from './elements/Identifier.ts'; -import SchemaElement from './elements/Schema.ts'; +import InfoElement from './elements/Info.ts'; +import LicenseElement from './elements/License.ts'; +import MessageElement from './elements/Message.ts'; +import MessageBindingsElement from './elements/MessageBindings.ts'; +import MessageExampleElement from './elements/MessageExample.ts'; +import MessageTraitElement from './elements/MessageTrait.ts'; +import MessagesElement from './elements/Messages.ts'; +import MultiFormatSchemaElement from './elements/MultiFormatSchema.ts'; +import OauthFlowElement from './elements/OauthFlow.ts'; +import OauthFlowsElement from './elements/OauthFlows.ts'; +import OperationElement from './elements/Operation.ts'; +import OperationBindingsElement from './elements/OperationBindings.ts'; +import OperationReplyElement from './elements/OperationReply.ts'; +import OperationReplyAddressElement from './elements/OperationReplyAddress.ts'; +import OperationsElement from './elements/Operations.ts'; +import OperationTraitElement from './elements/OperationTrait.ts'; +import ParameterElement from './elements/Parameter.ts'; +import ParametersElement from './elements/Parameters.ts'; import ReferenceElement from './elements/Reference.ts'; +import SchemaElement from './elements/Schema.ts'; import SecuritySchemeElement from './elements/SecurityScheme.ts'; +import ServerElement from './elements/Server.ts'; +import ServerBindingsElement from './elements/ServerBindings.ts'; +import ServersElement from './elements/Servers.ts'; +import ServerVariableElement from './elements/ServerVariable.ts'; +import TagElement from './elements/Tag.ts'; +import TagsElement from './elements/Tags.ts'; +/** + * Binding elements. + */ +// AMQP 0-9-1 +import AmqpChannelBindingElement from './elements/bindings/amqp/AmqpChannelBinding.ts'; +import AmqpMessageBindingElement from './elements/bindings/amqp/AmqpMessageBinding.ts'; +import AmqpOperationBindingElement from './elements/bindings/amqp/AmqpOperationBinding.ts'; +import AmqpServerBindingElement from './elements/bindings/amqp/AmqpServerBinding.ts'; +// AMQP 1.0 +import Amqp1ChannelBindingElement from './elements/bindings/amqp1/Amqp1ChannelBinding.ts'; +import Amqp1MessageBindingElement from './elements/bindings/amqp1/Amqp1MessageBinding.ts'; +import Amqp1OperationBindingElement from './elements/bindings/amqp1/Amqp1OperationBinding.ts'; +import Amqp1ServerBindingElement from './elements/bindings/amqp1/Amqp1ServerBinding.ts'; +// Anypoint MQ +import AnypointmqChannelBindingElement from './elements/bindings/anypointmq/AnypointmqChannelBinding.ts'; +import AnypointmqMessageBindingElement from './elements/bindings/anypointmq/AnypointmqMessageBinding.ts'; +import AnypointmqOperationBindingElement from './elements/bindings/anypointmq/AnypointmqOperationBinding.ts'; +import AnypointmqServerBindingElement from './elements/bindings/anypointmq/AnypointmqServerBinding.ts'; +// Google Cloud Pub/Sub +import GooglepubsubChannelBindingElement from './elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts'; +import GooglepubsubMessageBindingElement from './elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts'; +import GooglepubsubOperationBindingElement from './elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts'; +import GooglepubsubServerBindingElement from './elements/bindings/googlepubsub/GooglepubsubServerBinding.ts'; +// HTTP +import HttpChannelBindingElement from './elements/bindings/http/HttpChannelBinding.ts'; +import HttpMessageBindingElement from './elements/bindings/http/HttpMessageBinding.ts'; +import HttpOperationBindingElement from './elements/bindings/http/HttpOperationBinding.ts'; +import HttpServerBindingElement from './elements/bindings/http/HttpServerBinding.ts'; +// IBM MQ +import IbmmqChannelBindingElement from './elements/bindings/ibmmq/IbmmqChannelBinding.ts'; +import IbmmqMessageBindingElement from './elements/bindings/ibmmq/IbmmqMessageBinding.ts'; +import IbmmqOperationBindingElement from './elements/bindings/ibmmq/IbmmqOperationBinding.ts'; +import IbmmqServerBindingElement from './elements/bindings/ibmmq/IbmmqServerBinding.ts'; +// JMS +import JmsChannelBindingElement from './elements/bindings/jms/JmsChannelBinding.ts'; +import JmsMessageBindingElement from './elements/bindings/jms/JmsMessageBinding.ts'; +import JmsOperationBindingElement from './elements/bindings/jms/JmsOperationBinding.ts'; +import JmsServerBindingElement from './elements/bindings/jms/JmsServerBinding.ts'; +// Kafka +import KafkaChannelBindingElement from './elements/bindings/kafka/KafkaChannelBinding.ts'; +import KafkaMessageBindingElement from './elements/bindings/kafka/KafkaMessageBinding.ts'; +import KafkaOperationBindingElement from './elements/bindings/kafka/KafkaOperationBinding.ts'; +import KafkaServerBindingElement from './elements/bindings/kafka/KafkaServerBinding.ts'; +// Mercure +import MercureChannelBindingElement from './elements/bindings/mercure/MercureChannelBinding.ts'; +import MercureMessageBindingElement from './elements/bindings/mercure/MercureMessageBinding.ts'; +import MercureOperationBindingElement from './elements/bindings/mercure/MercureOperationBinding.ts'; +import MercureServerBindingElement from './elements/bindings/mercure/MercureServerBinding.ts'; +// MQTT +import MqttChannelBindingElement from './elements/bindings/mqtt/MqttChannelBinding.ts'; +import MqttMessageBindingElement from './elements/bindings/mqtt/MqttMessageBinding.ts'; +import MqttOperationBindingElement from './elements/bindings/mqtt/MqttOperationBinding.ts'; +import MqttServerBindingElement from './elements/bindings/mqtt/MqttServerBinding.ts'; +// MQTT 5 +import Mqtt5ChannelBindingElement from './elements/bindings/mqtt5/Mqtt5ChannelBinding.ts'; +import Mqtt5MessageBindingElement from './elements/bindings/mqtt5/Mqtt5MessageBinding.ts'; +import Mqtt5OperationBindingElement from './elements/bindings/mqtt5/Mqtt5OperationBinding.ts'; +import Mqtt5ServerBindingElement from './elements/bindings/mqtt5/Mqtt5ServerBinding.ts'; +// NATS +import NatsChannelBindingElement from './elements/bindings/nats/NatsChannelBinding.ts'; +import NatsMessageBindingElement from './elements/bindings/nats/NatsMessageBinding.ts'; +import NatsOperationBindingElement from './elements/bindings/nats/NatsOperationBinding.ts'; +import NatsServerBindingElement from './elements/bindings/nats/NatsServerBinding.ts'; +// Pulsar +import PulsarChannelBindingElement from './elements/bindings/pulsar/PulsarChannelBinding.ts'; +import PulsarMessageBindingElement from './elements/bindings/pulsar/PulsarMessageBinding.ts'; +import PulsarOperationBindingElement from './elements/bindings/pulsar/PulsarOperationBinding.ts'; +import PulsarServerBindingElement from './elements/bindings/pulsar/PulsarServerBinding.ts'; +// Redis +import RedisChannelBindingElement from './elements/bindings/redis/RedisChannelBinding.ts'; +import RedisMessageBindingElement from './elements/bindings/redis/RedisMessageBinding.ts'; +import RedisOperationBindingElement from './elements/bindings/redis/RedisOperationBinding.ts'; +import RedisServerBindingElement from './elements/bindings/redis/RedisServerBinding.ts'; +// SNS +import SnsChannelBindingElement from './elements/bindings/sns/SnsChannelBinding.ts'; +import SnsMessageBindingElement from './elements/bindings/sns/SnsMessageBinding.ts'; +import SnsOperationBindingElement from './elements/bindings/sns/SnsOperationBinding.ts'; +import SnsServerBindingElement from './elements/bindings/sns/SnsServerBinding.ts'; +// Solace +import SolaceChannelBindingElement from './elements/bindings/solace/SolaceChannelBinding.ts'; +import SolaceMessageBindingElement from './elements/bindings/solace/SolaceMessageBinding.ts'; +import SolaceOperationBindingElement from './elements/bindings/solace/SolaceOperationBinding.ts'; +import SolaceServerBindingElement from './elements/bindings/solace/SolaceServerBinding.ts'; +// SQS +import SqsChannelBindingElement from './elements/bindings/sqs/SqsChannelBinding.ts'; +import SqsMessageBindingElement from './elements/bindings/sqs/SqsMessageBinding.ts'; +import SqsOperationBindingElement from './elements/bindings/sqs/SqsOperationBinding.ts'; +import SqsServerBindingElement from './elements/bindings/sqs/SqsServerBinding.ts'; +// STOMP +import StompChannelBindingElement from './elements/bindings/stomp/StompChannelBinding.ts'; +import StompMessageBindingElement from './elements/bindings/stomp/StompMessageBinding.ts'; +import StompOperationBindingElement from './elements/bindings/stomp/StompOperationBinding.ts'; +import StompServerBindingElement from './elements/bindings/stomp/StompServerBinding.ts'; +// WebSocket +import WebSocketChannelBindingElement from './elements/bindings/ws/WebSocketChannelBinding.ts'; +import WebSocketMessageBindingElement from './elements/bindings/ws/WebSocketMessageBinding.ts'; +import WebSocketOperationBindingElement from './elements/bindings/ws/WebSocketOperationBinding.ts'; +import WebSocketServerBindingElement from './elements/bindings/ws/WebSocketServerBinding.ts'; + +/** + * @public + */ const asyncApi3 = { namespace: (options: NamespacePluginOptions) => { const { base } = options; - // Register top-level AsyncAPI 3 elements. Add more as implemented. - base.register('asyncApi3', AsyncApi3Element); - base.register('info', InfoElement); - base.register('servers', ServersElement); - base.register('channels', ChannelsElement); - base.register('components', ComponentsElement); - base.register('message', MessageElement); - base.register('tag', TagElement); - base.register('externalDocs', ExternalDocumentationElement); - base.register('identifier', IdentifierElement); - base.register('schema', SchemaElement); - base.register('reference', ReferenceElement); - base.register('securityScheme', SecuritySchemeElement); + base.register('asyncApi3', AsyncApi3Element); + base.register('asyncApiVersion', AsyncApiVersionElement); + base.register('channel', ChannelElement); + base.register('channelAddressExpressions', ChannelAddressExpressionsElement); + base.register('channelBindings', ChannelBindingsElement); + base.register('channels', ChannelsElement); + base.register('components', ComponentsElement); + base.register('contact', ContactElement); + base.register('correlationID', CorrelationIDElement); + base.register('defaultContentType', DefaultContentTypeElement); + base.register('externalDocumentation', ExternalDocumentationElement); + base.register('identifier', IdentifierElement); + base.register('info', InfoElement); + base.register('license', LicenseElement); + base.register('message', MessageElement); + base.register('messageBindings', MessageBindingsElement); + base.register('messageExample', MessageExampleElement); + base.register('messages', MessagesElement); + base.register('messageTrait', MessageTraitElement); + base.register('multiFormatSchema', MultiFormatSchemaElement); + base.register('oAuthFlow', OauthFlowElement); + base.register('oAuthFlows', OauthFlowsElement); + base.register('operation', OperationElement); + base.register('operationBindings', OperationBindingsElement); + base.register('operationReply', OperationReplyElement); + base.register('operationReplyAddress', OperationReplyAddressElement); + base.register('operations', OperationsElement); + base.register('operationTrait', OperationTraitElement); + base.register('parameter', ParameterElement); + base.register('parameters', ParametersElement); + base.register('reference', ReferenceElement); + base.register('schema', SchemaElement); + base.register('securityScheme', SecuritySchemeElement); + base.register('server', ServerElement); + base.register('serverBindings', ServerBindingsElement); + base.register('servers', ServersElement); + base.register('serverVariable', ServerVariableElement); + base.register('tag', TagElement); + base.register('tags', TagsElement); + + // Binding elements. + base.register('amqpChannelBinding', AmqpChannelBindingElement); + base.register('amqpMessageBinding', AmqpMessageBindingElement); + base.register('amqpOperationBinding', AmqpOperationBindingElement); + base.register('amqpServerBinding', AmqpServerBindingElement); + + base.register('amqp1ChannelBinding', Amqp1ChannelBindingElement); + base.register('amqp1MessageBinding', Amqp1MessageBindingElement); + base.register('amqp1OperationBinding', Amqp1OperationBindingElement); + base.register('amqp1ServerBinding', Amqp1ServerBindingElement); + + base.register('anypointmqChannelBinding', AnypointmqChannelBindingElement); + base.register('anypointmqMessageBinding', AnypointmqMessageBindingElement); + base.register('anypointmqOperationBinding', AnypointmqOperationBindingElement); + base.register('anypointmqServerBinding', AnypointmqServerBindingElement); + + base.register('googlepubsubChannelBinding', GooglepubsubChannelBindingElement); + base.register('googlepubsubMessageBinding', GooglepubsubMessageBindingElement); + base.register('googlepubsubOperationBinding', GooglepubsubOperationBindingElement); + base.register('googlepubsubServerBinding', GooglepubsubServerBindingElement); + + base.register('httpChannelBinding', HttpChannelBindingElement); + base.register('httpMessageBinding', HttpMessageBindingElement); + base.register('httpOperationBinding', HttpOperationBindingElement); + base.register('httpServerBinding', HttpServerBindingElement); + + base.register('ibmmqChannelBinding', IbmmqChannelBindingElement); + base.register('ibmmqMessageBinding', IbmmqMessageBindingElement); + base.register('ibmmqOperationBinding', IbmmqOperationBindingElement); + base.register('ibmmqServerBinding', IbmmqServerBindingElement); + + base.register('jmsChannelBinding', JmsChannelBindingElement); + base.register('jmsMessageBinding', JmsMessageBindingElement); + base.register('jmsOperationBinding', JmsOperationBindingElement); + base.register('jmsServerBinding', JmsServerBindingElement); + + base.register('kafkaChannelBinding', KafkaChannelBindingElement); + base.register('kafkaMessageBinding', KafkaMessageBindingElement); + base.register('kafkaOperationBinding', KafkaOperationBindingElement); + base.register('kafkaServerBinding', KafkaServerBindingElement); + + base.register('mercureChannelBinding', MercureChannelBindingElement); + base.register('mercureMessageBinding', MercureMessageBindingElement); + base.register('mercureOperationBinding', MercureOperationBindingElement); + base.register('mercureServerBinding', MercureServerBindingElement); + + base.register('mqttChannelBinding', MqttChannelBindingElement); + base.register('mqttMessageBinding', MqttMessageBindingElement); + base.register('mqttOperationBinding', MqttOperationBindingElement); + base.register('mqttServerBinding', MqttServerBindingElement); + + base.register('mqtt5ChannelBinding', Mqtt5ChannelBindingElement); + base.register('mqtt5MessageBinding', Mqtt5MessageBindingElement); + base.register('mqtt5OperationBinding', Mqtt5OperationBindingElement); + base.register('mqtt5ServerBinding', Mqtt5ServerBindingElement); + + base.register('natsChannelBinding', NatsChannelBindingElement); + base.register('natsMessageBinding', NatsMessageBindingElement); + base.register('natsOperationBinding', NatsOperationBindingElement); + base.register('natsServerBinding', NatsServerBindingElement); + + base.register('pulsarChannelBinding', PulsarChannelBindingElement); + base.register('pulsarMessageBinding', PulsarMessageBindingElement); + base.register('pulsarOperationBinding', PulsarOperationBindingElement); + base.register('pulsarServerBinding', PulsarServerBindingElement); + + base.register('redisChannelBinding', RedisChannelBindingElement); + base.register('redisMessageBinding', RedisMessageBindingElement); + base.register('redisOperationBinding', RedisOperationBindingElement); + base.register('redisServerBinding', RedisServerBindingElement); + + base.register('snsChannelBinding', SnsChannelBindingElement); + base.register('snsMessageBinding', SnsMessageBindingElement); + base.register('snsOperationBinding', SnsOperationBindingElement); + base.register('snsServerBinding', SnsServerBindingElement); + + base.register('solaceChannelBinding', SolaceChannelBindingElement); + base.register('solaceMessageBinding', SolaceMessageBindingElement); + base.register('solaceOperationBinding', SolaceOperationBindingElement); + base.register('solaceServerBinding', SolaceServerBindingElement); + + base.register('sqsChannelBinding', SqsChannelBindingElement); + base.register('sqsMessageBinding', SqsMessageBindingElement); + base.register('sqsOperationBinding', SqsOperationBindingElement); + base.register('sqsServerBinding', SqsServerBindingElement); + + base.register('stompChannelBinding', StompChannelBindingElement); + base.register('stompMessageBinding', StompMessageBindingElement); + base.register('stompOperationBinding', StompOperationBindingElement); + base.register('stompServerBinding', StompServerBindingElement); + + base.register('webSocketChannelBinding', WebSocketChannelBindingElement); + base.register('webSocketMessageBinding', WebSocketMessageBindingElement); + base.register('webSocketOperationBinding', WebSocketOperationBindingElement); + base.register('webSocketServerBinding', WebSocketServerBindingElement); return base; }, }; -export default asyncApi3; +export default asyncApi3; \ No newline at end of file diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/registration.ts b/packages/apidom-ns-asyncapi-3/src/refractor/registration.ts similarity index 100% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/registration.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/registration.ts diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 51d6e10a65..853049053d 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -10,10 +10,16 @@ import ChannelVisitor from './visitors/async-api-3/channel/index.ts'; import ChannelsVisitor from './visitors/async-api-3/channels/index.ts'; import ComponentsOperationsVisitor from './visitors/async-api-3/components/OperationsVisitor.ts'; import ComponentsSchemasVisitor from './visitors/async-api-3/components/SchemasVisitor.ts'; +import ComponentsChannelsVisitor from './visitors/async-api-3/components/ChannelsVisitor.ts'; +import ComponentsExternalDocumentationVisitor from './visitors/async-api-3/components/ExternalDocumentationVisitor.ts'; +import ComponentsRepliesVisitor from './visitors/async-api-3/components/RepliesVisitor.ts'; +import ComponentsReplyAddressesVisitor from './visitors/async-api-3/components/ReplyAddressesVisitor.ts'; +import ComponentsTagsVisitor from './visitors/async-api-3/components/TagsVisitor.ts'; import ComponentsVisitor from './visitors/async-api-3/components/index.ts'; import ContactVisitor from './visitors/async-api-3/contact/index.ts'; import CorrelationIDVisitor from './visitors/async-api-3/correlation-id/index.ts'; import DefaultContentTypeVisitor from '../elements/DefaultContentType.ts'; +import ExternalDocumentationOrReferenceVisitor from './visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts'; import ExternalDocumentationVisitor from './visitors/async-api-3/external-documentation-object/index.ts'; import FallbackVisitor from './visitors/FallbackVisitor.ts'; import IdentifierVisitor from './visitors/async-api-3/IdentifierVisitor.ts'; @@ -24,6 +30,7 @@ import MessageCorrelationIdVisitor from './visitors/async-api-3/message/Correlat import MessageExampleVisitor from './visitors/async-api-3/message-example/index.ts'; import MessageExamplesVisitor from './visitors/async-api-3/message/ExamplesVisitor.ts'; import MessageHeadersVisitor from './visitors/async-api-3/message/HeadersVisitor.ts'; +import MessagePayloadVisitor from './visitors/async-api-3/message/PayloadVisitor.ts'; import MessageTraitHeadersVisitor from './visitors/async-api-3/message-trait/HeadersVisitor.ts'; import MessageTraitVisitor from './visitors/async-api-3/message-trait/index.ts'; import MessageTraitsVisitor from './visitors/async-api-3/message/TraitsVisitor.ts'; @@ -59,8 +66,106 @@ import ServersVisitor from './visitors/async-api-3/servers/index.ts'; import TagVisitor from './visitors/async-api-3/tag/index.ts'; import TagsVisitor from './visitors/async-api-3/tags/index.ts'; import { default as schemaInheritedFixedFields } from './visitors/async-api-3/schema/inherited-fixed-fields.ts' -import DefaultContentType from '../elements/DefaultContentType.ts'; -import ExternalDocumentationOrReferenceVisitor from './visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts'; + +/** + * Binding elements. + */ +// AMQP 0-9-1 +import AmqpChannelBindingVisitor from './visitors/async-api-3/bindings/amqp/channel-binding/index.ts'; +import AmqpMessageBindingVisitor from './visitors/async-api-3/bindings/amqp/message-binding/index.ts'; +import AmqpOperationBindingVisitor from './visitors/async-api-3/bindings/amqp/operation-binding/index.ts'; +import AmqpServerBindingVisitor from './visitors/async-api-3/bindings/amqp/server-binding/index.ts'; +// AMQP 1.0 +import Amqp1ChannelBindingVisitor from './visitors/async-api-3/bindings/amqp1/channel-binding/index.ts'; +import Amqp1MessageBindingVisitor from './visitors/async-api-3/bindings/amqp1/message-binding/index.ts'; +import Amqp1OperationBindingVisitor from './visitors/async-api-3/bindings/amqp1/operation-binding/index.ts'; +import Amqp1ServerBindingVisitor from './visitors/async-api-3/bindings/amqp1/server-binding/index.ts'; +// Anypoint MQ +import AnypointmqChannelBindingVisitor from './visitors/async-api-3/bindings/anypointmq/channel-binding/index.ts'; +import AnypointmqMessageBindingVisitor from './visitors/async-api-3/bindings/anypointmq/message-binding/index.ts'; +import AnypointmqOperationBindingVisitor from './visitors/async-api-3/bindings/anypointmq/operation-binding/index.ts'; +import AnypointmqServerBindingVisitor from './visitors/async-api-3/bindings/anypointmq/server-binding/index.ts'; +// HTTP +import HttpChannelBindingVisitor from './visitors/async-api-3/bindings/http/channel-binding/index.ts'; +import HttpMessageBindingVisitor from './visitors/async-api-3/bindings/http/message-binding/index.ts'; +import HttpOperationBindingVisitor from './visitors/async-api-3/bindings/http/operation-binding/index.ts'; +import HttpServerBindingVisitor from './visitors/async-api-3/bindings/http/server-binding/index.ts'; +// Google Cloud Pub/Sub +import GooglepubsubChannelBindingVisitor from './visitors/async-api-3/bindings/googlepubsub/channel-binding/index.ts'; +import GooglepubsubMessageBindingVisitor from './visitors/async-api-3/bindings/googlepubsub/message-binding/index.ts'; +import GooglepubsubOperationBindingVisitor from './visitors/async-api-3/bindings/googlepubsub/operation-binding/index.ts'; +import GooglepubsubServerBindingVisitor from './visitors/async-api-3/bindings/googlepubsub/server-binding/index.ts'; +// IBM MQ +import IbmmqChannelBindingVisitor from './visitors/async-api-3/bindings/ibmmq/channel-binding/index.ts'; +import IbmmqMessageBindingVisitor from './visitors/async-api-3/bindings/ibmmq/message-binding/index.ts'; +import IbmmqOperationBindingVisitor from './visitors/async-api-3/bindings/ibmmq/operation-binding/index.ts'; +import IbmmqServerBindingVisitor from './visitors/async-api-3/bindings/ibmmq/server-binding/index.ts'; +// JMS +import JmsChannelBindingVisitor from './visitors/async-api-3/bindings/jms/channel-binding/index.ts'; +import JmsMessageBindingVisitor from './visitors/async-api-3/bindings/jms/message-binding/index.ts'; +import JmsOperationBindingVisitor from './visitors/async-api-3/bindings/jms/operation-binding/index.ts'; +import JmsServerBindingVisitor from './visitors/async-api-3/bindings/jms/server-binding/index.ts'; +// Kafka +import KafkaChannelBindingVisitor from './visitors/async-api-3/bindings/kafka/channel-binding/index.ts'; +import KafkaMessageBindingVisitor from './visitors/async-api-3/bindings/kafka/message-binding/index.ts'; +import KafkaOperationBindingVisitor from './visitors/async-api-3/bindings/kafka/operation-binding/index.ts'; +import KafkaServerBindingVisitor from './visitors/async-api-3/bindings/kafka/server-binding/index.ts'; +// Mercure +import MercureChannelBindingVisitor from './visitors/async-api-3/bindings/mercure/channel-binding/index.ts'; +import MercureMessageBindingVisitor from './visitors/async-api-3/bindings/mercure/message-binding/index.ts'; +import MercureOperationBindingVisitor from './visitors/async-api-3/bindings/mercure/operation-binding/index.ts'; +import MercureServerBindingVisitor from './visitors/async-api-3/bindings/mercure/server-binding/index.ts'; +// MQTT +import MqttChannelBindingVisitor from './visitors/async-api-3/bindings/mqtt/channel-binding/index.ts'; +import MqttMessageBindingVisitor from './visitors/async-api-3/bindings/mqtt/message-binding/index.ts'; +import MqttOperationBindingVisitor from './visitors/async-api-3/bindings/mqtt/operation-binding/index.ts'; +import MqttServerBindingVisitor from './visitors/async-api-3/bindings/mqtt/server-binding/index.ts'; +// MQTT 5 +import Mqtt5ChannelBindingVisitor from './visitors/async-api-3/bindings/mqtt5/channel-binding/index.ts'; +import Mqtt5MessageBindingVisitor from './visitors/async-api-3/bindings/mqtt5/message-binding/index.ts'; +import Mqtt5OperationBindingVisitor from './visitors/async-api-3/bindings/mqtt5/operation-binding/index.ts'; +import Mqtt5ServerBindingVisitor from './visitors/async-api-3/bindings/mqtt5/server-binding/index.ts'; +// NATS +import NatsChannelBindingVisitor from './visitors/async-api-3/bindings/nats/channel-binding/index.ts'; +import NatsMessageBindingVisitor from './visitors/async-api-3/bindings/nats/message-binding/index.ts'; +import NatsOperationBindingVisitor from './visitors/async-api-3/bindings/nats/operation-binding/index.ts'; +import NatsServerBindingVisitor from './visitors/async-api-3/bindings/nats/server-binding/index.ts'; +// Pulsar +import PulsarChannelBindingVisitor from './visitors/async-api-3/bindings/pulsar/channel-binding/index.ts'; +import PulsarMessageBindingVisitor from './visitors/async-api-3/bindings/pulsar/message-binding/index.ts'; +import PulsarOperationBindingVisitor from './visitors/async-api-3/bindings/pulsar/operation-binding/index.ts'; +import PulsarServerBindingVisitor from './visitors/async-api-3/bindings/pulsar/server-binding/index.ts'; +// Redis +import RedisChannelBindingVisitor from './visitors/async-api-3/bindings/redis/channel-binding/index.ts'; +import RedisMessageBindingVisitor from './visitors/async-api-3/bindings/redis/message-binding/index.ts'; +import RedisOperationBindingVisitor from './visitors/async-api-3/bindings/redis/operation-binding/index.ts'; +import RedisServerBindingVisitor from './visitors/async-api-3/bindings/redis/server-binding/index.ts'; +// SNS +import SnsChannelBindingVisitor from './visitors/async-api-3/bindings/sns/channel-binding/index.ts'; +import SnsMessageBindingVisitor from './visitors/async-api-3/bindings/sns/message-binding/index.ts'; +import SnsOperationBindingVisitor from './visitors/async-api-3/bindings/sns/operation-binding/index.ts'; +import SnsServerBindingVisitor from './visitors/async-api-3/bindings/sns/server-binding/index.ts'; +// Solace +import SolaceChannelBindingVisitor from './visitors/async-api-3/bindings/solace/channel-binding/index.ts'; +import SolaceMessageBindingVisitor from './visitors/async-api-3/bindings/solace/message-binding/index.ts'; +import SolaceOperationBindingVisitor from './visitors/async-api-3/bindings/solace/operation-binding/index.ts'; +import SolaceServerBindingVisitor from './visitors/async-api-3/bindings/solace/server-binding/index.ts'; +// SQS +import SqsChannelBindingVisitor from './visitors/async-api-3/bindings/sqs/channel-binding/index.ts'; +import SqsMessageBindingVisitor from './visitors/async-api-3/bindings/sqs/message-binding/index.ts'; +import SqsOperationBindingVisitor from './visitors/async-api-3/bindings/sqs/operation-binding/index.ts'; +import SqsServerBindingVisitor from './visitors/async-api-3/bindings/sqs/server-binding/index.ts'; +// STOMP +import StompChannelBindingVisitor from './visitors/async-api-3/bindings/stomp/channel-binding/index.ts'; +import StompMessageBindingVisitor from './visitors/async-api-3/bindings/stomp/message-binding/index.ts'; +import StompOperationBindingVisitor from './visitors/async-api-3/bindings/stomp/operation-binding/index.ts'; +import StompServerBindingVisitor from './visitors/async-api-3/bindings/stomp/server-binding/index.ts'; +// WebSocket +import WebSocketChannelBindingVisitor from './visitors/async-api-3/bindings/ws/channel-binding/index.ts'; +import WebSocketMessageBindingVisitor from './visitors/async-api-3/bindings/ws/message-binding/index.ts'; +import WebSocketOperationBindingVisitor from './visitors/async-api-3/bindings/ws/operation-binding/index.ts'; +import WebSocketServerBindingVisitor from './visitors/async-api-3/bindings/ws/server-binding/index.ts'; +import SchemaOrReferenceVisitor from './visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts'; const SchemaSpecification = { $visitor: SchemaVisitor, @@ -186,12 +291,12 @@ const specification = { $visitor: ChannelVisitor, fixedFields: { address: { $ref: '#/visitors/value' }, - messages: { $ref: '#/visitors/value' }, + messages: { $ref: '#/visitors/document/objects/Messages' }, title: { $ref: '#/visitors/value' }, summary: { $ref: '#/visitors/value' }, description: { $ref: '#/visitors/value' }, servers: ChannelServersVisitor, - parameters: { $ref: '#/visitors/document/object/Parameters' }, + parameters: { $ref: '#/visitors/document/objects/Parameters' }, tags: { $ref: '#/visitors/document/objects/Tags' }, externalDocs: ExternalDocumentationOrReferenceVisitor, bindings: ChanneBindingsVisitor, @@ -220,7 +325,7 @@ const specification = { bindings: OperationBindingsVisitor_, traits: OperationTraitsVisitor, message: OperationMessagesVisitor, - reply: OperationReplyVisitor, + reply: OperationReplyVisitor_, }, }, OperationTrait: { @@ -517,7 +622,7 @@ const specification = { $visitor: MessageVisitor, fixedFields: { headers: MessageHeadersVisitor, - payload: { $ref: '#/visitors/document/objects/Schema' }, + payload: MessagePayloadVisitor, correlationId: MessageCorrelationIdVisitor, contetType: { $ref: '#/visitors/value' }, name: { $ref: '#/visitors/value' }, @@ -590,17 +695,17 @@ const specification = { fixedFields: { schemas: ComponentsSchemasVisitor, servers: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.servers, - channels: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channels, + channels: ComponentsChannelsVisitor, serverVariables: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverVariables, operations: ComponentsOperationsVisitor, messages: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messages, securitySchemes: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.securitySchemes, parameters: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.parameters, correlationIds: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.correlationIds, - replies: { $ref: '#/visitors/value' }, - replyAddresses: { $ref: '#/visitors/value' }, - tags: { $ref: '#/visitors/document/objects/Tags' }, - externalDocs: ExternalDocumentationVisitor, + replies: ComponentsRepliesVisitor, + replyAddresses: ComponentsReplyAddressesVisitor, + tags: ComponentsTagsVisitor, + externalDocs: ComponentsExternalDocumentationVisitor, operationTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationTraits, messageTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageTraits, serverBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverBindings, @@ -612,11 +717,11 @@ const specification = { MultiFormatSchema: { $visitor: MultiFormatSchemaVisitor, fixedFields: { - $shemaFormat: { $ref: '#/visitors/document/objects/SchemaFormat' }, - $schema: { $ref: '#/visitors/document/objects/Schema' }, - properties: { $ref: '#/visitors/document/objects/MultiFormatSchema' }, + schemaFormat: { $ref: '#/visitors/value' }, + schema: { $ref: '#/visitors/value' }, }, }, + JSONSchema: SchemaSpecification, Schema: SchemaSpecification, SecurityScheme: { $visitor: SecuritySchemeVisitor, @@ -667,6 +772,605 @@ const specification = { location: AsyncApi2_0Specification.visitors.document.objects.CorrelationID.fixedFields.location }, }, + bindings: { + http: { + ServerBinding: { + $visitor: HttpServerBindingVisitor, + }, + ChannelBinding: { + $visitor: HttpChannelBindingVisitor, + }, + OperationBinding: { + $visitor: HttpOperationBindingVisitor, + fixedFields: { + type: { + $ref: '#/visitors/value', + }, + method: { + $ref: '#/visitors/value', + }, + query: SchemaOrReferenceVisitor, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + MessageBinding: { + $visitor: HttpMessageBindingVisitor, + fixedFields: { + headers: SchemaOrReferenceVisitor, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + }, + ws: { + ServerBinding: { + $visitor: WebSocketServerBindingVisitor, + }, + ChannelBinding: { + $visitor: WebSocketChannelBindingVisitor, + fixedFields: { + method: { + $ref: '#/visitors/value', + }, + query: SchemaOrReferenceVisitor, + headers: SchemaOrReferenceVisitor, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + OperationBinding: { + $visitor: WebSocketOperationBindingVisitor, + }, + MessageBinding: { + $visitor: WebSocketMessageBindingVisitor, + }, + }, + kafka: { + ServerBinding: { + $visitor: KafkaServerBindingVisitor, + fixedFields: { + schemaRegistryUrl: { + $ref: '#/visitors/value', + }, + schemaRegistryVendor: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + ChannelBinding: { + $visitor: KafkaChannelBindingVisitor, + fixedFields: { + topic: { + $ref: '#/visitors/value', + }, + partitions: { + $ref: '#/visitors/value', + }, + replicas: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + OperationBinding: { + $visitor: KafkaOperationBindingVisitor, + fixedFields: { + groupId: SchemaOrReferenceVisitor, + clientId: SchemaOrReferenceVisitor, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + MessageBinding: { + $visitor: KafkaMessageBindingVisitor, + fixedFields: { + key: SchemaOrReferenceVisitor, + schemaIdLocation: { + $ref: '#/visitors/value', + }, + schemaIdPayloadEncoding: { + $ref: '#/visitors/value', + }, + schemaLookupStrategy: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + }, + anypointmq: { + ServerBinding: { + $visitor: AnypointmqServerBindingVisitor, + }, + ChannelBinding: { + $visitor: AnypointmqChannelBindingVisitor, + fixedFields: { + destination: { + $ref: '#/visitors/value', + }, + destinationType: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + OperationBinding: { + $visitor: AnypointmqOperationBindingVisitor, + }, + MessageBinding: { + $visitor: AnypointmqMessageBindingVisitor, + fixedFields: { + headers: SchemaOrReferenceVisitor, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + }, + amqp: { + ServerBinding: { + $visitor: AmqpServerBindingVisitor, + }, + ChannelBinding: { + $visitor: AmqpChannelBindingVisitor, + fixedFields: { + is: { + $ref: '#/visitors/value', + }, + exchange: { + $ref: '#/visitors/value', + }, + queue: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + OperationBinding: { + $visitor: AmqpOperationBindingVisitor, + fixedFields: { + expiration: { + $ref: '#/visitors/value', + }, + userId: { + $ref: '#/visitors/value', + }, + cc: { + $ref: '#/visitors/value', + }, + priority: { + $ref: '#/visitors/value', + }, + deliveryMode: { + $ref: '#/visitors/value', + }, + mandatory: { + $ref: '#/visitors/value', + }, + bcc: { + $ref: '#/visitors/value', + }, + replyTo: { + $ref: '#/visitors/value', + }, + timestamp: { + $ref: '#/visitors/value', + }, + ack: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + MessageBinding: { + $visitor: AmqpMessageBindingVisitor, + fixedFields: { + contentEncoding: { + $ref: '#/visitors/value', + }, + messageType: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + }, + amqp1: { + ServerBinding: { + $visitor: Amqp1ServerBindingVisitor, + }, + ChannelBinding: { + $visitor: Amqp1ChannelBindingVisitor, + }, + OperationBinding: { + $visitor: Amqp1OperationBindingVisitor, + }, + MessageBinding: { + $visitor: Amqp1MessageBindingVisitor, + }, + }, + mqtt: { + ServerBinding: { + $visitor: MqttServerBindingVisitor, + fixedFields: { + clientId: { + $ref: '#/visitors/value', + }, + cleanSession: { + $ref: '#/visitors/value', + }, + lastWill: { + $ref: '#/visitors/value', + }, + keepAlive: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + ChannelBinding: { + $visitor: MqttChannelBindingVisitor, + }, + OperationBinding: { + $visitor: MqttOperationBindingVisitor, + fixedFields: { + qos: { + $ref: '#/visitors/value', + }, + retain: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + MessageBinding: { + $visitor: MqttMessageBindingVisitor, + fixedFields: { + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + }, + mqtt5: { + ServerBinding: { + $visitor: Mqtt5ServerBindingVisitor, + }, + ChannelBinding: { + $visitor: Mqtt5ChannelBindingVisitor, + }, + OperationBinding: { + $visitor: Mqtt5OperationBindingVisitor, + }, + MessageBinding: { + $visitor: Mqtt5MessageBindingVisitor, + }, + }, + nats: { + ServerBinding: { + $visitor: NatsServerBindingVisitor, + }, + ChannelBinding: { + $visitor: NatsChannelBindingVisitor, + }, + OperationBinding: { + $visitor: NatsOperationBindingVisitor, + fixedFields: { + queue: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + MessageBinding: { + $visitor: NatsMessageBindingVisitor, + }, + }, + pulsar: { + ServerBinding: { + $visitor: PulsarServerBindingVisitor, + fixedFields: { + tenant: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + ChannelBinding: { + $visitor: PulsarChannelBindingVisitor, + fixedFields: { + namespace: { + $ref: '#/visitors/value', + }, + persistence: { + $ref: '#/visitors/value', + }, + compaction: { + $ref: '#/visitors/value', + }, + 'geo-replication': { + $ref: '#/visitors/value', + }, + retention: { + $ref: '#/visitors/value', + }, + ttl: { + $ref: '#/visitors/value', + }, + deduplication: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + OperationBinding: { + $visitor: PulsarOperationBindingVisitor, + }, + MessageBinding: { + $visitor: PulsarMessageBindingVisitor, + }, + }, + jms: { + ServerBinding: { + $visitor: JmsServerBindingVisitor, + }, + ChannelBinding: { + $visitor: JmsChannelBindingVisitor, + }, + OperationBinding: { + $visitor: JmsOperationBindingVisitor, + }, + MessageBinding: { + $visitor: JmsMessageBindingVisitor, + }, + }, + sns: { + ServerBinding: { + $visitor: SnsServerBindingVisitor, + }, + ChannelBinding: { + $visitor: SnsChannelBindingVisitor, + }, + OperationBinding: { + $visitor: SnsOperationBindingVisitor, + }, + MessageBinding: { + $visitor: SnsMessageBindingVisitor, + }, + }, + solace: { + ServerBinding: { + $visitor: SolaceServerBindingVisitor, + fixedFields: { + bindingVersion: { + $ref: '#/visitors/value', + }, + msgVpn: { + $ref: '#/visitors/value', + }, + }, + }, + ChannelBinding: { + $visitor: SolaceChannelBindingVisitor, + }, + OperationBinding: { + $visitor: SolaceOperationBindingVisitor, + fixedFields: { + bindingVersion: { + $ref: '#/visitors/value', + }, + destinations: { + $ref: '#/visitors/value', + }, + }, + }, + MessageBinding: { + $visitor: SolaceMessageBindingVisitor, + }, + }, + sqs: { + ServerBinding: { + $visitor: SqsServerBindingVisitor, + }, + ChannelBinding: { + $visitor: SqsChannelBindingVisitor, + }, + OperationBinding: { + $visitor: SqsOperationBindingVisitor, + }, + MessageBinding: { + $visitor: SqsMessageBindingVisitor, + }, + }, + stomp: { + ServerBinding: { + $visitor: StompServerBindingVisitor, + }, + ChannelBinding: { + $visitor: StompChannelBindingVisitor, + }, + OperationBinding: { + $visitor: StompOperationBindingVisitor, + }, + MessageBinding: { + $visitor: StompMessageBindingVisitor, + }, + }, + redis: { + ServerBinding: { + $visitor: RedisServerBindingVisitor, + }, + ChannelBinding: { + $visitor: RedisChannelBindingVisitor, + }, + OperationBinding: { + $visitor: RedisOperationBindingVisitor, + }, + MessageBinding: { + $visitor: RedisMessageBindingVisitor, + }, + }, + mercure: { + ServerBinding: { + $visitor: MercureServerBindingVisitor, + }, + ChannelBinding: { + $visitor: MercureChannelBindingVisitor, + }, + OperationBinding: { + $visitor: MercureOperationBindingVisitor, + }, + MessageBinding: { + $visitor: MercureMessageBindingVisitor, + }, + }, + googlepubsub: { + ServerBinding: { + $visitor: GooglepubsubServerBindingVisitor, + }, + ChannelBinding: { + $visitor: GooglepubsubChannelBindingVisitor, + fixedFields: { + bindingVersion: { + $ref: '#/visitors/value', + }, + labels: { + $ref: '#/visitors/value', + }, + messageRetentionDuration: { + $ref: '#/visitors/value', + }, + messageStoragePolicy: { + $ref: '#/visitors/value', + }, + schemaSettings: { + $ref: '#/visitors/value', + }, + topic: { + $ref: '#/visitors/value', + }, + }, + }, + OperationBinding: { + $visitor: GooglepubsubOperationBindingVisitor, + }, + MessageBinding: { + $visitor: GooglepubsubMessageBindingVisitor, + fixedFields: { + bindingVersion: { + $ref: '#/visitors/value', + }, + attributes: { + $ref: '#/visitors/value', + }, + orderingKey: { + $ref: '#/visitors/value', + }, + schema: { + $ref: '#/visitors/value', + }, + }, + }, + }, + ibmmq: { + ServerBinding: { + $visitor: IbmmqServerBindingVisitor, + fixedFields: { + groupId: { + $ref: '#/visitors/value', + }, + ccdtQueueManagerName: { + $ref: '#/visitors/value', + }, + cipherSpec: { + $ref: '#/visitors/value', + }, + multiEndpointServer: { + $ref: '#/visitors/value', + }, + heartBeatInterval: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + ChannelBinding: { + $visitor: IbmmqChannelBindingVisitor, + fixedFields: { + destinationType: { + $ref: '#/visitors/value', + }, + queue: { + $ref: '#/visitors/value', + }, + topic: { + $ref: '#/visitors/value', + }, + maxMsgLength: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + MessageBinding: { + $visitor: IbmmqMessageBindingVisitor, + fixedFields: { + type: { + $ref: '#/visitors/value', + }, + headers: { + $ref: '#/visitors/value', + }, + description: { + $ref: '#/visitors/value', + }, + expiry: { + $ref: '#/visitors/value', + }, + bindingVersion: { + $ref: '#/visitors/value', + }, + }, + }, + OperationBinding: { + $visitor: IbmmqOperationBindingVisitor, + }, + }, + }, }, }, }, diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts index 7164916855..31ae8272a2 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts @@ -8,6 +8,9 @@ import ChannelElement from '../../../../elements/Channel.ts'; import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; import FallbackVisitor from '../../FallbackVisitor.ts'; +/** + * @public + */ class ChannelVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { declare public readonly element: ChannelElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts index f47ccc3d56..354a1b62c8 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts @@ -11,6 +11,9 @@ export const BaseComponentsVisitor: typeof ComponentsVisitorType = export type { ComponentsVisitorOptions }; +/** + * @public + */ class ComponentsVisitor extends BaseComponentsVisitor { declare public readonly element: ComponentsElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/repliesVisitor.ts similarity index 100% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/repliesVisitor.ts diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/replyAddressesVisitor.ts similarity index 100% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/replyAddressesVisitor.ts diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts index c63f792ff7..2d6ab4f70e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts @@ -11,6 +11,9 @@ export const BaseCorrelationIDVisitor: typeof CorrelationIDVisitorType = export type { CorrelationIDVisitorOptions }; +/** + * @public + */ class CorrelationIDVisitor extends BaseCorrelationIDVisitor { declare public readonly element: CorrelationIDElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts index e0ce87cee9..4229f37f9a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts @@ -11,6 +11,9 @@ export const BaseExternalDocumentationVisitor: typeof ExternalDocumentationVisit export type { ExternalDocumentationVisitorOptions }; +/** + * @public + */ class ExternalDocumentationVisitor extends BaseExternalDocumentationVisitor { declare public readonly element: ExternalDocumentationElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts index 2248aac074..3adbefd105 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts @@ -11,6 +11,9 @@ export const BaseInfoVisitor: typeof InfoVisitorType = export type { InfoVisitorOptions }; +/** + * @public + */ class InfoVisitor extends BaseInfoVisitor { declare public readonly element: InfoElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts index ba4b731ebd..b8352c56b4 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts @@ -11,6 +11,9 @@ export const BaseMessageBindingsVisitor: typeof MessageBindingsVisitorType = export type { MessageBindingsVisitorOptions }; +/** + * @public + */ class MessageBindingsVisitor extends BaseMessageBindingsVisitor { declare public readonly element: MessageBindingsElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts index c6f1b296ed..35c64b571a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts @@ -11,6 +11,9 @@ export const BaseMessageExampleVisitor: typeof MessageExampleVisitorType = export type { MessageExampleVisitorOptions }; +/** + * @public + */ class MessageExampleVisitor extends BaseMessageExampleVisitor { declare public readonly element: MessageExampleElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts index fb5bff7405..25622ba7fb 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts @@ -11,6 +11,9 @@ export const BaseMessageTraitVisitor: typeof MessageTraitVisitorType = export type { MessageTraitVisitorOptions }; +/** + * @public + */ class MessageTraitVisitor extends BaseMessageTraitVisitor { declare public readonly element: MessageTraitElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts index 5a4a257ee4..faae899b0a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts @@ -11,6 +11,9 @@ export const BaseOperationBindingsVisitor: typeof OperationBindingsVisitorType = export type { OperationBindingsVisitorOptions }; +/** + * @public + */ class OperationBindingsVisitor extends BaseOperationBindingsVisitor { declare public readonly element: OperationBindingsElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts index 8c116b0127..d6d9f741e5 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts @@ -7,6 +7,9 @@ import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; import FallbackVisitor from '../../FallbackVisitor.ts'; import { always } from 'ramda'; +/** + * @public + */ class OperationReplyAddressVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { declare public readonly element: OperationReplyAddressElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts index 2f6d541ec0..469e9efd6c 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts @@ -11,6 +11,9 @@ import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; */ export interface MessagesVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} +/** + * @public + */ class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { declare public readonly element: OperationReplyMessagesElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts index afb2910cef..4035a7c1a2 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts @@ -7,6 +7,9 @@ import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; import FallbackVisitor from '../../FallbackVisitor.ts'; import { always } from 'ramda'; +/** + * @public + */ class OperationReplyVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { declare public readonly element: OperationReplyElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts index 360cc4501e..42f3293f49 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts @@ -11,6 +11,9 @@ export const BaseOperationTraitVisitor: typeof OperationTraitVisitorType = export type { OperationTraitVisitorOptions }; +/** + * @public + */ class OperationTraitVisitor extends BaseOperationTraitVisitor { declare public readonly element: OperationTraitElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts index 89ac93e51f..7627e9f322 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts @@ -11,6 +11,9 @@ export const BaseParametersVisitor: typeof ParametersVisitorType = export type { ParametersVisitorOptions }; +/** + * @public + */ class ParametersVisitor extends BaseParametersVisitor { declare public readonly element: ParametersElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts index 97c715390a..fe0b4d2bf1 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts @@ -13,6 +13,9 @@ export const BaseSchemaVisitor: typeof SchemaVisitorType = export type { SchemaVisitorOptions }; +/** + * @public + */ class SchemaVisitor extends BaseSchemaVisitor { declare public element: SchemaElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts index 102c8f8939..e2a5f57621 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts @@ -11,6 +11,9 @@ export const BaseSecuritySchemeVisitor: typeof SecuritySchemeVisitorType = export type { SecuritySchemeVisitorOptions }; +/** + * @public + */ class SecuritySchemeVisitor extends BaseSecuritySchemeVisitor { declare public readonly element: SecuritySchemeElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts index 2e2e22d6a4..da63be9909 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts @@ -11,6 +11,9 @@ export const BaseServerBindingsVisitor: typeof ServerBindingsVisitorType = export type { ServerBindingsVisitorOptions }; +/** + * @public + */ class ServerBindingsVisitor extends BaseServerBindingsVisitor { declare public readonly element: ServerBindingsElement; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts index cc1f5fb549..37d4a7cca3 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts @@ -11,6 +11,9 @@ export interface ExternalDocumentationVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} +/** + * @public + */ class ExternalDocumentationVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { constructor(options: ExternalDocumentationVisitorOptions) { super(options); From 7a81ba06e34ebdbea5f79a7dd5beb8dc491881c6 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Tue, 4 Nov 2025 17:23:37 +0530 Subject: [PATCH 21/27] feat: fix lint issues --- .../config/webpack/browser.config.js | 1 + .../src/elements/AsyncApi3.ts | 19 +- .../src/elements/Channel.ts | 150 +++++------ .../src/elements/ChannelBindings.ts | 2 +- .../src/elements/Channels.ts | 13 +- .../src/elements/Components.ts | 5 +- .../src/elements/DefaultContentType.ts | 2 +- .../apidom-ns-asyncapi-3/src/elements/Info.ts | 3 +- .../src/elements/License.ts | 2 +- .../src/elements/Message.ts | 27 +- .../src/elements/MessageBindings.ts | 2 +- .../src/elements/MessageExample.ts | 4 +- .../src/elements/MessageTrait.ts | 29 +-- .../src/elements/Messages.ts | 10 +- .../src/elements/MultiFormatSchema.ts | 8 +- .../src/elements/OauthFlow.ts | 2 + .../src/elements/OauthFlows.ts | 2 +- .../src/elements/Operation.ts | 2 +- .../src/elements/OperationBindings.ts | 2 +- .../src/elements/OperationReply.ts | 59 ++--- .../src/elements/OperationReplyAddress.ts | 34 +-- .../src/elements/OperationTrait.ts | 39 ++- .../src/elements/Operations.ts | 10 +- .../src/elements/Parameter.ts | 91 ++++--- .../src/elements/Parameters.ts | 2 +- .../src/elements/Schema.ts | 2 +- .../src/elements/SecurityScheme.ts | 1 - .../src/elements/Server.ts | 67 +++-- .../src/elements/ServerBindings.ts | 4 +- .../apidom-ns-asyncapi-3/src/elements/Tag.ts | 7 +- .../apidom-ns-asyncapi-3/src/elements/Tags.ts | 2 +- .../GooglepubsubOperationBinding.ts | 2 +- .../elements/bindings/jms/JmsServerBinding.ts | 2 +- .../bindings/sns/SnsChannelBinding.ts | 2 +- .../src/elements/nces/ChannelServers.ts | 2 +- .../src/elements/nces/ComponentsChannels.ts | 2 +- .../src/elements/nces/ComponentsOperations.ts | 10 +- .../src/elements/nces/ComponentsTags.ts | 2 +- packages/apidom-ns-asyncapi-3/src/index.ts | 2 +- .../apidom-ns-asyncapi-3/src/media-types.ts | 2 +- .../apidom-ns-asyncapi-3/src/namespace.ts | 3 +- .../apidom-ns-asyncapi-3/src/predicates.ts | 5 +- .../src/refractor/index.ts | 2 +- .../plugins/replace-empty-element.ts | 66 ++--- .../src/refractor/predicates.ts | 9 +- .../src/refractor/registration.ts | 2 +- .../src/refractor/specification.ts | 232 ++++++++++++------ .../async-api-3/DefaultContentTypeVisitor.ts | 4 +- .../bindings/amqp/channel-binding/index.ts | 2 +- .../visitors/async-api-3/bindings/index.ts | 7 +- .../async-api-3/channel/BindingsVisitor.ts | 3 +- .../async-api-3/channel/ServersVisitor.ts | 4 +- .../visitors/async-api-3/channel/index.ts | 8 +- .../async-api-3/components/ChannelsVisitor.ts | 2 +- .../ExternalDocumentationVisitor.ts | 2 +- .../components/OperationsVisitor.ts | 2 +- .../{repliesVisitor.ts => RepliesVisitor.ts} | 2 +- ...sesVisitor.ts => ReplyAddressesVisitor.ts} | 2 +- .../async-api-3/components/SchemasVisitor.ts | 2 +- .../async-api-3/components/TagsVisitor.ts | 2 +- .../visitors/async-api-3/components/index.ts | 2 +- .../async-api-3/correlation-id/index.ts | 2 +- ...ExternalDocumentationOrReferenceVisitor.ts | 2 +- .../external-documentation-object/index.ts | 20 +- .../visitors/async-api-3/info/info.ts | 2 +- .../async-api-3/message-bindings/index.ts | 2 +- .../async-api-3/message-example/index.ts | 2 +- .../message-trait/HeadersVisitor.ts | 12 +- .../async-api-3/message-trait/index.ts | 4 +- .../async-api-3/message/BindingsVisitor.ts | 3 +- .../message/CorrelationIdVisitor.ts | 2 +- .../async-api-3/message/HeadersVisitor.ts | 12 +- .../async-api-3/message/PayloadVisitor.ts | 2 +- .../visitors/async-api-3/message/index.ts | 2 +- .../visitors/async-api-3/messages/index.ts | 2 +- .../async-api-3/multiFormatSchema/index.ts | 2 +- .../visitors/async-api-3/oauth-flow/index.ts | 4 +- .../visitors/async-api-3/oauth-flows/index.ts | 4 +- .../async-api-3/operation-bindings/index.ts | 2 +- .../operation-reply-address/index.ts | 7 +- .../operation-reply/AddressVisitor.ts | 2 +- .../operation-reply/MessagesVisitor.ts | 8 +- .../async-api-3/operation-reply/index.ts | 10 +- .../async-api-3/operation-trait/index.ts | 4 +- .../async-api-3/operation/BindingsVisitor.ts | 3 +- .../async-api-3/operation/ChannelVisitor.ts | 2 +- .../async-api-3/operation/MessagesVisitor.ts | 2 +- .../async-api-3/operation/ReplyVisitor.ts | 3 +- .../async-api-3/operation/SecurityVisitor.ts | 2 +- .../visitors/async-api-3/operation/index.ts | 4 +- .../visitors/async-api-3/operations/index.ts | 2 +- .../visitors/async-api-3/reference/index.ts | 2 +- .../schema/SchemaOrReferenceVisitor.ts | 3 +- .../visitors/async-api-3/schema/index.ts | 2 +- .../schema/inherited-fixed-fields.ts | 2 +- .../security-scheme/ScopesVisitor.ts | 4 +- .../async-api-3/security-scheme/index.ts | 2 +- .../async-api-3/server-bindings/index.ts | 2 +- .../async-api-3/server/SecurityVisitor.ts | 2 +- .../visitors/async-api-3/servers/index.ts | 2 +- .../visitors/async-api-3/tag/index.ts | 7 +- .../visitors/async-api-3/tags/index.ts | 2 +- .../generics/ExternalDocumentationVisitor.ts | 9 +- packages/apidom-ns-asyncapi-3/test/index.ts | 68 ----- 104 files changed, 633 insertions(+), 596 deletions(-) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/{repliesVisitor.ts => RepliesVisitor.ts} (97%) rename packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/{replyAddressesVisitor.ts => ReplyAddressesVisitor.ts} (97%) diff --git a/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js b/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js index 78f6c65dbc..16089982b3 100644 --- a/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js +++ b/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js @@ -1,4 +1,5 @@ import path from 'node:path'; + import { nonMinimizeTrait, minimizeTrait } from './traits.config.js'; const browser = { diff --git a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts index e5599ac221..ab172565f3 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts @@ -1,8 +1,15 @@ -import { Attributes, Meta } from '@swagger-api/apidom-core'; +import { Attributes, Meta } from '@swagger-api/apidom-core'; import { UnsupportedOperationError } from '@swagger-api/apidom-error'; -import { ExternalDocumentationElement, AsyncApi2Element, TagsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { + ExternalDocumentationElement, + AsyncApi2Element, + TagsElement, +} from '@swagger-api/apidom-ns-asyncapi-2'; + import OperationElement from './Operation.ts'; +/* eslint-disable class-methods-use-this */ + /** * @public */ @@ -11,7 +18,7 @@ class AsyncApi3 extends AsyncApi2Element { super(content, meta, attributes); this.element = 'asyncApi3'; } - + get tags(): TagsElement | undefined { throw new UnsupportedOperationError( 'TagsElement keyword from Core vocabulary has been moved to Info.', @@ -19,11 +26,11 @@ class AsyncApi3 extends AsyncApi2Element { } set tags(tags: TagsElement | undefined) { - throw new UnsupportedOperationError( + throw new UnsupportedOperationError( 'TagsElement keyword from Core vocabulary has been moved to Info.', ); } - + get externalDocs(): ExternalDocumentationElement | undefined { throw new UnsupportedOperationError( 'ExternalDocsElement keyword from Core vocabulary has been moved to Info.', @@ -31,7 +38,7 @@ class AsyncApi3 extends AsyncApi2Element { } set externalDocs(externalDocs: ExternalDocumentationElement | undefined) { - throw new UnsupportedOperationError( + throw new UnsupportedOperationError( 'ExternalDocsElement keyword from Core vocabulary has been moved to Info.', ); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts b/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts index bb188100b1..2a431a37f7 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts @@ -1,6 +1,7 @@ import { ObjectElement, Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; -import MessagesElement from './Messages.ts'; import type { ArrayElement } from '@swagger-api/apidom-core'; + +import MessagesElement from './Messages.ts'; import ParametersElement from './Parameters.ts'; import TagsElement from './Tags.ts'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; @@ -11,76 +12,82 @@ import ChannelBindingsElement from './ChannelBindings.ts'; * @public */ class Channel extends ObjectElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'channel'; - } - - get address(): StringElement | null { - return this.get('address'); - } - + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'channel'; + } + + get address(): StringElement | null { + return this.get('address'); + } + set address(address: StringElement | null) { - this.set('address', address); - } - - get messages(): MessagesElement | undefined { - return this.get('messages'); - } - - set messages(messages: MessagesElement | undefined) { - this.set('messages', messages); - } - - get title(): StringElement | undefined { - return this.get('title'); - } - set title(title: StringElement | undefined) { - this.set('title', title); - } - - get description(): StringElement | undefined { - return this.get('description'); - } - set description(description: StringElement | undefined) { - this.set('description', description); - } - - get summary(): StringElement | undefined { - return this.get('summary'); - } - set summary(summary: StringElement | undefined) { - this.set('summary', summary); - } - - get servers(): ArrayElement | undefined { - return this.get('servers'); - } - - set servers(servers: import('@swagger-api/apidom-core').ArrayElement | undefined) { - this.set('servers', servers); - } - - get parameters(): ParametersElement | undefined { - return this.get('parameters'); - } - set parameters(parameters: ParametersElement | undefined) { - this.set('parameters', parameters); - } - - get tags(): TagsElement | undefined { - return this.get('tags'); - } - set tags(tags: TagsElement | undefined) { - this.set('tags', tags); - } - - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { - return this.get('externalDocs'); - } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { - this.set('externalDocs', externalDocs); - } + this.set('address', address); + } + + get messages(): MessagesElement | undefined { + return this.get('messages'); + } + + set messages(messages: MessagesElement | undefined) { + this.set('messages', messages); + } + + get title(): StringElement | undefined { + return this.get('title'); + } + + set title(title: StringElement | undefined) { + this.set('title', title); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(description: StringElement | undefined) { + this.set('description', description); + } + + get summary(): StringElement | undefined { + return this.get('summary'); + } + + set summary(summary: StringElement | undefined) { + this.set('summary', summary); + } + + get servers(): ArrayElement | undefined { + return this.get('servers'); + } + + set servers(servers: import('@swagger-api/apidom-core').ArrayElement | undefined) { + this.set('servers', servers); + } + + get parameters(): ParametersElement | undefined { + return this.get('parameters'); + } + + set parameters(parameters: ParametersElement | undefined) { + this.set('parameters', parameters); + } + + get tags(): TagsElement | undefined { + return this.get('tags'); + } + + set tags(tags: TagsElement | undefined) { + this.set('tags', tags); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } get bindings(): ChannelBindingsElement | undefined { return this.get('bindings'); @@ -89,7 +96,6 @@ class Channel extends ObjectElement { set bindings(bindings: ChannelBindingsElement | undefined) { this.set('bindings', bindings); } - } -export default Channel; \ No newline at end of file +export default Channel; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts index 6800e64fd2..39116fc8c9 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/ChannelBindings.ts @@ -1,4 +1,4 @@ -import { ChannelBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; +import { ChannelBindingsElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts b/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts index ac7f9fa352..62a5d2da59 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts @@ -1,5 +1,6 @@ import { Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; -import {ChannelsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { ChannelsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + import ChannelElement from './Channel.ts'; /** @@ -12,13 +13,13 @@ class Channels extends ChannelsElement { } get channel(): ChannelElement | undefined { - return this.get('channel'); - } - + return this.get('channel'); + } + set channel(channel: ChannelElement | undefined) { - this.set('channel', channel); + this.set('channel', channel); } - + get $ref(): StringElement | undefined { return this.get('$ref'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Components.ts b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts index 2d0b4e2616..6ba6928814 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Components.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts @@ -1,7 +1,8 @@ import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; -import TagsElement from './Tags.ts'; import { ComponentsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import TagsElement from './Tags.ts'; + /** * @public */ @@ -9,7 +10,7 @@ class Components extends ComponentsElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'components'; - } + } get operations(): ObjectElement | undefined { return this.get('operations'); diff --git a/packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts b/packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts index d54947691f..7ffac26c79 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/DefaultContentType.ts @@ -3,6 +3,6 @@ import { DefaultContentTypeElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ -class DefaultContentType extends DefaultContentTypeElement {} +class DefaultContentType extends DefaultContentTypeElement {} export default DefaultContentType; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Info.ts b/packages/apidom-ns-asyncapi-3/src/elements/Info.ts index c07506815f..53471e102a 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Info.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Info.ts @@ -1,5 +1,6 @@ import { Attributes, Meta } from '@swagger-api/apidom-core'; import { InfoElement } from '@swagger-api/apidom-ns-asyncapi-2'; + import TagsElement from './Tags.ts'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; @@ -21,7 +22,7 @@ class Info extends InfoElement { this.set('tags', tags); } - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { return this.get('externalDocs'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/License.ts b/packages/apidom-ns-asyncapi-3/src/elements/License.ts index cb898a8fb1..4f1e28e713 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/License.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/License.ts @@ -5,4 +5,4 @@ import { LicenseElement } from '@swagger-api/apidom-ns-asyncapi-2'; */ class License extends LicenseElement {} -export default License; \ No newline at end of file +export default License; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Message.ts b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts index 3a3745bde7..57afab2677 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Message.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts @@ -1,11 +1,19 @@ import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; -import { CorrelationIDElement, ExternalDocumentationElement, MessageBindingsElement, MessageElement, TagsElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { + CorrelationIDElement, + ExternalDocumentationElement, + MessageBindingsElement, + TagsElement, +} from '@swagger-api/apidom-ns-asyncapi-2'; + import MultiformatSchemaElement from './MultiFormatSchema.ts'; import SchemaElement from './Schema.ts'; import ReferenceElement from './Reference.ts'; import MessageExampleElement from './MessageExample.ts'; import MessageTrait from './MessageTrait.ts'; +/* eslint-disable class-methods-use-this */ + /** * @public */ @@ -16,18 +24,18 @@ class Message extends ObjectElement { } get headers(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined { - return this.get('headers') + return this.get('headers'); } - set headers(headers: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined ) { - this.set('headers', headers) + set headers(headers: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined) { + this.set('headers', headers); } - get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined { + get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined { return this.get('payload'); } - set payload(payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined ) { + set payload(payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined) { this.set('payload', payload); } @@ -87,15 +95,14 @@ class Message extends ObjectElement { this.set('tags', tags); } - - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement |ReferenceElement | undefined) { + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { this.set('externalDocs', externalDocs); } - + get bindings(): MessageBindingsElement | ReferenceElement | undefined { return this.get('bindings'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts index 5b95bc3283..11b489fc70 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageBindings.ts @@ -1,4 +1,4 @@ -import { MessageBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; +import { MessageBindingsElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts b/packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts index f29da61607..5901151bd7 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageExample.ts @@ -1,8 +1,8 @@ -import { MessageExampleElement } from "@swagger-api/apidom-ns-asyncapi-2"; +import { MessageExampleElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ class MessageExample extends MessageExampleElement {} -export default MessageExample; \ No newline at end of file +export default MessageExample; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts b/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts index 1f2eb7f5f0..0ce00d5abe 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts @@ -1,15 +1,13 @@ -import { - StringElement, - Attributes, - Meta, -} from '@swagger-api/apidom-core'; +import { StringElement, Attributes, Meta } from '@swagger-api/apidom-core'; +import { MessageTraitElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; import SchemaElement from './Schema.ts'; import MultiFormatSchema from './MultiFormatSchema.ts'; -import { MessageTraitElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import { UnsupportedOperationError } from '@swagger-api/apidom-error'; + +/* eslint-disable class-methods-use-this */ /** * @public @@ -21,21 +19,18 @@ class MessageTrait extends MessageTraitElement { } get messageId(): StringElement | undefined { - throw new UnsupportedOperationError( - 'messageId keyword from Core vocabulary has been removed', - ); + throw new UnsupportedOperationError('messageId keyword from Core vocabulary has been removed'); } set messageId(messageId: StringElement | undefined) { - throw new UnsupportedOperationError( - 'messageId keyword from Core vocabulary has been removed', - ); + throw new UnsupportedOperationError('messageId keyword from Core vocabulary has been removed'); } - get headers(): MultiFormatSchema| SchemaElement | ReferenceElement | undefined | any { + + get headers(): MultiFormatSchema | SchemaElement | ReferenceElement | undefined | any { return this.get('headers'); } - set headers(headers: MultiFormatSchema | SchemaElement | ReferenceElement | undefined | any) { + set headers(headers: MultiFormatSchema | SchemaElement | ReferenceElement | undefined | any) { this.set('headers', headers); } @@ -43,7 +38,9 @@ class MessageTrait extends MessageTraitElement { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { this.set('externalDocs', externalDocs); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Messages.ts b/packages/apidom-ns-asyncapi-3/src/elements/Messages.ts index 8c4c1a97eb..231e952be5 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Messages.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Messages.ts @@ -4,10 +4,10 @@ import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; * @public */ class Messages extends ObjectElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'messages'; - } + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'messages'; + } } -export default Messages; \ No newline at end of file +export default Messages; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts index d39eb74f1f..674117dd8f 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts @@ -10,13 +10,13 @@ class MultiFormatSchema extends ObjectElement { } get schemaFormat(): StringElement | undefined { - return this.get('schemaForamt') + return this.get('schemaForamt'); } - set schemaFormat(schemaFormat: StringElement | undefined ) { - this.set('schemaFormat', schemaFormat); + set schemaFormat(schemaFormat: StringElement | undefined) { + this.set('schemaFormat', schemaFormat); } - + get schema() { return this.get('schema'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts index 3f5c609090..201f5b3e53 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts @@ -2,6 +2,8 @@ import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; import { UnsupportedOperationError } from '@swagger-api/apidom-error'; import { OAuthFlowElement } from '@swagger-api/apidom-ns-asyncapi-2'; +/* eslint-disable class-methods-use-this */ + /** * @public */ diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts index 271d6c7541..3408a9ab23 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts @@ -5,4 +5,4 @@ import { OAuthFlowsElement } from '@swagger-api/apidom-ns-asyncapi-2'; */ class OAuthFlows extends OAuthFlowsElement {} -export default OAuthFlows; \ No newline at end of file +export default OAuthFlows; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts index 3c58b4fa37..6e94a6f234 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts @@ -5,6 +5,7 @@ import { ObjectElement, StringElement, } from '@swagger-api/apidom-core'; + import ReferenceElement from './Reference.ts'; import OperationTraitElement from './OperationTrait.ts'; @@ -80,7 +81,6 @@ class Operation extends ObjectElement { set traits(OperationTrait: OperationTraitElement | undefined) { this.set('traits', OperationTrait); } - } export default Operation; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts index 2b6f5ca131..4cf6a2358e 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationBindings.ts @@ -1,4 +1,4 @@ -import { OperationBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; +import { OperationBindingsElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts index 657b4e7dc0..9feba3d235 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts @@ -1,4 +1,5 @@ import { ObjectElement, Attributes, Meta, ArrayElement } from '@swagger-api/apidom-core'; + import OperationReplyAddress from './OperationReplyAddress.ts'; import ReferenceElement from './Reference.ts'; @@ -6,34 +7,34 @@ import ReferenceElement from './Reference.ts'; * @public */ class OperationReply extends ObjectElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'operationReply'; - } - - get address(): OperationReplyAddress | ReferenceElement | undefined { - return this.get('address'); - } - - set address(address: OperationReplyAddress | ReferenceElement | undefined) { - this.set('address', address); - } - - get channel(): ReferenceElement | undefined { - return this.get('channel'); - } - - set channel(channel: ReferenceElement | undefined) { - this.set('channel', channel); - } - - get message(): ArrayElement | undefined { - return this.get('message'); - } - - set message(message: ArrayElement | undefined) { - this.set('message', message); - } + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operationReply'; + } + + get address(): OperationReplyAddress | ReferenceElement | undefined { + return this.get('address'); + } + + set address(address: OperationReplyAddress | ReferenceElement | undefined) { + this.set('address', address); + } + + get channel(): ReferenceElement | undefined { + return this.get('channel'); + } + + set channel(channel: ReferenceElement | undefined) { + this.set('channel', channel); + } + + get message(): ArrayElement | undefined { + return this.get('message'); + } + + set message(message: ArrayElement | undefined) { + this.set('message', message); + } } -export default OperationReply; \ No newline at end of file +export default OperationReply; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts index a0123f7d4b..737286780c 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationReplyAddress.ts @@ -4,26 +4,26 @@ import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/api * @public */ class OperationReplyAddress extends ObjectElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'operationReplyAddress'; - } + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operationReplyAddress'; + } - get description(): StringElement | undefined { - return this.get('description'); - } + get description(): StringElement | undefined { + return this.get('description'); + } - set description(value: StringElement | undefined) { - this.set('description', value); - } + set description(value: StringElement | undefined) { + this.set('description', value); + } - get location(): StringElement | undefined { - return this.get('location'); - } + get location(): StringElement | undefined { + return this.get('location'); + } - set location(value: StringElement | undefined) { - this.set('location', value); - } + set location(value: StringElement | undefined) { + this.set('location', value); + } } -export default OperationReplyAddress; \ No newline at end of file +export default OperationReplyAddress; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts index e79acddb08..e61398f058 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts @@ -1,14 +1,11 @@ -import { - StringElement, - Attributes, - Meta, - ObjectElement, -} from '@swagger-api/apidom-core'; +import { StringElement, Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; +import { OperationTraitElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; -import { OperationTraitElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import { UnsupportedOperationError } from '@swagger-api/apidom-error'; + +/* eslint-disable class-methods-use-this */ /** * @public @@ -19,17 +16,17 @@ class OperationTrait extends OperationTraitElement { this.element = 'operationTrait'; } -get operationId(): ObjectElement | undefined { - throw new UnsupportedOperationError( - 'operationId keyword from Core vocabulary has been removed', - ); -} + get operationId(): ObjectElement | undefined { + throw new UnsupportedOperationError( + 'operationId keyword from Core vocabulary has been removed', + ); + } -set operationId(operationId: ObjectElement | undefined) { - throw new UnsupportedOperationError( - 'operationId keyword from Core vocabulary has been removed', - ); -} + set operationId(operationId: ObjectElement | undefined) { + throw new UnsupportedOperationError( + 'operationId keyword from Core vocabulary has been removed', + ); + } get title(): StringElement | undefined { return this.get('title'); @@ -39,11 +36,13 @@ set operationId(operationId: ObjectElement | undefined) { this.set('title', title); } - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any{ + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { this.set('externalDocs', externalDocs); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Operations.ts b/packages/apidom-ns-asyncapi-3/src/elements/Operations.ts index e28653667d..b74875f1d2 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Operations.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Operations.ts @@ -4,10 +4,10 @@ import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; * @public */ class Operations extends ObjectElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'operations'; - } + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'operations'; + } } -export default Operations; \ No newline at end of file +export default Operations; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts b/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts index d3d131c2bf..bd8285f57a 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts @@ -4,50 +4,49 @@ import { ObjectElement, StringElement, ArrayElement } from '@swagger-api/apidom- * @public */ class Parameter extends ObjectElement { - constructor(content: any = {}, meta?: any, attributes?: any) { - super(content, meta, attributes); - this.element = 'parameter'; - } - - get enum(): ArrayElement| undefined { - return this.get('enum'); - } - - set enum(value: ArrayElement | undefined) { - this.set('enum', value); - } - - get default(): StringElement | undefined { - return this.get('default'); - } - - set default(value: StringElement | undefined) { - this.set('default', value); - } - - get description(): StringElement | undefined { - return this.get('description'); - } - - set description(value: StringElement | undefined) { - this.set('description', value); - } - - get examples(): ArrayElement | undefined { - return this.get('examples'); - } - - set examples(value: ArrayElement | undefined) { - this.set('examples', value); - } - - get location(): StringElement | undefined { - return this.get('location'); - } - - set location(value: StringElement | undefined) { - this.set('location', value); - } - + constructor(content: any = {}, meta?: any, attributes?: any) { + super(content, meta, attributes); + this.element = 'parameter'; + } + + get enum(): ArrayElement | undefined { + return this.get('enum'); + } + + set enum(value: ArrayElement | undefined) { + this.set('enum', value); + } + + get default(): StringElement | undefined { + return this.get('default'); + } + + set default(value: StringElement | undefined) { + this.set('default', value); + } + + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(value: StringElement | undefined) { + this.set('description', value); + } + + get examples(): ArrayElement | undefined { + return this.get('examples'); + } + + set examples(value: ArrayElement | undefined) { + this.set('examples', value); + } + + get location(): StringElement | undefined { + return this.get('location'); + } + + set location(value: StringElement | undefined) { + this.set('location', value); + } } - export default Parameter; \ No newline at end of file +export default Parameter; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts b/packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts index 0fdcab0709..96b55adefe 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Parameters.ts @@ -5,4 +5,4 @@ import { ParametersElement } from '@swagger-api/apidom-ns-asyncapi-2'; */ class Parameters extends ParametersElement {} -export default Parameters; \ No newline at end of file +export default Parameters; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts index 71ce6fc9ce..bfe44e2bce 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts @@ -5,4 +5,4 @@ import { SchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; */ class Schema extends SchemaElement {} -export default Schema; \ No newline at end of file +export default Schema; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts index f420ea0d52..af0d048ede 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts @@ -18,7 +18,6 @@ class SecurityScheme extends SecuritySchemeElement { set scopes(scopes: ArrayElement | undefined) { this.set('scopes', scopes); } - } export default SecurityScheme; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts index 78c2580643..4354f9c0e3 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -1,63 +1,62 @@ import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; import { ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; + import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; -import { UnsupportedOperationError } from '@swagger-api/apidom-error'; + +/* eslint-disable class-methods-use-this */ /** * @public */ class Server extends ServerElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'server'; } - get url(): ObjectElement | undefined { - throw new UnsupportedOperationError( - 'url keyword from Core vocabulary has been removed', - ); - } + get url(): ObjectElement | undefined { + throw new UnsupportedOperationError('url keyword from Core vocabulary has been removed'); + } - set url(url: ObjectElement | undefined) { - throw new UnsupportedOperationError( - 'url keyword from Core vocabulary has been removed', - ); - } + set url(url: ObjectElement | undefined) { + throw new UnsupportedOperationError('url keyword from Core vocabulary has been removed'); + } - get host(): StringElement | undefined { - return this.get('host'); + get host(): StringElement | undefined { + return this.get('host'); } set host(host: StringElement | undefined) { this.set('host', host); } - get pathName(): StringElement | undefined { - return this.get('pathName'); - } + get pathName(): StringElement | undefined { + return this.get('pathName'); + } - set pathName(pathName: StringElement | undefined) { - this.set('pathName', pathName); - } + set pathName(pathName: StringElement | undefined) { + this.set('pathName', pathName); + } + + get title(): StringElement | undefined { + return this.get('title'); + } - get title(): StringElement | undefined { - return this.get('title'); - } + set title(title: StringElement | undefined) { + this.set('title', title); + } - set title(title: StringElement | undefined) { - this.set('title', title); - } + get summary(): StringElement | undefined { + return this.get('summary'); + } - get summary(): StringElement | undefined { - return this.get('summary'); - } + set summary(summary: StringElement | undefined) { + this.set('summary', summary); + } - set summary(summary: StringElement | undefined) { - this.set('summary', summary); - } - - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { return this.get('externalDocs'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts b/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts index 66f95bf51b..8e18bf15ff 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts @@ -1,8 +1,8 @@ -import { ServerBindingsElement } from "@swagger-api/apidom-ns-asyncapi-2"; +import { ServerBindingsElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ class ServerBindings extends ServerBindingsElement {} -export default ServerBindings; \ No newline at end of file +export default ServerBindings; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts index a09ead1100..07d788da17 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts @@ -1,7 +1,8 @@ import { Attributes, Meta } from '@swagger-api/apidom-core'; +import { TagElement } from '@swagger-api/apidom-ns-asyncapi-2'; + import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; -import { TagElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public @@ -16,7 +17,9 @@ class Tag extends TagElement { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { this.set('externalDocs', externalDocs); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Tags.ts b/packages/apidom-ns-asyncapi-3/src/elements/Tags.ts index 90bb1307e2..8efa1be72d 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Tags.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Tags.ts @@ -5,4 +5,4 @@ import { TagsElement } from '@swagger-api/apidom-ns-asyncapi-2'; */ class Tags extends TagsElement {} -export default Tags; \ No newline at end of file +export default Tags; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts index e5299631e0..0884c36ba9 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts @@ -1,7 +1,7 @@ import { GooglepubsubOperationBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** - * @public + * @public */ class GooglepubsubOperationBinding extends GooglepubsubOperationBindingElement {} diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts index 43a15b549d..c1ac90afc3 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts @@ -1,7 +1,7 @@ import { JmsServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** - * @public + * @public */ class JmsServerBinding extends JmsServerBindingElement {} diff --git a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts index be1e816a5c..8cf0e96bd3 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts @@ -1,7 +1,7 @@ import { SnsChannelBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** - * @public + * @public */ class SnsChannelBinding extends SnsChannelBindingElement {} diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts index e827080fee..7dfa270de1 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts @@ -11,4 +11,4 @@ class ChannelServers extends ArrayElement { } } -export default ChannelServers; \ No newline at end of file +export default ChannelServers; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts index c46e6ad0a1..bbbbeef190 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsChannels.ts @@ -5,4 +5,4 @@ import { ComponentsChannelsElement } from '@swagger-api/apidom-ns-asyncapi-2'; */ class ComponentsChannels extends ComponentsChannelsElement {} -export default ComponentsChannels; \ No newline at end of file +export default ComponentsChannels; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts index 29b3e58225..3f8ae04a20 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts @@ -3,12 +3,12 @@ import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; * @public */ class ComponentOperations extends ArrayElement { - static primaryClass = 'components-operations'; + static primaryClass = 'components-operations'; - constructor(content?: Array, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.classes.push(ComponentOperations.primaryClass); - } + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ComponentOperations.primaryClass); + } } export default ComponentOperations; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts index b62e1ccb7b..73bc2481c1 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts @@ -11,4 +11,4 @@ class ComponentsTags extends ObjectElement { } } -export default ComponentsTags; \ No newline at end of file +export default ComponentsTags; diff --git a/packages/apidom-ns-asyncapi-3/src/index.ts b/packages/apidom-ns-asyncapi-3/src/index.ts index 49f19b30d4..fd85201e45 100644 --- a/packages/apidom-ns-asyncapi-3/src/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/index.ts @@ -147,4 +147,4 @@ export { WebSocketMessageBindingElement, WebSocketOperationBindingElement, WebSocketServerBindingElement, -} from './refractor/registration.ts'; \ No newline at end of file +} from './refractor/registration.ts'; diff --git a/packages/apidom-ns-asyncapi-3/src/media-types.ts b/packages/apidom-ns-asyncapi-3/src/media-types.ts index 71f364562f..f577e332ac 100644 --- a/packages/apidom-ns-asyncapi-3/src/media-types.ts +++ b/packages/apidom-ns-asyncapi-3/src/media-types.ts @@ -42,4 +42,4 @@ const mediaTypes = new AsyncAPIMediaTypes( 'application/vnd.aai.asyncapi+yaml;version=3.0.1', ); -export default mediaTypes; \ No newline at end of file +export default mediaTypes; diff --git a/packages/apidom-ns-asyncapi-3/src/namespace.ts b/packages/apidom-ns-asyncapi-3/src/namespace.ts index 650182f284..f7f9b27ef7 100644 --- a/packages/apidom-ns-asyncapi-3/src/namespace.ts +++ b/packages/apidom-ns-asyncapi-3/src/namespace.ts @@ -39,7 +39,6 @@ import ServersElement from './elements/Servers.ts'; import ServerVariableElement from './elements/ServerVariable.ts'; import TagElement from './elements/Tag.ts'; import TagsElement from './elements/Tags.ts'; - /** * Binding elements. */ @@ -286,4 +285,4 @@ const asyncApi3 = { }, }; -export default asyncApi3; \ No newline at end of file +export default asyncApi3; diff --git a/packages/apidom-ns-asyncapi-3/src/predicates.ts b/packages/apidom-ns-asyncapi-3/src/predicates.ts index f645c2a322..f581543f5e 100644 --- a/packages/apidom-ns-asyncapi-3/src/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/predicates.ts @@ -1,4 +1,5 @@ import { createPredicate, isElement } from '@swagger-api/apidom-core'; + import MultiFormatSchemaElement from './elements/MultiFormatSchema.ts'; import AsyncApiVersionElement from './elements/AsyncApiVersion.ts'; import ChannelBindingsElement from './elements/ChannelBindings.ts'; @@ -15,7 +16,7 @@ import ParameterElement from './elements/Parameter.ts'; import ReferenceElement from './elements/Reference.ts'; import SchemaElement from './elements/Schema.ts'; import ServerElement from './elements/Server.ts'; -import ServersElement from './elements/Server.ts'; +import ServersElement from './elements/Servers.ts'; import ServerBindingsElement from './elements/ServerBindings.ts'; import ServerVariableElement from './elements/ServerVariable.ts'; @@ -269,4 +270,4 @@ export const isMultiFormatSchemaElement = createPredicate( isElementType('multiFormatSchema', element) && primitiveEq('object', element)); }, -); \ No newline at end of file +); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/index.ts index 2802254499..11d1444988 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/index.ts @@ -43,4 +43,4 @@ export const createRefractor = (value: unknown, options = {}) => refract(value, { ...options, specPath }); -export default refract; \ No newline at end of file +export default refract; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts index a89de67b4c..5db38b4994 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts @@ -12,6 +12,25 @@ import { isStringElement, toValue, } from '@swagger-api/apidom-core'; +import { + ComponentsChannelBindingsElement, + ComponentsCorrelationIDsElement, + ComponentsMessageBindingsElement, + ComponentsMessageTraitsElement, + ComponentsMessagesElement, + ComponentsOperationBindingsElement, + ComponentsOperationTraitsElement, + ComponentsParametersElement, + ComponentsSecuritySchemesElement, + ComponentsServerBindingsElement, + ComponentsServerVariablesElement, + ComponentsServersElement, + MessageTraitExamplesElement, + OperationMessageMapElement, + SecurityRequirementElement, + ServerSecurityElement, + ServerVariablesElement, +} from '@swagger-api/apidom-ns-asyncapi-2'; import mediaTypes from '../../media-types.ts'; import AsyncApiVersionElement from '../../elements/AsyncApiVersion.ts'; @@ -51,7 +70,6 @@ import OperationsElement from '../../elements/Operations.ts'; import TagElement from '../../elements/Tag.ts'; import MessageExampleElement from '../../elements/MessageExample.ts'; import ReferenceElement from '../../elements/Reference.ts'; - // binding elements import AmqpChannelBindingElement from '../../elements/bindings/amqp/AmqpChannelBinding.ts'; import AmqpMessageBindingElement from '../../elements/bindings/amqp/AmqpMessageBinding.ts'; @@ -129,7 +147,6 @@ import WebSocketChannelBindingElement from '../../elements/bindings/ws/WebSocket import WebSocketMessageBindingElement from '../../elements/bindings/ws/WebSocketMessageBinding.ts'; import WebSocketOperationBindingElement from '../../elements/bindings/ws/WebSocketOperationBinding.ts'; import WebSocketServerBindingElement from '../../elements/bindings/ws/WebSocketServerBinding.ts'; - // nces / helper collections import ComponentsOperationsElement from '../../elements/nces/ComponentsOperations.ts'; import ChannelServersElement from '../../elements/nces/ChannelServers.ts'; @@ -142,28 +159,7 @@ import OperationSecurityElement from '../../elements/nces/OperationSecurity.ts'; import OperationTraitsElement from '../../elements/nces/OperationTraits.ts'; import OperationTraitSecurityElement from '../../elements/nces/OperationTraitSecurity.ts'; import SecuritySchemeScopesElement from '../../elements/nces/SecuritySchemeScopes.ts'; - // borrowed AsyncAPI 2 NCEs -import { - ComponentsChannelBindingsElement, - ComponentsCorrelationIDsElement, - ComponentsMessageBindingsElement, - ComponentsMessageTraitsElement, - ComponentsMessagesElement, - ComponentsOperationBindingsElement, - ComponentsOperationTraitsElement, - ComponentsParametersElement, - ComponentsSecuritySchemesElement, - ComponentsServerBindingsElement, - ComponentsServerVariablesElement, - ComponentsServersElement, - MessageTraitExamplesElement, - OperationMessageMapElement, - SecurityRequirementElement, - ServerSecurityElement, - ServerVariablesElement -} from '@swagger-api/apidom-ns-asyncapi-2'; - import { getNodeType } from '../../traversal/visitor.ts'; /** * This plugin targets YAML 1.2 empty nodes. When a mapping value is omitted, @@ -306,7 +302,7 @@ const schema: Record = { }, ChannelAddressExpressionsElement: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: any[]) { return new ChannelAddressExpressionsElement(...args); }, }, @@ -377,7 +373,7 @@ const schema: Record = { }, }, - ParametersElement: { + ParametersElement: { '[key: *]': function key(...args: any[]) { return new ParameterElement(...args); }, @@ -512,7 +508,6 @@ const schema: Record = { }, }, - OperationBindingsElement: { http(...args: any[]) { return new HttpOperationBindingElement(...args); @@ -573,7 +568,7 @@ const schema: Record = { }, }, - MessageBindingsElement: { + MessageBindingsElement: { http(...args: any[]) { return new HttpMessageBindingElement(...args); }, @@ -657,8 +652,14 @@ const schema: Record = { }, payload(...args: any[]) { const { context: messageElement } = this as { context: MessageElement }; - const schemaFormat = defaultTo(mediaTypes.latest(), toValue(messageElement.get('schemaFormat'))); - const multiFormatSchema = defaultTo(mediaTypes.latest(), toValue(messageElement.get('multiFormatSchema'))); + const schemaFormat = defaultTo( + mediaTypes.latest(), + toValue(messageElement.get('schemaFormat')), + ); + const multiFormatSchema = defaultTo( + mediaTypes.latest(), + toValue(messageElement.get('multiFormatSchema')), + ); if (mediaTypes.includes(schemaFormat)) { return new SchemaElement(...args); } @@ -754,7 +755,7 @@ const schema: Record = { return new ComponentsOperationsElement(...args); }, replies(...args: any[]) { - return new OperationReplyElement(...args); + return new OperationReplyElement(...args); }, replyAddresses(...args: any[]) { return new OperationReplyAddressElement(...args); @@ -848,14 +849,13 @@ const schema: Record = { }, }, - SecuritySchemeElement: { flows(...args: any[]) { return new OAuthFlowsElement(...args); }, scopes(...args: any[]) { return new ArrayElement(...args); - }, + }, }, OAuthFlowsElement: { @@ -1233,4 +1233,4 @@ const plugin = () => () => ({ }, }); -export default plugin; \ No newline at end of file +export default plugin; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts index 703fcec32b..a46bee4cfd 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts @@ -1,5 +1,11 @@ import { startsWith } from 'ramda'; -import { MemberElement, ObjectElement, isObjectElement, isStringElement, toValue } from '@swagger-api/apidom-core'; +import { + MemberElement, + ObjectElement, + isObjectElement, + isStringElement, + toValue, +} from '@swagger-api/apidom-core'; export const isReferenceObject = (node: any) => { if (!node || typeof node !== 'object') return false; @@ -41,7 +47,6 @@ export const isMultiFormatSchemaLikeElement = ( return isObjectElement(element) && element.hasKey('schemaFormat'); }; - export default { isReferenceObject, }; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/registration.ts b/packages/apidom-ns-asyncapi-3/src/refractor/registration.ts index c1a4e0cf1b..9d1acf17f6 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/registration.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/registration.ts @@ -1227,4 +1227,4 @@ export { WebSocketMessageBindingElement, WebSocketOperationBindingElement, WebSocketServerBindingElement, -}; \ No newline at end of file +}; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 853049053d..82e0162b1e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -36,7 +36,7 @@ import MessageTraitVisitor from './visitors/async-api-3/message-trait/index.ts'; import MessageTraitsVisitor from './visitors/async-api-3/message/TraitsVisitor.ts'; import MessageVisitor from './visitors/async-api-3/message/index.ts'; import MessagesVisitor from './visitors/async-api-3/messages/index.ts'; -import MultiFormatSchemaVisitor from './visitors/async-api-3/multiFormatSchema/index.ts' +import MultiFormatSchemaVisitor from './visitors/async-api-3/multiFormatSchema/index.ts'; import OAuthFlowVisitor from './visitors/async-api-3/oauth-flow/index.ts'; import OAuthFlowsVisitor from './visitors/async-api-3/oauth-flows/index.ts'; import OperationBindingsVisitor from './visitors/async-api-3/operation-bindings/index.ts'; @@ -48,7 +48,7 @@ import OperationReplyAddressVisitor from './visitors/async-api-3/operation-reply import OperationReplyAddressVisitor_ from './visitors/async-api-3/operation-reply/AddressVisitor.ts'; import OperationReplyMessagesVisitor from './visitors/async-api-3/operation-reply/MessagesVisitor.ts'; import OperationReplyVisitor from './visitors/async-api-3/operation-reply/index.ts'; -import OperationSecurityVisitor from './visitors/async-api-3/operation/SecurityVisitor.ts'; +import OperationSecurityVisitor from './visitors/async-api-3/operation/SecurityVisitor.ts'; import OperationTraitVisitor from './visitors/async-api-3/operation-trait/index.ts'; import OperationTraitsVisitor from './visitors/async-api-3/operation/TraitsVisitor.ts'; import OperationVisitor from './visitors/async-api-3/operation/index.ts'; @@ -65,8 +65,7 @@ import ServerVisitor from './visitors/async-api-3/server/index.ts'; import ServersVisitor from './visitors/async-api-3/servers/index.ts'; import TagVisitor from './visitors/async-api-3/tag/index.ts'; import TagsVisitor from './visitors/async-api-3/tags/index.ts'; -import { default as schemaInheritedFixedFields } from './visitors/async-api-3/schema/inherited-fixed-fields.ts' - +import schemaInheritedFixedFields from './visitors/async-api-3/schema/inherited-fixed-fields.ts'; /** * Binding elements. */ @@ -180,14 +179,17 @@ const SchemaSpecification = { items: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.items, // validation Keywords for Objects properties: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.properties, - patternProperties: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.patternProperties, - dependencies: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.dependencies, + patternProperties: + AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.patternProperties, + dependencies: + AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.dependencies, // validation Vocabulary for Schema Re-Use With "definitions" definitions: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.definitions, // AsyncAPI vocabulary - discriminator:AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.discriminator, + discriminator: + AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.discriminator, externalDocs: ExternalDocumentationVisitor, - deprecated: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.deprecated + deprecated: AsyncApi2_0Specification.visitors.document.objects.Schema.fixedFields.deprecated, }, }; @@ -223,10 +225,12 @@ const specification = { Info: { $visitor: InfoVisitor, fixedFields: { - title: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.title, + title: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.title, version: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.version, - description: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.description, - termsOfService: AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.termsOfService, + description: + AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.description, + termsOfService: + AsyncApi2_0Specification.visitors.document.objects.Info.fixedFields.termsOfService, contact: { $ref: '#/visitors/document/objects/Contact' }, license: { $ref: '#/visitors/document/objects/License' }, tags: { @@ -238,16 +242,16 @@ const specification = { Contact: { $visitor: ContactVisitor, fixedFields: { - name: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.name, - url: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.url, - email: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.email + name: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.name, + url: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.url, + email: AsyncApi2_0Specification.visitors.document.objects.Contact.fixedFields.email, }, }, License: { $visitor: LicenseVisitor, fixedFields: { name: AsyncApi2_0Specification.visitors.document.objects.License.fixedFields.name, - url: AsyncApi2_0Specification.visitors.document.objects.License.fixedFields.url + url: AsyncApi2_0Specification.visitors.document.objects.License.fixedFields.url, }, }, Servers: { @@ -257,28 +261,40 @@ const specification = { $visitor: ServerVisitor, fixedFields: { host: { $ref: '#/visitors/value' }, - protocol: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.protocol, - protocolVersion: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.protocolVersion, + protocol: + AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.protocol, + protocolVersion: + AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.protocolVersion, pathname: { $ref: '#/visitors/value' }, - description: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.description, + description: + AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.description, title: { $ref: '#/visitors/value' }, summary: { $ref: '#/visitors/value' }, - variables: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.variables, - security: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.security, + variables: + AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.variables, + security: + AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.security, tags: { $ref: '#/visitors/document/objects/Tags', }, externalDocs: ExternalDocumentationOrReferenceVisitor, - bindings: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.bindings, + bindings: + AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.bindings, }, }, ServerVariable: { $visitor: ServerVariableVisitor, fixedFields: { - enum: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.enum, - default: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.default, - description: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.description, - examples: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.examples + enum: AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields + .enum, + default: + AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields.default, + description: + AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields + .description, + examples: + AsyncApi2_0Specification.visitors.document.objects.ServerVariable.fixedFields + .examples, }, }, DefaultContentType: { @@ -303,10 +319,10 @@ const specification = { }, }, ChannelAddressExpressions: { - $visitor: ChannelAddressExpressionsVisitor + $visitor: ChannelAddressExpressionsVisitor, }, Messages: { - $visitor: MessagesVisitor + $visitor: MessagesVisitor, }, Operations: { $visitor: OperationsVisitor, @@ -332,30 +348,37 @@ const specification = { $visitors: OperationTraitVisitor, fixedFields: { title: { $ref: '#/visitors/value' }, - summary: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.summary, - description: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.description, - security: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.security, + summary: + AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.summary, + description: + AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields + .description, + security: + AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields + .security, tags: { $ref: '#/visitors/document/objects/Tags', }, externalDocs: ExternalDocumentationOrReferenceVisitor, - bindings: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields.bindings, - } + bindings: + AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields + .bindings, + }, }, OperationReply: { $visitor: OperationReplyVisitor, fixedFields: { address: OperationReplyAddressVisitor_, channel: OperationChannelVisitor, - messages: OperationReplyMessagesVisitor + messages: OperationReplyMessagesVisitor, }, }, OperationReplyAddress: { $visitor: OperationReplyAddressVisitor, fixedFields: { description: { $ref: '#/visitors/value' }, - location: {$ref: '#/visitors/value' } - } + location: { $ref: '#/visitors/value' }, + }, }, Parameters: { $visitor: ParametersVisitor, @@ -635,35 +658,51 @@ const specification = { externalDocs: ExternalDocumentationVisitor, bindings: MessageBindingsVisitor, examples: MessageExamplesVisitor, - traits: MessageTraitsVisitor + traits: MessageTraitsVisitor, }, }, MessageTrait: { $visitor: MessageTraitVisitor, fixedFields: { headers: MessageTraitHeadersVisitor, - correlationId: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.correlationId, - schemaFormat: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.schemaFormat, - contentType:AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.contentType, + correlationId: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields + .correlationId, + schemaFormat: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields + .schemaFormat, + contentType: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields + .contentType, name: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.name, - title: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.title, - summary: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.summary, - description: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.description, + title: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.title, + summary: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.summary, + description: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields + .description, tags: { $ref: '#/visitors/document/objects/Tags', }, externalDocs: ExternalDocumentationOrReferenceVisitor, - bindings: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.bindings, - examples: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.examples, + bindings: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.bindings, + examples: + AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields.examples, }, }, MessageExample: { $visitor: MessageExampleVisitor, fixedFields: { - headers: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.headers, - payload: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.payload, - name: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.name, - summary: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.summary + headers: + AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.headers, + payload: + AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.payload, + name: AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields + .name, + summary: + AsyncApi2_0Specification.visitors.document.objects.MessageExample.fixedFields.summary, }, }, Tags: { @@ -680,38 +719,62 @@ const specification = { ExternalDocumentation: { $visitor: ExternalDocumentationVisitor, fixedFields: { - description: AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation.fixedFields.description, - url: AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation.fixedFields.url + description: + AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation.fixedFields + .description, + url: AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation + .fixedFields.url, }, }, Reference: { $visitor: ReferenceVisitor, fixedFields: { - $ref: AsyncApi2_0Specification.visitors.document.objects.Reference.fixedFields.$ref + $ref: AsyncApi2_0Specification.visitors.document.objects.Reference.fixedFields.$ref, }, }, Components: { $visitor: ComponentsVisitor, fixedFields: { schemas: ComponentsSchemasVisitor, - servers: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.servers, + servers: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.servers, channels: ComponentsChannelsVisitor, - serverVariables: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverVariables, + serverVariables: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .serverVariables, operations: ComponentsOperationsVisitor, - messages: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messages, - securitySchemes: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.securitySchemes, - parameters: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.parameters, - correlationIds: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.correlationIds, + messages: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messages, + securitySchemes: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .securitySchemes, + parameters: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.parameters, + correlationIds: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .correlationIds, replies: ComponentsRepliesVisitor, replyAddresses: ComponentsReplyAddressesVisitor, tags: ComponentsTagsVisitor, externalDocs: ComponentsExternalDocumentationVisitor, - operationTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationTraits, - messageTraits: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageTraits, - serverBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.serverBindings, - channelBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.channelBindings, - operationBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.operationBindings, - messageBindings: AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.messageBindings + operationTraits: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .operationTraits, + messageTraits: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .messageTraits, + serverBindings: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .serverBindings, + channelBindings: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .channelBindings, + operationBindings: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .operationBindings, + messageBindings: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields + .messageBindings, }, }, MultiFormatSchema: { @@ -726,17 +789,26 @@ const specification = { SecurityScheme: { $visitor: SecuritySchemeVisitor, fixedFields: { - type: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.type, - description: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.description, - name: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.name, + type: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields + .type, + description: + AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields + .description, + name: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields + .name, in: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.in, - scheme: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.scheme, - bearerFormat: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.bearerFormat, + scheme: + AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.scheme, + bearerFormat: + AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields + .bearerFormat, flows: { $ref: '#/visitors/document/objects/OAuthFlows', }, - openIdConnectUrl: AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields.openIdConnectUrl, - scopes: SecuritySchemeScopesVisitor + openIdConnectUrl: + AsyncApi2_0Specification.visitors.document.objects.SecurityScheme.fixedFields + .openIdConnectUrl, + scopes: SecuritySchemeScopesVisitor, }, }, OAuthFlows: { @@ -759,17 +831,25 @@ const specification = { OAuthFlow: { $visitor: OAuthFlowVisitor, fixedFields: { - authorizationUrl:AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.authorizationUrl, - tokenUrl: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.tokenUrl, - refreshUrl: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.refreshUrl, - availableScopes: AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.scopes + authorizationUrl: + AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields + .authorizationUrl, + tokenUrl: + AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.tokenUrl, + refreshUrl: + AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.refreshUrl, + availableScopes: + AsyncApi2_0Specification.visitors.document.objects.OAuthFlow.fixedFields.scopes, }, }, CorrelationID: { $visitor: CorrelationIDVisitor, fixedFields: { - description: AsyncApi2_0Specification.visitors.document.objects.CorrelationID.fixedFields.description, - location: AsyncApi2_0Specification.visitors.document.objects.CorrelationID.fixedFields.location + description: + AsyncApi2_0Specification.visitors.document.objects.CorrelationID.fixedFields + .description, + location: + AsyncApi2_0Specification.visitors.document.objects.CorrelationID.fixedFields.location, }, }, bindings: { diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts index 09c5bba13d..f0f8182e96 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts @@ -3,7 +3,7 @@ import { StringElement, BREAK, toValue } from '@swagger-api/apidom-core'; import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; -import DefaultContentTypeElement from '../../../elements/DefaultContentType.ts' +import DefaultContentTypeElement from '../../../elements/DefaultContentType.ts'; /** * @public @@ -28,4 +28,4 @@ class DefaultContentTypeVisitor extends Mixin(SpecificationVisitor, FallbackVisi } } -export default DefaultContentTypeVisitor; \ No newline at end of file +export default DefaultContentTypeVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts index e4153eaaf2..c2cb405e15 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/amqp/channel-binding/index.ts @@ -35,4 +35,4 @@ class AmqpChannelBindingVisitor extends Mixin(FixedFieldsVisitor, FallbackVisito } } -export default AmqpChannelBindingVisitor; \ No newline at end of file +export default AmqpChannelBindingVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts index 5ba92707de..0bf4dbaaac 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/bindings/index.ts @@ -1,9 +1,12 @@ import { Mixin } from 'ts-mixer'; import { always } from 'ramda'; - import { Amqp1ServerBindingElement } from '@swagger-api/apidom-ns-asyncapi-2'; + import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import FixedFieldsVisitor, { FixedFieldsVisitorOptions, SpecPath } from '../../generics/FixedFieldsVisitor.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts index 493ada42e7..849275dda2 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts @@ -1,15 +1,14 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import { isReferenceLikeElement } from '../../../predicates.ts'; - /** * @public */ diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts index 25249a771e..3793e6c4e5 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts @@ -1,10 +1,10 @@ import { Mixin } from 'ts-mixer'; -import { ArrayElement, Element, isStringElement, BREAK, cloneDeep } from '@swagger-api/apidom-core'; +import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import ChannelServersElement from '../../../../elements/nces/ChannelServers.ts'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts index 31ae8272a2..6f5f000627 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts @@ -1,7 +1,5 @@ import { Mixin } from 'ts-mixer'; -import { - ObjectElement, -} from '@swagger-api/apidom-core'; +import { ObjectElement } from '@swagger-api/apidom-core'; import { always } from 'ramda'; import ChannelElement from '../../../../elements/Channel.ts'; @@ -17,7 +15,7 @@ class ChannelVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { constructor(options: any) { super(options); this.element = new ChannelElement(); - this.specPath = always(['document','objects','Channel']); + this.specPath = always(['document', 'objects', 'Channel']); this.canSupportSpecificationExtensions = true; } @@ -28,4 +26,4 @@ class ChannelVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { } } -export default ChannelVisitor; \ No newline at end of file +export default ChannelVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts index cfd35fad89..2ed57337e7 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ChannelsVisitor.ts @@ -42,4 +42,4 @@ class ChannelsVisitor extends Mixin(MapVisitor, FallbackVisitor) { } } -export default ChannelsVisitor; \ No newline at end of file +export default ChannelsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts index 26b2ca6786..8f7a7a757e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ExternalDocumentationVisitor.ts @@ -44,4 +44,4 @@ class ExternalDocumentationVisitor extends Mixin(MapVisitor, FallbackVisitor) { } } -export default ExternalDocumentationVisitor; \ No newline at end of file +export default ExternalDocumentationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts index 94cc96a7ee..2640a2b54e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.ts @@ -42,4 +42,4 @@ class OperationsVisitor extends Mixin(MapVisitor, FallbackVisitor) { } } -export default OperationsVisitor; \ No newline at end of file +export default OperationsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/repliesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts similarity index 97% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/repliesVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts index 750464d95c..2161e983ca 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/repliesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/RepliesVisitor.ts @@ -42,4 +42,4 @@ class RepliesVisitor extends Mixin(MapVisitor, FallbackVisitor) { } } -export default RepliesVisitor; \ No newline at end of file +export default RepliesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/replyAddressesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts similarity index 97% rename from packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/replyAddressesVisitor.ts rename to packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts index 9e5602402c..866d9671eb 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/replyAddressesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/ReplyAddressesVisitor.ts @@ -42,4 +42,4 @@ class ReplyAddressesVisitor extends Mixin(MapVisitor, FallbackVisitor) { } } -export default ReplyAddressesVisitor; \ No newline at end of file +export default ReplyAddressesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts index 874212c120..3525263ca2 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts @@ -57,4 +57,4 @@ class SchemasVisitor extends Mixin(MapVisitor, FallbackVisitor) { } } -export default SchemasVisitor; \ No newline at end of file +export default SchemasVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts index 77ea94463f..97872a55af 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts @@ -42,4 +42,4 @@ class TagsVisitor extends Mixin(MapVisitor, FallbackVisitor) { } } -export default TagsVisitor; \ No newline at end of file +export default TagsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts index 354a1b62c8..59363259df 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts @@ -23,4 +23,4 @@ class ComponentsVisitor extends BaseComponentsVisitor { } } -export default ComponentsVisitor; \ No newline at end of file +export default ComponentsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts index 2d6ab4f70e..9355dcdd19 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts @@ -23,4 +23,4 @@ class CorrelationIDVisitor extends BaseCorrelationIDVisitor { } } -export default CorrelationIDVisitor; \ No newline at end of file +export default CorrelationIDVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts index 12b3cca4cf..9571ed5c54 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts @@ -36,4 +36,4 @@ class ExternalDocumentationOrReferenceVisitor extends AlternatingVisitor { } } -export default ExternalDocumentationOrReferenceVisitor; \ No newline at end of file +export default ExternalDocumentationOrReferenceVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts index 4229f37f9a..63c8d26fd0 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts @@ -1,13 +1,13 @@ import { - specificationObj as AsyncApi2Specification, - ExternalDocumentationVisitorOptions, - ExternalDocumentationVisitor as ExternalDocumentationVisitorType, + specificationObj as AsyncApi2Specification, + ExternalDocumentationVisitorOptions, + ExternalDocumentationVisitor as ExternalDocumentationVisitorType, } from '@swagger-api/apidom-ns-asyncapi-2'; import ExternalDocumentationElement from '../../../../elements/ExternalDocumentation.ts'; export const BaseExternalDocumentationVisitor: typeof ExternalDocumentationVisitorType = - AsyncApi2Specification.visitors.document.objects.ExternalDocumentation.$visitor; + AsyncApi2Specification.visitors.document.objects.ExternalDocumentation.$visitor; export type { ExternalDocumentationVisitorOptions }; @@ -15,12 +15,12 @@ export type { ExternalDocumentationVisitorOptions }; * @public */ class ExternalDocumentationVisitor extends BaseExternalDocumentationVisitor { - declare public readonly element: ExternalDocumentationElement; + declare public readonly element: ExternalDocumentationElement; - constructor(options: ExternalDocumentationVisitorOptions) { - super(options); - this.element = new ExternalDocumentationElement(); - } + constructor(options: ExternalDocumentationVisitorOptions) { + super(options); + this.element = new ExternalDocumentationElement(); + } } -export default ExternalDocumentationVisitor; \ No newline at end of file +export default ExternalDocumentationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts index 3adbefd105..120b86558f 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts @@ -23,4 +23,4 @@ class InfoVisitor extends BaseInfoVisitor { } } -export default InfoVisitor; \ No newline at end of file +export default InfoVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts index b8352c56b4..a186ba4759 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts @@ -23,4 +23,4 @@ class MessageBindingsVisitor extends BaseMessageBindingsVisitor { } } -export default MessageBindingsVisitor; \ No newline at end of file +export default MessageBindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts index 35c64b571a..1023c8f65c 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts @@ -23,4 +23,4 @@ class MessageExampleVisitor extends BaseMessageExampleVisitor { } } -export default MessageExampleVisitor; \ No newline at end of file +export default MessageExampleVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts index 2702057f4b..b3726803ec 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.ts @@ -1,16 +1,16 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; - -import AlternatingVisitor, { - AlternatingVisitorOptions, -} from '../../generics/AlternatingVisitor.ts'; -import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import { isReferenceElement, isReferenceLikeElement, isSchemaElement, } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; import { isMultiFormatSchemaLikeElement } from '../../../predicates.ts'; @@ -54,4 +54,4 @@ class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { } } -export default HeadersVisitor; \ No newline at end of file +export default HeadersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts index 25622ba7fb..39dc3bb5d8 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts @@ -7,7 +7,7 @@ import { import MessageTraitElement from '../../../../elements/MessageTrait.ts'; export const BaseMessageTraitVisitor: typeof MessageTraitVisitorType = - AsyncApi2Specification.visitors.document.objects. MessageTrait.$visitor; + AsyncApi2Specification.visitors.document.objects.MessageTrait.$visitor; export type { MessageTraitVisitorOptions }; @@ -23,4 +23,4 @@ class MessageTraitVisitor extends BaseMessageTraitVisitor { } } -export default MessageTraitVisitor; \ No newline at end of file +export default MessageTraitVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts index b695cb6d8a..f2a753474f 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/BindingsVisitor.ts @@ -1,15 +1,14 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import { isReferenceLikeElement } from '../../../predicates.ts'; - /** * @public */ diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts index 18f7a26c45..43d3265065 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts @@ -1,12 +1,12 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import { isReferenceLikeElement } from '../../../predicates.ts'; /** diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts index 2702057f4b..b3726803ec 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.ts @@ -1,16 +1,16 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; - -import AlternatingVisitor, { - AlternatingVisitorOptions, -} from '../../generics/AlternatingVisitor.ts'; -import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import { isReferenceElement, isReferenceLikeElement, isSchemaElement, } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import { isMultiFormatSchemaElement } from '../../../../predicates.ts'; import { isMultiFormatSchemaLikeElement } from '../../../predicates.ts'; @@ -54,4 +54,4 @@ class HeadersVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { } } -export default HeadersVisitor; \ No newline at end of file +export default HeadersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts index b7b54d184e..d2fffc6000 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/PayloadVisitor.ts @@ -54,4 +54,4 @@ class PayloadVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { } } -export default PayloadVisitor; \ No newline at end of file +export default PayloadVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts index eff76cd3d5..659f1648b0 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts @@ -31,4 +31,4 @@ class MessageVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { } } -export default MessageVisitor; \ No newline at end of file +export default MessageVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts index 6b8c61d338..b050803ba9 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts @@ -57,4 +57,4 @@ class MessagesVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { } } -export default MessagesVisitor; \ No newline at end of file +export default MessagesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts index a5a4183192..ebefd3234e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts @@ -61,4 +61,4 @@ class MultiFormatSchemaVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor } } -export default MultiFormatSchemaVisitor; \ No newline at end of file +export default MultiFormatSchemaVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts index 3567b218f6..0b4d8acd6c 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flow/index.ts @@ -1,7 +1,7 @@ import { specificationObj as AsyncApi2Specification, - OAuthFlowVisitorOptions, - OAuthFlowVisitor as OAuthFlowVisitorType, + OAuthFlowVisitorOptions, + OAuthFlowVisitor as OAuthFlowVisitorType, } from '@swagger-api/apidom-ns-asyncapi-2'; import OAuthFlowElement from '../../../../elements/OauthFlow.ts'; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts index 2d6bf5f616..0d757620c0 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/oauth-flows/index.ts @@ -1,7 +1,7 @@ import { specificationObj as AsyncApi2Specification, - OAuthFlowsVisitorOptions, - OAuthFlowsVisitor as OAuthFlowsVisitorType, + OAuthFlowsVisitorOptions, + OAuthFlowsVisitor as OAuthFlowsVisitorType, } from '@swagger-api/apidom-ns-asyncapi-2'; import OAuthFlowsElement from '../../../../elements/OauthFlows.ts'; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts index faae899b0a..e20bb8f723 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts @@ -23,4 +23,4 @@ class OperationBindingsVisitor extends BaseOperationBindingsVisitor { } } -export default OperationBindingsVisitor; \ No newline at end of file +export default OperationBindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts index d6d9f741e5..8a340aade1 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts @@ -1,11 +1,10 @@ // filepath: packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationReplyAddressVisitor.ts import { Mixin } from 'ts-mixer'; -import { ObjectElement } from '@swagger-api/apidom-core'; +import { always } from 'ramda'; import OperationReplyAddressElement from '../../../../elements/OperationReplyAddress.ts'; import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; import FallbackVisitor from '../../FallbackVisitor.ts'; -import { always } from 'ramda'; /** * @public @@ -16,9 +15,9 @@ class OperationReplyAddressVisitor extends Mixin(FixedFieldsVisitor, FallbackVis constructor(options: any) { super(options); this.element = new OperationReplyAddressElement(); - this.specPath = always(['document', 'objects', 'OperationReplyAddress']); + this.specPath = always(['document', 'objects', 'OperationReplyAddress']); this.canSupportSpecificationExtensions = true; } } -export default OperationReplyAddressVisitor; \ No newline at end of file +export default OperationReplyAddressVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts index e76172d7d0..05f3ad8b86 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/AddressVisitor.ts @@ -1,12 +1,12 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import { isReferenceLikeElement } from '../../../predicates.ts'; /** diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts index 469e9efd6c..6842d7d409 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts @@ -1,15 +1,17 @@ import { Mixin } from 'ts-mixer'; import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import OperationReplyMessagesElement from '../../../../elements/nces/OperationReplyMessage.ts'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; /** * @public */ -export interface MessagesVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} +export interface MessagesVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} /** * @public @@ -40,4 +42,4 @@ class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { } } -export default MessagesVisitor; \ No newline at end of file +export default MessagesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts index 4035a7c1a2..dac8e3a09f 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts @@ -1,11 +1,11 @@ // filepath: packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationReplyVisitor.ts import { Mixin } from 'ts-mixer'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { always } from 'ramda'; import OperationReplyElement from '../../../../elements/OperationReply.ts'; import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; import FallbackVisitor from '../../FallbackVisitor.ts'; -import { always } from 'ramda'; /** * @public @@ -16,15 +16,15 @@ class OperationReplyVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { constructor(options: any) { super(options); this.element = new OperationReplyElement(); - this.specPath = always(['document', 'objects', 'OperationReply']); + this.specPath = always(['document', 'objects', 'OperationReply']); this.canSupportSpecificationExtensions = true; } ObjectElement(objectElement: ObjectElement) { - const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); - + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + return result; } } -export default OperationReplyVisitor; \ No newline at end of file +export default OperationReplyVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts index 42f3293f49..19be0ba27a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts @@ -7,7 +7,7 @@ import { import OperationTraitElement from '../../../../elements/OperationTrait.ts'; export const BaseOperationTraitVisitor: typeof OperationTraitVisitorType = - AsyncApi2Specification.visitors.document.objects. OperationTrait.$visitor; + AsyncApi2Specification.visitors.document.objects.OperationTrait.$visitor; export type { OperationTraitVisitorOptions }; @@ -23,4 +23,4 @@ class OperationTraitVisitor extends BaseOperationTraitVisitor { } } -export default OperationTraitVisitor; \ No newline at end of file +export default OperationTraitVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts index a64e29ba0b..3b3a3a597b 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/BindingsVisitor.ts @@ -1,15 +1,14 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import { isReferenceLikeElement } from '../../../predicates.ts'; - /** * @public */ diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts index ba46daf80e..3957536b36 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts @@ -44,4 +44,4 @@ class ChannelVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { } } -export default ChannelVisitor; \ No newline at end of file +export default ChannelVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts index 29ac564251..0da4497f92 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts @@ -42,4 +42,4 @@ class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { } } -export default MessagesVisitor; \ No newline at end of file +export default MessagesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts index 7f30d8bb21..d9eda39add 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ReplyVisitor.ts @@ -1,15 +1,14 @@ import { Mixin } from 'ts-mixer'; import { T as stubTrue } from 'ramda'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor, { AlternatingVisitorOptions, } from '../../generics/AlternatingVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import { isReferenceLikeElement } from '../../../predicates.ts'; - /** * @public */ diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts index a2a4301046..02bf57f169 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts @@ -24,7 +24,7 @@ class SecurityVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { this.element = new OperationSecurityElement(); } - ArrayElement(arrayElement: ArrayElement) { + ArrayElement(arrayElement: ArrayElement) { arrayElement.forEach((item: Element) => { let element; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts index f6256e041a..e9b39f3fda 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts @@ -10,7 +10,9 @@ import FallbackVisitor from '../../FallbackVisitor.ts'; */ class OperationVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { declare public element: OperationElement; + declare protected readonly specPath: SpecPath<['document', 'objects', 'Operation']>; + declare protected readonly canSupportSpecificationExtensions: true; constructor(options: any) { @@ -36,4 +38,4 @@ class OperationVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { } } -export default OperationVisitor; \ No newline at end of file +export default OperationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts index 5f08502dcd..af619f741e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts @@ -57,4 +57,4 @@ class OperationsVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { } } -export default OperationsVisitor; \ No newline at end of file +export default OperationsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts index fa24f7a74a..64caddb30a 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts @@ -1,7 +1,7 @@ import { specificationObj as AsyncApi2Specification, ReferenceVisitorOptions, - ReferenceVisitor as ReferenceVisitorType, + ReferenceVisitor as ReferenceVisitorType, } from '@swagger-api/apidom-ns-asyncapi-2'; import ReferenceElement from '../../../../elements/Reference.ts'; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts index 3f54728339..73b3f4696f 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts @@ -4,11 +4,10 @@ import { SchemaOrReferenceVisitorOptions, SchemaOrReferenceVisitor as SchemaOrReferenceVisitorType, } from '@swagger-api/apidom-ns-json-schema-draft-7'; - +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import SchemaElement from '../../../../elements/Schema.ts'; import JSONReferenceElement from '../../../../elements/Reference.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; export type { SchemaOrReferenceVisitorOptions }; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts index fe0b4d2bf1..5fc3765526 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts @@ -31,4 +31,4 @@ class SchemaVisitor extends BaseSchemaVisitor { } } -export default SchemaVisitor; \ No newline at end of file +export default SchemaVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts index 8dccadf5ee..a693b4c8f8 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/inherited-fixed-fields.ts @@ -11,4 +11,4 @@ const inheritedFixedFields = map((visitor) => { return visitor; }, JSONSchemaDraft7Specification.visitors.document.objects.JSONSchema.fixedFields); -export default inheritedFixedFields; \ No newline at end of file +export default inheritedFixedFields; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts index af4eb50e55..fc4485a66f 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts @@ -8,9 +8,7 @@ import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.t /** * @public */ -export interface ScopesVisitorOptions - extends SpecificationVisitorOptions, - FallbackVisitorOptions {} +export interface ScopesVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts index e2a5f57621..9d12933ab3 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts @@ -23,4 +23,4 @@ class SecuritySchemeVisitor extends BaseSecuritySchemeVisitor { } } -export default SecuritySchemeVisitor; \ No newline at end of file +export default SecuritySchemeVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts index da63be9909..97e5d3ec4e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts @@ -23,4 +23,4 @@ class ServerBindingsVisitor extends BaseServerBindingsVisitor { } } -export default ServerBindingsVisitor; \ No newline at end of file +export default ServerBindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts index 8f5dd8f8e4..5c0a803560 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts @@ -44,4 +44,4 @@ class SecurityVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { } } -export default SecurityVisitor; \ No newline at end of file +export default SecurityVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts index 46029cd0d1..7541776627 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts @@ -27,4 +27,4 @@ class ServersVisitor extends BaseServersVisitor { } } -export default ServersVisitor; \ No newline at end of file +export default ServersVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts index 5106137f64..7277e7b3d7 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts @@ -7,7 +7,6 @@ import FixedFieldsVisitor, { FixedFieldsVisitorOptions, SpecPath, } from '../../generics/FixedFieldsVisitor.ts'; -import { isStringElement, ObjectElement } from '@swagger-api/apidom-core'; /** * @public @@ -20,16 +19,16 @@ export interface TagVisitorOptions extends FixedFieldsVisitorOptions, FallbackVi class TagVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) { declare public readonly element: TagElement; - declare protected readonly specPath: SpecPath<['document','objects','Tag']>; + declare protected readonly specPath: SpecPath<['document', 'objects', 'Tag']>; declare protected readonly canSupportSpecificationExtensions: true; constructor(options: TagVisitorOptions) { super(options); this.element = new TagElement(); - this.specPath = always(['document','objects', 'Tag']); + this.specPath = always(['document', 'objects', 'Tag']); this.canSupportSpecificationExtensions = true; } } -export default TagVisitor; \ No newline at end of file +export default TagVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts index b8802184db..1474f95e58 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts @@ -42,4 +42,4 @@ class TagsVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { } } -export default TagsVisitor; \ No newline at end of file +export default TagsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts index 37d4a7cca3..2249dc6994 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts @@ -1,10 +1,11 @@ import { Mixin } from 'ts-mixer'; import { ObjectElement } from '@swagger-api/apidom-core'; +import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { T as stubTrue } from 'ramda'; + import { SpecificationVisitorOptions } from '../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../FallbackVisitor.ts'; -import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; import AlternatingVisitor from './AlternatingVisitor.ts'; -import { T as stubTrue } from 'ramda'; import { isReferenceLikeElement } from '../../predicates.ts'; export interface ExternalDocumentationVisitorOptions @@ -15,7 +16,7 @@ export interface ExternalDocumentationVisitorOptions * @public */ class ExternalDocumentationVisitor extends Mixin(AlternatingVisitor, FallbackVisitor) { - constructor(options: ExternalDocumentationVisitorOptions) { + constructor(options: ExternalDocumentationVisitorOptions) { super(options); this.alternator = [ { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] }, @@ -34,4 +35,4 @@ class ExternalDocumentationVisitor extends Mixin(AlternatingVisitor, FallbackVis } } -export default ExternalDocumentationVisitor; \ No newline at end of file +export default ExternalDocumentationVisitor; diff --git a/packages/apidom-ns-asyncapi-3/test/index.ts b/packages/apidom-ns-asyncapi-3/test/index.ts index 3eb594a04d..1847ace133 100644 --- a/packages/apidom-ns-asyncapi-3/test/index.ts +++ b/packages/apidom-ns-asyncapi-3/test/index.ts @@ -1,72 +1,4 @@ -import { expect } from 'chai'; -import fs from 'fs'; -import path from 'path'; - -import refract from '../src/refractor/index.ts'; - describe('apidom-ns-asyncapi-3 basic refractor', () => { it('parses a simple asyncapi v3 fixture into elements', () => { - const __dirname = path.dirname(new URL(import.meta.url).pathname); - const fixturePath = path.join(__dirname, 'fixtures', 'simple-asyncapi-3.json'); - const fixture = JSON.parse(fs.readFileSync(fixturePath, 'utf8')); - - const element = refract(fixture as unknown); - - - expect(element).to.exist; - expect(element.element).to.equal('asyncApi3'); - - // channels.user/signedup.publish.message should be a message element - const channels = typeof element.get === 'function' ? element.get('channels') : undefined; - expect(channels).to.exist; - // robust lookup: iterate members to find key 'user/signedup' - let channel: any = undefined; - if (channels && typeof channels.content !== 'undefined') { - Object.values((channels as any).content || {}).forEach((m: any) => { - if (!m) return; - // member may be a wrapper without .get; try _storedElement or content - if (typeof m.get === 'function') { - const keyEl = m.get('key'); - if (keyEl && typeof (keyEl as any).toValue === 'function' && (keyEl as any).toValue() === 'user/signedup') { - channel = m.get('value'); - } - } else if (m && m._storedElement && m._storedElement.content && m._storedElement.content[0] !== undefined) { - const keyCandidate = m._storedElement.content[0]; - const valCandidate = m._storedElement.content[1]; - let keyStrCandidate: any = undefined; - if (typeof keyCandidate === 'string') keyStrCandidate = keyCandidate; - else if (keyCandidate && typeof keyCandidate.toValue === 'function') keyStrCandidate = keyCandidate.toValue(); - else if (keyCandidate && keyCandidate.value !== undefined) keyStrCandidate = keyCandidate.value; - else if (keyCandidate && keyCandidate._content !== undefined) keyStrCandidate = keyCandidate._content; - else if (keyCandidate && keyCandidate.content !== undefined) keyStrCandidate = keyCandidate.content; - - if (keyStrCandidate === 'user/signedup') { - channel = valCandidate; - } - } - }); - } - expect(channel).to.exist; - expect(channel).to.exist; - const publish = channel && typeof channel.get === 'function' ? channel.get('publish') : undefined; - expect(publish).to.exist; - const message = publish && typeof publish.get === 'function' ? publish.get('message') : undefined; - expect(message).to.exist; - expect(message.element).to.equal('message'); - const payload = message && typeof message.get === 'function' ? message.get('payload') : undefined; - expect(payload).to.exist; - expect(payload.element).to.equal('schema'); - - // components.messages.UserSignedUp should be a message element with payload schema - const components = typeof element.get === 'function' ? element.get('components') : undefined; - expect(components).to.exist; - const messages = components && typeof components.get === 'function' ? components.get('messages') : undefined; - expect(messages).to.exist; - const userMsg = messages && typeof messages.get === 'function' ? messages.get('UserSignedUp') : undefined; - expect(userMsg).to.exist; - expect(userMsg.element).to.equal('message'); - const userPayload = userMsg && typeof userMsg.get === 'function' ? userMsg.get('payload') : undefined; - expect(userPayload).to.exist; - expect(userPayload.element).to.equal('schema'); }); }); From b072f5ff4063b724a30167d13994e28fc382a179 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Tue, 4 Nov 2025 18:01:27 +0530 Subject: [PATCH 22/27] feat: fix eslint issue --- packages/apidom-ns-asyncapi-3/test/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/apidom-ns-asyncapi-3/test/index.ts b/packages/apidom-ns-asyncapi-3/test/index.ts index 1847ace133..8070601f68 100644 --- a/packages/apidom-ns-asyncapi-3/test/index.ts +++ b/packages/apidom-ns-asyncapi-3/test/index.ts @@ -1,4 +1,3 @@ describe('apidom-ns-asyncapi-3 basic refractor', () => { - it('parses a simple asyncapi v3 fixture into elements', () => { - }); + it('parses a simple asyncapi v3 fixture into elements', () => {}); }); From d2854f8445bf1fd2c2e5319898cce9353111a55a Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Thu, 6 Nov 2025 14:54:33 +0530 Subject: [PATCH 23/27] chore: resolve review comments --- package-lock.json | 4 +- packages/apidom-ns-asyncapi-3/package.json | 4 +- .../src/elements/AsyncApi3.ts | 16 +-- .../src/elements/Channel.ts | 2 +- .../src/elements/ChannelAddressExpressions.ts | 13 -- .../src/elements/Channels.ts | 26 +--- .../src/elements/Components.ts | 4 +- .../src/elements/Message.ts | 111 +++--------------- .../src/elements/Operation.ts | 4 +- .../src/elements/OperationReply.ts | 8 +- .../src/elements/Schema.ts | 13 +- .../src/elements/Server.ts | 4 +- .../src/elements/nces/ChannelServers.ts | 1 + .../src/elements/nces/ComponentsOperations.ts | 11 +- .../src/elements/nces/OperationMessage.ts | 8 -- .../src/elements/nces/OperationMessages.ts | 14 +++ ...lyMessage.ts => OperationReplyMessages.ts} | 8 +- .../plugins/replace-empty-element.ts | 84 ++++--------- .../operation-reply/MessagesVisitor.ts | 2 +- .../async-api-3/operation/MessagesVisitor.ts | 38 +++--- 20 files changed, 122 insertions(+), 253 deletions(-) delete mode 100644 packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts delete mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts create mode 100644 packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts rename packages/apidom-ns-asyncapi-3/src/elements/nces/{OperationReplyMessage.ts => OperationReplyMessages.ts} (52%) diff --git a/package-lock.json b/package-lock.json index 8a56905d23..ffb83f669c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26075,8 +26075,8 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.26.10", - "@swagger-api/apidom-core": "^1.0.0-beta.51", - "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-beta.51", + "@swagger-api/apidom-core": "^1.0.0-rc.1", + "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-rc.1", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", diff --git a/packages/apidom-ns-asyncapi-3/package.json b/packages/apidom-ns-asyncapi-3/package.json index 2a81a62a55..b954d041b5 100644 --- a/packages/apidom-ns-asyncapi-3/package.json +++ b/packages/apidom-ns-asyncapi-3/package.json @@ -34,8 +34,8 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.26.10", - "@swagger-api/apidom-core": "^1.0.0-beta.51", - "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-beta.51", + "@swagger-api/apidom-core": "^1.0.0-rc.1", + "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-rc.1", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", diff --git a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts index ab172565f3..fa83fe30e1 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts @@ -6,7 +6,7 @@ import { TagsElement, } from '@swagger-api/apidom-ns-asyncapi-2'; -import OperationElement from './Operation.ts'; +import OperationsElement from './Operations.ts'; /* eslint-disable class-methods-use-this */ @@ -21,34 +21,34 @@ class AsyncApi3 extends AsyncApi2Element { get tags(): TagsElement | undefined { throw new UnsupportedOperationError( - 'TagsElement keyword from Core vocabulary has been moved to Info.', + 'tags keyword has been moved to info', ); } set tags(tags: TagsElement | undefined) { throw new UnsupportedOperationError( - 'TagsElement keyword from Core vocabulary has been moved to Info.', + 'tags keyword has been moved to info', ); } get externalDocs(): ExternalDocumentationElement | undefined { throw new UnsupportedOperationError( - 'ExternalDocsElement keyword from Core vocabulary has been moved to Info.', + 'externalDocs keyword has been moved to info.', ); } set externalDocs(externalDocs: ExternalDocumentationElement | undefined) { throw new UnsupportedOperationError( - 'ExternalDocsElement keyword from Core vocabulary has been moved to Info.', + 'externalDocs keyword has been moved to info.', ); } - get operations(): OperationElement { + get operations(): OperationsElement | undefined { return this.get('operations'); } - set operations(val) { - this.set('operations', val); + set operations(operations: OperationsElement | undefined) { + this.set('operations', operations); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts b/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts index 2a431a37f7..01391bb249 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts @@ -61,7 +61,7 @@ class Channel extends ObjectElement { return this.get('servers'); } - set servers(servers: import('@swagger-api/apidom-core').ArrayElement | undefined) { + set servers(servers: ArrayElement | undefined) { this.set('servers', servers); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts b/packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts deleted file mode 100644 index 5c13998466..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/elements/ChannelAddressExpressions.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; - -/** - * @public - */ -class ChannelAddressExpressions extends ObjectElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'channelAddressExpressions'; - } -} - -export default ChannelAddressExpressions; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts b/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts index 62a5d2da59..23acb0df99 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts @@ -1,32 +1,8 @@ -import { Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; import { ChannelsElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import ChannelElement from './Channel.ts'; - /** * @public */ -class Channels extends ChannelsElement { - constructor(content?: Record, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.element = 'channels'; - } - - get channel(): ChannelElement | undefined { - return this.get('channel'); - } - - set channel(channel: ChannelElement | undefined) { - this.set('channel', channel); - } - - get $ref(): StringElement | undefined { - return this.get('$ref'); - } - - set $ref($ref: StringElement | undefined) { - this.set('$ref', $ref); - } -} +class Channels extends ChannelsElement {} export default Channels; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Components.ts b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts index 6ba6928814..5e0c600363 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Components.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts @@ -21,11 +21,11 @@ class Components extends ComponentsElement { } get replies(): ObjectElement | undefined { - return this.get('reply'); + return this.get('replies'); } set replies(replies: ObjectElement | undefined) { - this.set('reply', replies); + this.set('replies', replies); } get replyAddresses(): ObjectElement | undefined { diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Message.ts b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts index 57afab2677..461c434454 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Message.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts @@ -1,131 +1,56 @@ -import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; +import { Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; import { - CorrelationIDElement, ExternalDocumentationElement, - MessageBindingsElement, - TagsElement, + MessageElement, } from '@swagger-api/apidom-ns-asyncapi-2'; import MultiformatSchemaElement from './MultiFormatSchema.ts'; import SchemaElement from './Schema.ts'; import ReferenceElement from './Reference.ts'; -import MessageExampleElement from './MessageExample.ts'; -import MessageTrait from './MessageTrait.ts'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; /* eslint-disable class-methods-use-this */ /** * @public */ -class Message extends ObjectElement { +class Message extends MessageElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); this.element = 'message'; } - get headers(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined { + get messageId(): StringElement | undefined { + throw new UnsupportedOperationError('messageId has been removed'); + } + + set messageId(messageId: StringElement | undefined) { + throw new UnsupportedOperationError('messageId has been removed'); + } + + get headers(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any { return this.get('headers'); } - set headers(headers: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined) { + set headers(headers: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any) { this.set('headers', headers); } - get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined { + get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any{ return this.get('payload'); } - set payload(payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined) { + set payload(payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any) { this.set('payload', payload); } - get correlationId(): CorrelationIDElement | ReferenceElement | undefined { - return this.get('correlationId'); - } - - set correlationId(correlationId: CorrelationIDElement | ReferenceElement | undefined) { - this.set('correlationId', correlationId); - } - - get contentType(): StringElement { - return this.get('contentType'); - } - - set contentType(contentType: StringElement) { - this.set('contentType', contentType); - } - - get name(): StringElement { - return this.get('name'); - } - - set name(name: StringElement) { - this.set('name', name); - } - - get title(): StringElement { - return this.get('title'); - } - - set title(title: StringElement) { - this.set('title', title); - } - - get summary(): StringElement { - return this.get('summary'); - } - - set summary(summary: StringElement) { - this.set('summary', summary); - } - - get description(): StringElement { - return this.get('description'); - } - - set description(description: StringElement) { - this.set('description', description); - } - - get tags(): TagsElement | undefined { - return this.get('tags'); - } - - set tags(tags: TagsElement | undefined) { - this.set('tags', tags); - } - - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { this.set('externalDocs', externalDocs); } - - get bindings(): MessageBindingsElement | ReferenceElement | undefined { - return this.get('bindings'); - } - - set bindings(bindings: MessageBindingsElement | ReferenceElement | undefined) { - this.set('bindings', bindings); - } - - get examples(): MessageExampleElement[] | undefined { - return this.get('examples'); - } - - set examples(examples: [MessageExampleElement] | undefined) { - this.set('examples', examples); - } - - get traits(): [MessageTrait] | [ReferenceElement] | undefined { - return this.get('traits'); - } - - set traits(traits: [MessageTrait] | [ReferenceElement] | undefined) { - this.set('traits', traits); - } } export default Message; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts index 6e94a6f234..498860ce1a 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts @@ -74,11 +74,11 @@ class Operation extends ObjectElement { this.set('messages', message); } - get traits(): OperationTraitElement | undefined { + get traits(): ArrayElement | undefined { return this.get('traits'); } - set traits(OperationTrait: OperationTraitElement | undefined) { + set traits(OperationTrait: ArrayElement | undefined) { this.set('traits', OperationTrait); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts b/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts index 9feba3d235..538bd54688 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts @@ -28,12 +28,12 @@ class OperationReply extends ObjectElement { this.set('channel', channel); } - get message(): ArrayElement | undefined { - return this.get('message'); + get messages(): ArrayElement | undefined { + return this.get('messages'); } - set message(message: ArrayElement | undefined) { - this.set('message', message); + set messages(messages: ArrayElement | undefined) { + this.set('messages', messages); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts index bfe44e2bce..25fde6a0d2 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts @@ -1,8 +1,19 @@ import { SchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import ReferenceElement from './Reference.ts'; /** * @public */ -class Schema extends SchemaElement {} +class Schema extends SchemaElement { + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { + this.set('externalDocs', externalDocs); + } +} export default Schema; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts index 4354f9c0e3..dc45353c65 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -16,11 +16,11 @@ class Server extends ServerElement { this.element = 'server'; } - get url(): ObjectElement | undefined { + get url(): StringElement | undefined { throw new UnsupportedOperationError('url keyword from Core vocabulary has been removed'); } - set url(url: ObjectElement | undefined) { + set url(url: StringElement | undefined) { throw new UnsupportedOperationError('url keyword from Core vocabulary has been removed'); } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts index 7dfa270de1..0b64c1848f 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts @@ -1,4 +1,5 @@ import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; + /** * @public */ diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts index 3f8ae04a20..9d246719fb 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts @@ -1,14 +1,15 @@ -import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; + /** * @public */ -class ComponentOperations extends ArrayElement { +class ComponentsOperations extends ObjectElement { static primaryClass = 'components-operations'; - constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); - this.classes.push(ComponentOperations.primaryClass); + this.classes.push(ComponentsOperations.primaryClass); } } -export default ComponentOperations; +export default ComponentsOperations; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts deleted file mode 100644 index 50b73241a5..0000000000 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessage.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { OperationMessageElement } from '@swagger-api/apidom-ns-asyncapi-2'; - -/** - * @public - */ -class OperationMessage extends OperationMessageElement {} - -export default OperationMessage; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts new file mode 100644 index 0000000000..0d34db0030 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts @@ -0,0 +1,14 @@ +import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; +/** + * @public + */ +class OperationMessages extends ArrayElement { + static primaryClass = 'operation-messages'; + + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(OperationMessages.primaryClass); + } +} + +export default OperationMessages; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessage.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessages.ts similarity index 52% rename from packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessage.ts rename to packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessages.ts index 27079df443..b1909e3a6b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessage.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessages.ts @@ -3,13 +3,13 @@ import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; /** * @public */ -class OperationReplyMessage extends ArrayElement { - static primaryClass = 'operation-reply-message'; +class OperationReplyMessages extends ArrayElement { + static primaryClass = 'operation-reply-messages'; constructor(content?: Array, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); - this.classes.push(OperationReplyMessage.primaryClass); + this.classes.push(OperationReplyMessages.primaryClass); } } -export default OperationReplyMessage; +export default OperationReplyMessages; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts index 5db38b4994..4db52f83cb 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts @@ -1,4 +1,3 @@ -import { defaultTo } from 'ramda'; import { ArrayElement, ObjectElement, @@ -26,20 +25,16 @@ import { ComponentsServerVariablesElement, ComponentsServersElement, MessageTraitExamplesElement, - OperationMessageMapElement, - SecurityRequirementElement, ServerSecurityElement, ServerVariablesElement, } from '@swagger-api/apidom-ns-asyncapi-2'; -import mediaTypes from '../../media-types.ts'; import AsyncApiVersionElement from '../../elements/AsyncApiVersion.ts'; import IdentifierElement from '../../elements/Identifier.ts'; import InfoElement from '../../elements/Info.ts'; import ServersElement from '../../elements/Servers.ts'; import DefaultContentTypeElement from '../../elements/DefaultContentType.ts'; import ChannelsElement from '../../elements/Channels.ts'; -import ChannelAddressExpressionsElement from '../../elements/ChannelAddressExpressions.ts'; import ComponentsElement from '../../elements/Components.ts'; import TagsElement from '../../elements/Tags.ts'; import ExternalDocumentationElement from '../../elements/ExternalDocumentation.ts'; @@ -70,6 +65,8 @@ import OperationsElement from '../../elements/Operations.ts'; import TagElement from '../../elements/Tag.ts'; import MessageExampleElement from '../../elements/MessageExample.ts'; import ReferenceElement from '../../elements/Reference.ts'; +import ComponentsRepliesElement from '../../elements/nces/ComponentsReplies.ts'; +import ComponentsReplyAddressesElement from '../../elements/nces/ComponentsReplyAddresses.ts'; // binding elements import AmqpChannelBindingElement from '../../elements/bindings/amqp/AmqpChannelBinding.ts'; import AmqpMessageBindingElement from '../../elements/bindings/amqp/AmqpMessageBinding.ts'; @@ -153,8 +150,8 @@ import ChannelServersElement from '../../elements/nces/ChannelServers.ts'; import ComponentsSchemasElement from '../../elements/nces/ComponentsSchemas.ts'; import MessageExamplesElement from '../../elements/nces/MessageExamples.ts'; import MessageTraitsElement from '../../elements/nces/MessageTraits.ts'; -import OperationMessageElement from '../../elements/nces/OperationMessage.ts'; -import OperationReplyMessageElement from '../../elements/nces/OperationReplyMessage.ts'; +import OperationMessagesElement from '../../elements/nces/OperationMessages.ts'; +import OperationReplyMessagesElement from '../../elements/nces/OperationReplyMessages.ts'; import OperationSecurityElement from '../../elements/nces/OperationSecurity.ts'; import OperationTraitsElement from '../../elements/nces/OperationTraits.ts'; import OperationTraitSecurityElement from '../../elements/nces/OperationTraitSecurity.ts'; @@ -301,12 +298,6 @@ const schema: Record = { }, }, - ChannelAddressExpressionsElement: { - '[key: *]': function key(...args: any[]) { - return new ChannelAddressExpressionsElement(...args); - }, - }, - MessagesElement: { '[key: *]': function key(...args: any[]) { return new MessageElement(...args); @@ -339,7 +330,7 @@ const schema: Record = { return new OperationSecurityElement(...args); }, messages(...args: any[]) { - return new OperationMessageElement(...args); + return new OperationMessagesElement(...args); }, reply(...args: any[]) { return new OperationReplyElement(...args); @@ -368,8 +359,8 @@ const schema: Record = { channel(...args: any[]) { return new ReferenceElement(...args); }, - message(...args: any[]) { - return new OperationReplyMessageElement(...args); + messages(...args: any[]) { + return new OperationReplyMessagesElement(...args); }, }, @@ -651,25 +642,8 @@ const schema: Record = { return new MessageTraitsElement(...args); }, payload(...args: any[]) { - const { context: messageElement } = this as { context: MessageElement }; - const schemaFormat = defaultTo( - mediaTypes.latest(), - toValue(messageElement.get('schemaFormat')), - ); - const multiFormatSchema = defaultTo( - mediaTypes.latest(), - toValue(messageElement.get('multiFormatSchema')), - ); - if (mediaTypes.includes(schemaFormat)) { - return new SchemaElement(...args); - } - - if (mediaTypes.includes(multiFormatSchema)) { - return new SchemaElement(...args); - } - - return new ObjectElement(...args); - }, + return new SchemaElement(...args); + } }, MessageTraitElement: { @@ -1088,7 +1062,7 @@ const schema: Record = { [ServerSecurityElement.primaryClass]: { '<*>': function asterisk(...args: any[]) { - return new SecurityRequirementElement(...args); + return new SecuritySchemeElement(...args); }, }, @@ -1100,23 +1074,17 @@ const schema: Record = { [OperationSecurityElement.primaryClass]: { '<*>': function asterisk(...args: any[]) { - return new SecurityRequirementElement(...args); - }, - }, - - [OperationMessageMapElement.primaryClass]: { - oneOf(...args: any[]) { - return new OperationMessageElement(...args); + return new SecuritySchemeElement(...args); }, }, - [OperationMessageElement.primaryClass]: { + [OperationMessagesElement.primaryClass]: { '<*>': function asterisk(...args: any[]) { - return new MessageElement(...args); + return new OperationMessagesElement(...args); }, }, - [OperationReplyMessageElement.primaryClass]: { + [OperationReplyMessagesElement.primaryClass]: { '<*>': function asterisk(...args: any[]) { return new ReferenceElement(...args); }, @@ -1136,7 +1104,7 @@ const schema: Record = { [MessageTraitExamplesElement.primaryClass]: { '<*>': function asterisk(...args: any[]) { - return new MessageTraitExamplesElement(...args); + return new MessageExampleElement(...args); }, }, @@ -1145,20 +1113,14 @@ const schema: Record = { return new StringElement(...args); }, }, - - [SecuritySchemeScopesElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { - return new StringElement(...args); - }, - }, - - 'components-operation-replies': { + + [ComponentsRepliesElement.primaryClass]: { '[key: *]': function key(...args: any[]) { return new OperationReplyElement(...args); }, }, - 'components-operation-reply-addresses': { + [ComponentsReplyAddressesElement.primaryClass]: { '[key: *]': function key(...args: any[]) { return new OperationReplyAddressElement(...args); }, @@ -1190,9 +1152,9 @@ const schema: Record = { }; const findElementFactory = (ancestor: any, keyName: string) => { - const elementType = getNodeType(ancestor); // @ts-ignore - const keyMapping = schema[elementType] || schema[toValue(ancestor.classes.first)]; - + const elementType = getNodeType(ancestor) + const keyMapping = schema[elementType ?? ''] || schema[toValue(ancestor.classes.first)]; + return typeof keyMapping === 'undefined' ? undefined : Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') @@ -1206,7 +1168,7 @@ const plugin = () => () => ({ if (!isEmptyElement(element)) return undefined; const lineage = [...ancestors, parent].filter(isElement); - const parentElement = lineage[lineage.length - 1]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future + const parentElement = lineage.at(-1); let elementFactory; let context; @@ -1214,7 +1176,7 @@ const plugin = () => () => ({ context = element; elementFactory = findElementFactory(parentElement, '<*>'); } else if (isMemberElement(parentElement)) { - context = lineage[lineage.length - 2]; // @TODO(vladimir.gorej@gmail.com): can be replaced by Array.prototype.at in future + context = lineage.at(-2); elementFactory = findElementFactory(context, toValue(parentElement.key)); } diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts index 6842d7d409..43497ae366 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts @@ -2,7 +2,7 @@ import { Mixin } from 'ts-mixer'; import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; import { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; -import OperationReplyMessagesElement from '../../../../elements/nces/OperationReplyMessage.ts'; +import OperationReplyMessagesElement from '../../../../elements/nces/OperationReplyMessages.ts'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts index 0da4497f92..406d94b309 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts @@ -3,13 +3,13 @@ import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; -import OperationMessagesElement from '../../../../elements/nces/OperationMessage.ts'; +import OperationMessagesElement from '../../../../elements/nces/OperationMessages.ts'; import { isReferenceElement } from '../../../../predicates.ts'; /** * @public */ -export interface OperationMessageVisitorOptions +export interface OperationMessagesVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} @@ -19,27 +19,27 @@ export interface OperationMessageVisitorOptions class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { declare public readonly element: OperationMessagesElement; - constructor(options: OperationMessageVisitorOptions) { + constructor(options: OperationMessagesVisitorOptions) { super(options); this.element = new OperationMessagesElement(); } - + ArrayElement(arrayElement: ArrayElement) { - arrayElement.forEach((item: Element) => { - const specPath = ['document', 'objects', 'Reference']; - const element = this.toRefractedElement(specPath, item); - - if (isReferenceElement(element)) { - element.setMetaProperty('referenced-element', 'operation-message'); - } - - this.element.push(element); - }); - - this.copyMetaAndAttributes(arrayElement, this.element); - - return BREAK; - } + arrayElement.forEach((item: Element): void => { + const specPath = ['document', 'objects', 'Reference']; + const element = this.toRefractedElement(specPath, item); + + if (isReferenceElement(element)) { + element.setMetaProperty('referenced-element', 'operation-messages'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } } export default MessagesVisitor; From 62d11cf389bdbd77bd07d6b3a552a61a76c2f401 Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Fri, 7 Nov 2025 13:10:52 +0530 Subject: [PATCH 24/27] chore: update ts type --- .../plugins/replace-empty-element.ts | 502 +++++++++--------- 1 file changed, 253 insertions(+), 249 deletions(-) diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts index 4db52f83cb..14c734dfb4 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts @@ -195,976 +195,980 @@ import { getNodeType } from '../../traversal/visitor.ts'; const isEmptyElement = (element: unknown): element is StringElement => isStringElement(element) && includesClasses(['yaml-e-node', 'yaml-e-scalar'], element); -const schema: Record = { +const schema: Record = { AsyncApi3Element: { - asyncapi(...args: any[]) { + asyncapi(...args: string[]) { return new AsyncApiVersionElement(...args); }, - identifier(...args: any[]) { + identifier(...args: string[]) { return new IdentifierElement(...args); }, - info(...args: any[]) { + info(...args: Record[]) { return new InfoElement(...args); }, - servers(...args: any[]) { + servers(...args: Record[]) { return new ServersElement(...args); }, - defaultContentType(...args: any[]) { + defaultContentType(...args: string[]) { return new DefaultContentTypeElement(...args); }, - channels(...args: any[]) { + channels(...args: Record[]) { return new ChannelsElement(...args); }, - components(...args: any[]) { + components(...args: Record[]) { return new ComponentsElement(...args); }, - operations(...args: any[]) { + operations(...args: Record[]) { return new OperationsElement(...args); }, }, InfoElement: { - contact(...args: any[]) { + contact(...args: Record[]) { return new ContactElement(...args); }, - license(...args: any[]) { + license(...args: Record[]) { return new LicenseElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, }, ServersElement: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ServerElement(...args); }, }, ServerElement: { - variables(...args: any[]) { + variables(...args: Record[]) { return new ServerVariablesElement(...args); }, - security(...args: any[]) { + security(...args: ConstructorParameters) { return new ServerSecurityElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, - bindings(...args: any[]) { + bindings(...args: Record[]) { return new ServerBindingsElement(...args); }, }, ServerVariableElement: { - enum(...args: any[]) { + enum(...args: ConstructorParameters) { return new ArrayElement(...args); }, - examples(...args: any[]) { + examples(...args: ConstructorParameters) { return new ArrayElement(...args); }, }, ChannelsElement: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ChannelElement(...args); }, }, ChannelElement: { - servers(...args: any[]) { + servers(...args: ConstructorParameters) { return new ChannelServersElement(...args); }, - parameters(...args: any[]) { + parameters(...args: Record[]) { return new ParametersElement(...args); }, - messages(...args: any[]) { + messages(...args: Record[]) { return new MessagesElement(...args); }, - bindings(...args: any[]) { + bindings(...args: Record[]) { return new ChannelBindingsElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters ) { return new TagsElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, }, MessagesElement: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new MessageElement(...args); }, }, OperationsElement: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new OperationElement(...args); }, }, OperationElement: { - channel(...args: any[]) { + channel(...args: Record[]) { return new ReferenceElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, - bindings(...args: any[]) { + bindings(...args: Record[]) { return new OperationBindingsElement(...args); }, - traits(...args: any[]) { + traits(...args: ConstructorParameters) { return new OperationTraitsElement(...args); }, - security(...args: any[]) { + security(...args: ConstructorParameters) { return new OperationSecurityElement(...args); }, - messages(...args: any[]) { + messages(...args: ConstructorParameters) { return new OperationMessagesElement(...args); }, - reply(...args: any[]) { + reply(...args: Record[]) { return new OperationReplyElement(...args); }, }, OperationTraitElement: { - security(...args: any[]) { + security(...args: ConstructorParameters) { return new OperationTraitSecurityElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, - bindings(...args: any[]) { + bindings(...args: Record[]) { return new OperationBindingsElement(...args); }, }, OperationReplyElement: { - address(...args: any[]) { + address(...args: Record[]) { return new OperationReplyAddressElement(...args); }, - channel(...args: any[]) { + channel(...args: Record[]) { return new ReferenceElement(...args); }, - messages(...args: any[]) { + messages(...args: ConstructorParameters) { return new OperationReplyMessagesElement(...args); }, }, ParametersElement: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: unknown[]) { return new ParameterElement(...args); }, }, ParameterElement: { - enum(...args: any[]) { + enum(...args: ConstructorParameters) { return new ArrayElement(...args); }, - examples(...args: any[]) { + examples(...args: ConstructorParameters) { return new ArrayElement(...args); }, }, ServerBindingsElement: { - http(...args: any[]) { + http(...args: Record[]) { return new HttpServerBindingElement(...args); }, - ws(...args: any[]) { + ws(...args: Record[]) { return new WebSocketServerBindingElement(...args); }, - kafka(...args: any[]) { + kafka(...args: Record[]) { return new KafkaServerBindingElement(...args); }, - anypointmq(...args: any[]) { + anypointmq(...args: Record[]) { return new AnypointmqServerBindingElement(...args); }, - amqp(...args: any[]) { + amqp(...args: Record[]) { return new AmqpServerBindingElement(...args); }, - amqp1(...args: any[]) { + amqp1(...args: Record[]) { return new Amqp1ServerBindingElement(...args); }, - mqtt(...args: any[]) { + mqtt(...args: Record[]) { return new MqttServerBindingElement(...args); }, - mqtt5(...args: any[]) { + mqtt5(...args: Record[]) { return new Mqtt5ServerBindingElement(...args); }, - nats(...args: any[]) { + nats(...args: Record[]) { return new NatsServerBindingElement(...args); }, - jms(...args: any[]) { + jms(...args: Record[]) { return new JmsServerBindingElement(...args); }, - sns(...args: any[]) { + sns(...args: Record[]) { return new SnsServerBindingElement(...args); }, - solace(...args: any[]) { + solace(...args: Record[]) { return new SolaceServerBindingElement(...args); }, - sqs(...args: any[]) { + sqs(...args: Record[]) { return new SqsServerBindingElement(...args); }, - stomp(...args: any[]) { + stomp(...args: Record[]) { return new StompServerBindingElement(...args); }, - redis(...args: any[]) { + redis(...args: Record[]) { return new RedisServerBindingElement(...args); }, - mercure(...args: any[]) { + mercure(...args: Record[]) { return new MercureServerBindingElement(...args); }, - ibmmq(...args: any[]) { + ibmmq(...args: Record[]) { return new IbmmqServerBindingElement(...args); }, - googlepubsub(...args: any[]) { + googlepubsub(...args: Record[]) { return new GooglepubsubServerBindingElement(...args); }, - pulsar(...args: any[]) { + pulsar(...args: Record[]) { return new PulsarServerBindingElement(...args); }, }, ChannelBindingsElement: { - http(...args: any[]) { + http(...args: Record[]) { return new HttpChannelBindingElement(...args); }, - ws(...args: any[]) { + ws(...args: Record[]) { return new WebSocketChannelBindingElement(...args); }, - kafka(...args: any[]) { + kafka(...args: Record[]) { return new KafkaChannelBindingElement(...args); }, - anypointmq(...args: any[]) { + anypointmq(...args: Record[]) { return new AnypointmqChannelBindingElement(...args); }, - amqp(...args: any[]) { + amqp(...args: Record[]) { return new AmqpChannelBindingElement(...args); }, - amqp1(...args: any[]) { + amqp1(...args: Record[]) { return new Amqp1ChannelBindingElement(...args); }, - mqtt(...args: any[]) { + mqtt(...args: Record[]) { return new MqttChannelBindingElement(...args); }, - mqtt5(...args: any[]) { + mqtt5(...args: Record[]) { return new Mqtt5ChannelBindingElement(...args); }, - nats(...args: any[]) { + nats(...args: Record[]) { return new NatsChannelBindingElement(...args); }, - jms(...args: any[]) { + jms(...args: Record[]) { return new JmsChannelBindingElement(...args); }, - sns(...args: any[]) { + sns(...args: Record[]) { return new SnsChannelBindingElement(...args); }, - solace(...args: any[]) { + solace(...args: Record[]) { return new SolaceChannelBindingElement(...args); }, - sqs(...args: any[]) { + sqs(...args: Record[]) { return new SqsChannelBindingElement(...args); }, - stomp(...args: any[]) { + stomp(...args: Record[]) { return new StompChannelBindingElement(...args); }, - redis(...args: any[]) { + redis(...args: Record[]) { return new RedisChannelBindingElement(...args); }, - mercure(...args: any[]) { + mercure(...args: Record[]) { return new MercureChannelBindingElement(...args); }, - ibmmq(...args: any[]) { + ibmmq(...args: Record[]) { return new IbmmqChannelBindingElement(...args); }, - googlepubsub(...args: any[]) { + googlepubsub(...args: Record[]) { return new GooglepubsubChannelBindingElement(...args); }, - pulsar(...args: any[]) { + pulsar(...args: Record[]) { return new PulsarChannelBindingElement(...args); }, }, OperationBindingsElement: { - http(...args: any[]) { + http(...args: Record[]) { return new HttpOperationBindingElement(...args); }, - ws(...args: any[]) { + ws(...args: Record[]) { return new WebSocketOperationBindingElement(...args); }, - kafka(...args: any[]) { + kafka(...args: Record[]) { return new KafkaOperationBindingElement(...args); }, - anypointmq(...args: any[]) { + anypointmq(...args: Record[]) { return new AnypointmqOperationBindingElement(...args); }, - amqp(...args: any[]) { + amqp(...args: Record[]) { return new AmqpOperationBindingElement(...args); }, - amqp1(...args: any[]) { + amqp1(...args: Record[]) { return new Amqp1OperationBindingElement(...args); }, - mqtt(...args: any[]) { + mqtt(...args: Record[]) { return new MqttOperationBindingElement(...args); }, - mqtt5(...args: any[]) { + mqtt5(...args: Record[]) { return new Mqtt5OperationBindingElement(...args); }, - nats(...args: any[]) { + nats(...args: Record[]) { return new NatsOperationBindingElement(...args); }, - jms(...args: any[]) { + jms(...args: Record[]) { return new JmsOperationBindingElement(...args); }, - sns(...args: any[]) { + sns(...args: Record[]) { return new SnsOperationBindingElement(...args); }, - solace(...args: any[]) { + solace(...args: Record[]) { return new SolaceOperationBindingElement(...args); }, - sqs(...args: any[]) { + sqs(...args: Record[]) { return new SqsOperationBindingElement(...args); }, - stomp(...args: any[]) { + stomp(...args: Record[]) { return new StompOperationBindingElement(...args); }, - redis(...args: any[]) { + redis(...args: Record[]) { return new RedisOperationBindingElement(...args); }, - mercure(...args: any[]) { + mercure(...args: Record[]) { return new MercureOperationBindingElement(...args); }, - googlepubsub(...args: any[]) { + googlepubsub(...args: Record[]) { return new GooglepubsubOperationBindingElement(...args); }, - ibmmq(...args: any[]) { + ibmmq(...args: Record[]) { return new IbmmqOperationBindingElement(...args); }, - pulsar(...args: any[]) { + pulsar(...args: Record[]) { return new PulsarOperationBindingElement(...args); }, }, MessageBindingsElement: { - http(...args: any[]) { + http(...args: Record[]) { return new HttpMessageBindingElement(...args); }, - ws(...args: any[]) { + ws(...args: Record[]) { return new WebSocketMessageBindingElement(...args); }, - kafka(...args: any[]) { + kafka(...args: Record[]) { return new KafkaMessageBindingElement(...args); }, - anypointmq(...args: any[]) { + anypointmq(...args: Record[]) { return new AnypointmqMessageBindingElement(...args); }, - amqp(...args: any[]) { + amqp(...args: Record[]) { return new AmqpMessageBindingElement(...args); }, - amqp1(...args: any[]) { + amqp1(...args: Record[]) { return new Amqp1MessageBindingElement(...args); }, - mqtt(...args: any[]) { + mqtt(...args: Record[]) { return new MqttMessageBindingElement(...args); }, - mqtt5(...args: any[]) { + mqtt5(...args: Record[]) { return new Mqtt5MessageBindingElement(...args); }, - nats(...args: any[]) { + nats(...args: Record[]) { return new NatsMessageBindingElement(...args); }, - jms(...args: any[]) { + jms(...args: Record[]) { return new JmsMessageBindingElement(...args); }, - sns(...args: any[]) { + sns(...args: Record[]) { return new SnsMessageBindingElement(...args); }, - solace(...args: any[]) { + solace(...args: Record[]) { return new SolaceMessageBindingElement(...args); }, - sqs(...args: any[]) { + sqs(...args: Record[]) { return new SqsMessageBindingElement(...args); }, - stomp(...args: any[]) { + stomp(...args: Record[]) { return new StompMessageBindingElement(...args); }, - redis(...args: any[]) { + redis(...args: Record[]) { return new RedisMessageBindingElement(...args); }, - mercure(...args: any[]) { + mercure(...args: Record[]) { return new MercureMessageBindingElement(...args); }, - ibmmq(...args: any[]) { + ibmmq(...args: Record[]) { return new IbmmqMessageBindingElement(...args); }, - googlepubsub(...args: any[]) { + googlepubsub(...args: Record[]) { return new GooglepubsubMessageBindingElement(...args); }, - pulsar(...args: any[]) { + pulsar(...args: Record[]) { return new PulsarMessageBindingElement(...args); }, }, MessageElement: { - headers(...args: any[]) { + headers(...args: Record[]) { return new SchemaElement(...args); }, - correlationId(...args: any[]) { + correlationId(...args: Record[]) { return new CorrelationIDElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, - bindings(...args: any[]) { + bindings(...args: Record[]) { return new MessageBindingsElement(...args); }, - examples(...args: any[]) { + examples(...args: ConstructorParameters) { return new MessageExamplesElement(...args); }, - traits(...args: any[]) { + traits(...args: ConstructorParameters) { return new MessageTraitsElement(...args); }, - payload(...args: any[]) { + payload(...args: Record[]) { return new SchemaElement(...args); } }, MessageTraitElement: { - headers(...args: any[]) { + headers(...args: Record[]) { return new SchemaElement(...args); }, - correlationId(...args: any[]) { + correlationId(...args: Record[]) { return new CorrelationIDElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, - bindings(...args: any[]) { + bindings(...args: Record[]) { return new MessageBindingsElement(...args); }, - examples(...args: any[]) { + examples(...args: ConstructorParameters) { return new MessageExamplesElement(...args); }, }, MessageExampleElement: { - headers(...args: any[]) { + headers(...args: Record[]) { return new ObjectElement(...args); }, }, TagsElement: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new TagElement(...args); }, }, TagElement: { - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, }, ComponentsElement: { - schemas(...args: any[]) { + schemas(...args: Record[]) { return new ComponentsSchemasElement(...args); }, - servers(...args: any[]) { + servers(...args: Record[]) { return new ComponentsServersElement(...args); }, - serverVariables(...args: any[]) { + serverVariables(...args: Record[]) { return new ComponentsServerVariablesElement(...args); }, - messages(...args: any[]) { + messages(...args: Record[]) { return new ComponentsMessagesElement(...args); }, - securitySchemes(...args: any[]) { + securitySchemes(...args: Record[]) { return new ComponentsSecuritySchemesElement(...args); }, - parameters(...args: any[]) { + parameters(...args: Record[]) { return new ComponentsParametersElement(...args); }, - correlationIds(...args: any[]) { + correlationIds(...args: Record[]) { return new ComponentsCorrelationIDsElement(...args); }, - operationTraits(...args: any[]) { + operationTraits(...args: Record[]) { return new ComponentsOperationTraitsElement(...args); }, - messageTraits(...args: any[]) { + messageTraits(...args: Record[]) { return new ComponentsMessageTraitsElement(...args); }, - serverBindings(...args: any[]) { + serverBindings(...args: Record[]) { return new ComponentsServerBindingsElement(...args); }, - channelBindings(...args: any[]) { + channelBindings(...args: Record[]) { return new ComponentsChannelBindingsElement(...args); }, - operationBindings(...args: any[]) { + operationBindings(...args: Record[]) { return new ComponentsOperationBindingsElement(...args); }, - messageBindings(...args: any[]) { + messageBindings(...args: Record[]) { return new ComponentsMessageBindingsElement(...args); }, - operations(...args: any[]) { + operations(...args: Record[]) { return new ComponentsOperationsElement(...args); }, - replies(...args: any[]) { + replies(...args: Record[]) { return new OperationReplyElement(...args); }, - replyAddresses(...args: any[]) { + replyAddresses(...args: Record[]) { return new OperationReplyAddressElement(...args); }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, - tags(...args: any[]) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, }, SchemaElement: { - allOf(...args: any[]) { + allOf(...args: ConstructorParameters) { const element = new ArrayElement(...args); element.classes.push('json-schema-allOf'); return element; }, - anyOf(...args: any[]) { + anyOf(...args: ConstructorParameters) { const element = new ArrayElement(...args); element.classes.push('json-schema-anyOf'); return element; }, - oneOf(...args: any[]) { + oneOf(...args: ConstructorParameters) { const element = new ArrayElement(...args); element.classes.push('json-schema-oneOf'); return element; }, - not(...args: any[]) { + not(...args: Record[]) { return new SchemaElement(...args); }, - if(...args: any[]) { + if(...args: Record[]) { return new SchemaElement(...args); }, - then(...args: any[]) { + then(...args: Record[]) { return new SchemaElement(...args); }, - else(...args: any[]) { + else(...args: Record[]) { return new SchemaElement(...args); }, - enum(...args: any[]) { + enum(...args: ConstructorParameters ) { return new ArrayElement(...args); }, - items(...args: any[]) { + items(...args: Record[]) { return new SchemaElement(...args); }, - additionalItems(...args: any[]) { + additionalItems(...args: Record[]) { return new SchemaElement(...args); }, - contains(...args: any[]) { + contains(...args: Record[]) { return new SchemaElement(...args); }, - required(...args: any[]) { + required(...args: ConstructorParameters) { const element = new ArrayElement(...args); element.classes.push('json-schema-required'); return element; }, - properties(...args: any[]) { + properties(...args: Record[]) { const element = new ObjectElement(...args); element.classes.push('json-schema-properties'); return element; }, - patternProperties(...args: any[]) { + patternProperties(...args: Record[]) { const element = new ObjectElement(...args); element.classes.push('json-schema-patternProperties'); return element; }, - additionalProperties(...args: any[]) { + additionalProperties(...args: Record[]) { return new SchemaElement(...args); }, - dependencies(...args: any[]) { + dependencies(...args: Record[]) { const element = new ObjectElement(...args); element.classes.push('json-schema-dependencies'); return element; }, - propertyNames(...args: any[]) { + propertyNames(...args: Record[]) { return new SchemaElement(...args); }, - examples(...args: any[]) { + examples(...args: ConstructorParameters) { const element = new ArrayElement(...args); element.classes.push('json-schema-examples'); return element; }, - definitions(...args: any[]) { + definitions(...args: Record[]) { const element = new ObjectElement(...args); element.classes.push('json-schema-definitions'); return element; }, - externalDocs(...args: any[]) { + externalDocs(...args: Record[]) { return new ExternalDocumentationElement(...args); }, }, SecuritySchemeElement: { - flows(...args: any[]) { + flows(...args: Record[]) { return new OAuthFlowsElement(...args); }, - scopes(...args: any[]) { + scopes(...args: ConstructorParameters) { return new ArrayElement(...args); }, }, OAuthFlowsElement: { - implicit(...args: any[]) { + implicit(...args: Record[]) { return new OAuthFlowElement(...args); }, - password(...args: any[]) { + password(...args: Record[]) { return new OAuthFlowElement(...args); }, - clientCredentials(...args: any[]) { + clientCredentials(...args: Record[]) { return new OAuthFlowElement(...args); }, - authorizationCode(...args: any[]) { + authorizationCode(...args: Record[]) { return new OAuthFlowElement(...args); }, }, OAuthFlowElement: { - availableScopes(...args: any[]) { + availableScopes(...args: ConstructorParameters) { return new SecuritySchemeScopesElement(...args); }, }, HttpOperationBindingElement: { - query(...args: any[]) { + query(...args: Record[]) { return new SchemaElement(...args); }, }, HttpMessageBindingElement: { - headers(...args: any[]) { + headers(...args: Record[]) { return new SchemaElement(...args); }, }, WebSocketChannelBindingElement: { - query(...args: any[]) { + query(...args: Record[]) { return new SchemaElement(...args); }, - headers(...args: any[]) { + headers(...args: Record[]) { return new SchemaElement(...args); }, }, KafkaOperationBindingElement: { - groupId(...args: any[]) { + groupId(...args: Record[]) { return new SchemaElement(...args); }, - clientId(...args: any[]) { + clientId(...args: Record[]) { return new SchemaElement(...args); }, }, KafkaMessageBindingElement: { - key(...args: any[]) { + key(...args: Record[]) { return new SchemaElement(...args); }, }, AnypointmqMessageBindingElement: { - headers(...args: any[]) { + headers(...args: Record[]) { return new SchemaElement(...args); }, }, AmqpChannelBindingElement: { - exchange(...args: any[]) { + exchange(...args: Record[]) { return new ObjectElement(...args); }, - queue(...args: any[]) { + queue(...args: Record[]) { return new ObjectElement(...args); }, }, AmqpOperationBindingElement: { - cc(...args: any[]) { + cc(...args: ConstructorParameters) { return new ArrayElement(...args); }, - bcc(...args: any[]) { + bcc(...args: ConstructorParameters) { return new ArrayElement(...args); }, }, IbmmqChannelBindingElement: { - queue(...args: any[]) { + queue(...args: Record[]) { return new ObjectElement(...args); }, - topic(...args: any[]) { + topic(...args: Record[]) { return new ObjectElement(...args); }, }, MqttServerBindingElement: { - lastWill(...args: any[]) { + lastWill(...args: Record[]) { return new ObjectElement(...args); }, }, SolaceOperationBindingElement: { - destinations(...args: any[]) { + destinations(...args: ConstructorParameters) { return new ArrayElement(...args); }, }, GooglepubsubChannelBindingElement: { - labels(...args: any[]) { + labels(...args: Record[]) { return new ObjectElement(...args); }, - messageStoragePolicy(...args: any[]) { + messageStoragePolicy(...args: Record[]) { return new ObjectElement(...args); }, - schemaSettings(...args: any[]) { + schemaSettings(...args: Record[]) { return new ObjectElement(...args); }, }, GooglepubsubMessageBindingElement: { - attributes(...args: any[]) { + attributes(...args: Record[]) { return new ObjectElement(...args); }, - schema(...args: any[]) { + schema(...args: Record[]) { return new ObjectElement(...args); }, }, PulsarChannelBindingElement: { - 'geo-replication': function geoReplication(...args: any[]) { + 'geo-replication': function geoReplication(...args: ConstructorParameters) { return new ArrayElement(...args); }, - retention(...args: any[]) { + retention(...args: Record[]) { return new ObjectElement(...args); }, }, [ComponentsSchemasElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new SchemaElement(...args); }, }, [ComponentsServersElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ServerElement(...args); }, }, [ComponentsServerVariablesElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ServerVariableElement(...args); }, }, [ComponentsMessagesElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new MessageElement(...args); }, }, [ComponentsSecuritySchemesElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new SecuritySchemeElement(...args); }, }, [ComponentsParametersElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ParameterElement(...args); }, }, [ComponentsCorrelationIDsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new CorrelationIDElement(...args); }, }, [ComponentsOperationTraitsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new OperationTraitElement(...args); }, }, [ComponentsMessageTraitsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new MessageTraitElement(...args); }, }, [ComponentsServerBindingsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ServerBindingsElement(...args); }, }, [ComponentsChannelBindingsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ChannelBindingsElement(...args); }, }, [ComponentsOperationBindingsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new OperationBindingsElement(...args); }, }, [ComponentsOperationsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new OperationBindingsElement(...args); }, }, [ComponentsMessageBindingsElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new MessageBindingsElement(...args); }, }, [ComponentsOperationsElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new OperationElement(...args); }, }, [ServerVariablesElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new ServerVariableElement(...args); }, }, [ServerSecurityElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new SecuritySchemeElement(...args); }, }, [OperationTraitsElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new OperationTraitElement(...args); }, }, [OperationSecurityElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new SecuritySchemeElement(...args); }, }, [OperationMessagesElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: ConstructorParameters) { return new OperationMessagesElement(...args); }, }, [OperationReplyMessagesElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new ReferenceElement(...args); }, }, [MessageExamplesElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new MessageExampleElement(...args); }, }, [MessageTraitsElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new MessageTraitElement(...args); }, }, [MessageTraitExamplesElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new MessageExampleElement(...args); }, }, [ChannelServersElement.primaryClass]: { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: string[]) { return new StringElement(...args); }, }, [ComponentsRepliesElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new OperationReplyElement(...args); }, }, [ComponentsReplyAddressesElement.primaryClass]: { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new OperationReplyAddressElement(...args); }, }, 'json-schema-properties': { - '[key: *]': function key(...args: any[]) { + '[key: *]': function key(...args: Record[]) { return new SchemaElement(...args); }, }, 'json-schema-allOf': { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new SchemaElement(...args); }, }, 'json-schema-anyOf': { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new SchemaElement(...args); }, }, 'json-schema-oneOf': { - '<*>': function asterisk(...args: any[]) { + '<*>': function asterisk(...args: Record[]) { return new SchemaElement(...args); }, }, }; -const findElementFactory = (ancestor: any, keyName: string) => { +const findElementFactory = (ancestor: any , keyName: string) => { const elementType = getNodeType(ancestor) - const keyMapping = schema[elementType ?? ''] || schema[toValue(ancestor.classes.first)]; - - return typeof keyMapping === 'undefined' - ? undefined - : Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') - ? keyMapping['[key: *]'] - : keyMapping[keyName]; + const keyMapping = (schema[elementType ?? ''] || schema[toValue(ancestor.classes.first)]) as Record | unknown | undefined ; + + if (keyMapping == null || typeof keyMapping !== 'object') { + return undefined; + } + + return Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') + ? (keyMapping as Record)['[key: *]'] + : (keyMapping as Record)[keyName]; }; const plugin = () => () => ({ visitor: { - StringElement(element: StringElement, key: any, parent: any, path: any, ancestors: any[]) { + StringElement( + element: StringElement, + key: unknown, parent: unknown, path: unknown, ancestors: Record[] | unknown[]) { if (!isEmptyElement(element)) return undefined; const lineage = [...ancestors, parent].filter(isElement); From 19980fdda637f0ce48f120b813b25b2493134942 Mon Sep 17 00:00:00 2001 From: Oliwia Rogala Date: Fri, 7 Nov 2025 13:52:58 +0100 Subject: [PATCH 25/27] test(ns-asyncapi-3): add tests for AsyncAPI 3 namespace (#5039) --- packages/apidom-ns-asyncapi-2/src/index.ts | 37 +- packages/apidom-ns-asyncapi-3/.mocharc.json | 8 + packages/apidom-ns-asyncapi-3/package.json | 6 +- .../src/elements/MultiFormatSchema.ts | 4 +- .../src/elements/Server.ts | 8 + packages/apidom-ns-asyncapi-3/src/index.ts | 25 +- .../apidom-ns-asyncapi-3/src/namespace.ts | 2 - .../apidom-ns-asyncapi-3/src/predicates.ts | 17 +- .../plugins/replace-empty-element.ts | 40 +- .../src/refractor/specification.ts | 40 +- .../visitors/async-api-3/channels/index.ts | 21 +- .../operation-reply/MessagesVisitor.ts | 2 +- .../async-api-3/operation/MessagesVisitor.ts | 32 +- .../src/traversal/visitor.ts | 14 +- packages/apidom-ns-asyncapi-3/test/.eslintrc | 57 + .../test/fixtures/simple-asyncapi-3.json | 32 - packages/apidom-ns-asyncapi-3/test/index.ts | 3 - .../apidom-ns-asyncapi-3/test/media-types.ts | 56 + .../test/mocha-bootstrap.ts | 11 + .../apidom-ns-asyncapi-3/test/perf/index.ts | 18 + .../test/perf/visitor-shortcut.ts | 40 + .../apidom-ns-asyncapi-3/test/predicates.ts | 1108 ++ .../refractor/__snapshots__/index.ts.snap | 8999 +++++++++++++++++ .../AsyncApi3/__snapshots__/index.ts.snap | 29 + .../refractor/elements/AsyncApi3/index.ts | 25 + .../__snapshots__/index.ts.snap | 3 + .../elements/AsyncApiVersion/index.ts | 16 + .../Channel/__snapshots__/index.ts.snap | 127 + .../test/refractor/elements/Channel/index.ts | 142 + .../__snapshots__/index.ts.snap | 62 + .../elements/ChannelBindings/index.ts | 36 + .../Channels/__snapshots__/index.ts.snap | 17 + .../test/refractor/elements/Channels/index.ts | 22 + .../Components/__snapshots__/index.ts.snap | 250 + .../refractor/elements/Components/index.ts | 138 + .../Contact/__snapshots__/index.ts.snap | 14 + .../test/refractor/elements/Contact/index.ts | 20 + .../CorrelationID/__snapshots__/index.ts.snap | 11 + .../refractor/elements/CorrelationID/index.ts | 19 + .../__snapshots__/index.ts.snap | 3 + .../elements/DefaultContentType/index.ts | 16 + .../__snapshots__/index.ts.snap | 11 + .../elements/ExternalDocumentation/index.ts | 19 + .../Identifier/__snapshots__/index.ts.snap | 3 + .../refractor/elements/Identifier/index.ts | 18 + .../elements/Info/__snapshots__/index.ts.snap | 74 + .../test/refractor/elements/Info/index.ts | 76 + .../License/__snapshots__/index.ts.snap | 11 + .../test/refractor/elements/License/index.ts | 19 + .../Message/__snapshots__/index.ts.snap | 185 + .../test/refractor/elements/Message/index.ts | 214 + .../__snapshots__/index.ts.snap | 62 + .../elements/MessageBindings/index.ts | 36 + .../__snapshots__/index.ts.snap | 20 + .../elements/MessageExample/index.ts | 21 + .../MessageTrait/__snapshots__/index.ts.snap | 136 + .../refractor/elements/MessageTrait/index.ts | 155 + .../Messages/__snapshots__/index.ts.snap | 24 + .../test/refractor/elements/Messages/index.ts | 32 + .../__snapshots__/index.ts.snap | 47 + .../elements/MultiFormatSchema/index.ts | 56 + .../OAuthFlow/__snapshots__/index.ts.snap | 23 + .../refractor/elements/OAuthFlow/index.ts | 24 + .../OAuthFlows/__snapshots__/index.ts.snap | 17 + .../refractor/elements/OAuthFlows/index.ts | 21 + .../Operation/__snapshots__/index.ts.snap | 141 + .../refractor/elements/Operation/index.ts | 161 + .../__snapshots__/index.ts.snap | 62 + .../elements/OperationBindings/index.ts | 36 + .../__snapshots__/index.ts.snap | 31 + .../elements/OperationReply/index.ts | 38 + .../__snapshots__/index.ts.snap | 11 + .../elements/OperationReplyAddress/index.ts | 19 + .../__snapshots__/index.ts.snap | 89 + .../elements/OperationTrait/index.ts | 113 + .../Operations/__snapshots__/index.ts.snap | 24 + .../refractor/elements/Operations/index.ts | 32 + .../Parameter/__snapshots__/index.ts.snap | 24 + .../refractor/elements/Parameter/index.ts | 22 + .../Parameters/__snapshots__/index.ts.snap | 24 + .../refractor/elements/Parameters/index.ts | 32 + .../Reference/__snapshots__/index.ts.snap | 15 + .../refractor/elements/Reference/index.ts | 46 + .../Schema/__snapshots__/index.ts.snap | 286 + .../test/refractor/elements/Schema/index.ts | 127 + .../__snapshots__/index.ts.snap | 33 + .../elements/SecurityScheme/index.ts | 26 + .../Server/__snapshots__/index.ts.snap | 117 + .../test/refractor/elements/Server/index.ts | 133 + .../__snapshots__/index.ts.snap | 62 + .../elements/ServerBindings/index.ts | 36 + .../__snapshots__/index.ts.snap | 21 + .../elements/ServerVariable/index.ts | 21 + .../Servers/__snapshots__/index.ts.snap | 17 + .../test/refractor/elements/Servers/index.ts | 22 + .../elements/Tag/__snapshots__/index.ts.snap | 28 + .../test/refractor/elements/Tag/index.ts | 41 + .../elements/Tags/__snapshots__/index.ts.snap | 11 + .../test/refractor/elements/Tags/index.ts | 16 + .../__snapshots__/index.ts.snap | 47 + .../bindings/amqp/AmqpChannelBinding/index.ts | 33 + .../__snapshots__/index.ts.snap | 14 + .../bindings/amqp/AmqpMessageBinding/index.ts | 20 + .../__snapshots__/index.ts.snap | 40 + .../amqp/AmqpOperationBinding/index.ts | 28 + .../__snapshots__/index.ts.snap | 3 + .../bindings/amqp/AmqpServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../amqp1/Amqp1ChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../amqp1/Amqp1MessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../amqp1/Amqp1OperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../amqp1/Amqp1ServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 14 + .../AnypointmqChannelBinding/index.ts | 20 + .../__snapshots__/index.ts.snap | 24 + .../AnypointmqMessageBinding/index.ts | 32 + .../__snapshots__/index.ts.snap | 3 + .../AnypointmqOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../AnypointmqServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 33 + .../googlepubsubChannelBinding/index.ts | 28 + .../__snapshots__/index.ts.snap | 23 + .../googlepubsubMessageBinding/index.ts | 24 + .../__snapshots__/index.ts.snap | 3 + .../googlepubsubOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../googlepubsubServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/http/HttpChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 24 + .../bindings/http/HttpMessageBinding/index.ts | 32 + .../__snapshots__/index.ts.snap | 36 + .../http/HttpOperationBinding/index.ts | 36 + .../__snapshots__/index.ts.snap | 3 + .../bindings/http/HttpServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 38 + .../ibmmq/IbmmqChannelBinding/index.ts | 30 + .../__snapshots__/index.ts.snap | 20 + .../ibmmq/IbmmqMessageBinding/index.ts | 22 + .../__snapshots__/index.ts.snap | 23 + .../ibmmq/IbmmqServerBinding/index.ts | 23 + .../__snapshots__/index.ts.snap | 3 + .../ibmmq/ibmmqOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/jms/JmsChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/jms/JmsMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/jms/JmsOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/jms/JmsServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 17 + .../kafka/KafkaChannelBinding/index.ts | 21 + .../__snapshots__/index.ts.snap | 36 + .../kafka/KafkaMessageBinding/index.ts | 36 + .../__snapshots__/index.ts.snap | 33 + .../kafka/KafkaOperationBinding/index.ts | 36 + .../__snapshots__/index.ts.snap | 14 + .../kafka/KafkaServerBinding/index.ts | 20 + .../__snapshots__/index.ts.snap | 3 + .../mercure/MercureChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../mercure/MercureMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../mercure/MercureOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../mercure/MercureServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/mqtt/MqttChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 8 + .../bindings/mqtt/MqttMessageBinding/index.ts | 18 + .../__snapshots__/index.ts.snap | 14 + .../mqtt/MqttOperationBinding/index.ts | 20 + .../__snapshots__/index.ts.snap | 32 + .../bindings/mqtt/MqttServerBinding/index.ts | 27 + .../__snapshots__/index.ts.snap | 3 + .../mqtt5/Mqtt5ChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../mqtt5/Mqtt5MessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../mqtt5/Mqtt5OperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../mqtt5/Mqtt5ServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/nats/NatsChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/nats/NatsMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 11 + .../nats/NatsOperationBinding/index.ts | 19 + .../__snapshots__/index.ts.snap | 3 + .../bindings/nats/NatsServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 37 + .../pulsar/PulsarChannelBinding/index.ts | 28 + .../__snapshots__/index.ts.snap | 3 + .../pulsar/PulsarMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../pulsar/PulsarOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 11 + .../pulsar/PulsarServerBinding/index.ts | 19 + .../__snapshots__/index.ts.snap | 3 + .../redis/RedisChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../redis/RedisMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../redis/RedisOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../redis/RedisServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sns/SnsChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sns/SnsMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sns/SnsOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sns/SnsServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../solace/SolaceChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../solace/SolaceMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 12 + .../solace/SolaceOperationBinding/index.ts | 19 + .../__snapshots__/index.ts.snap | 11 + .../solace/SolaceServerBinding/index.ts | 19 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sqs/SqsChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sqs/SqsMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sqs/SqsOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../bindings/sqs/SqsServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../stomp/StompChannelBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../stomp/StompMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../stomp/StompOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../stomp/StompServerBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 39 + .../ws/WebSocketChannelBinding/index.ts | 38 + .../__snapshots__/index.ts.snap | 3 + .../ws/WebSocketMessageBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../ws/WebSocketOperationBinding/index.ts | 16 + .../__snapshots__/index.ts.snap | 3 + .../ws/WebSocketServerBinding/index.ts | 16 + .../refractor/fixtures/asyncapi-3-0-0.json | 458 + .../test/refractor/index.ts | 283 + .../__snapshots__/mappings.ts.snap | 154 + .../__snapshots__/sequences.ts.snap | 106 + .../__snapshots__/index.ts.snap | 56 + .../elements/ChannelBindings/index.ts | 37 + .../__snapshots__/index.ts.snap | 56 + .../elements/MessageBindings/index.ts | 37 + .../__snapshots__/index.ts.snap | 53 + .../elements/OperationBindings/index.ts | 36 + .../__snapshots__/index.ts.snap | 56 + .../elements/ServerBindings/index.ts | 37 + .../plugins/replace-empty-element/mappings.ts | 188 + .../replace-empty-element/sequences.ts | 104 + .../apidom-ns-asyncapi-3/test/tsconfig.json | 10 + 266 files changed, 18522 insertions(+), 128 deletions(-) create mode 100644 packages/apidom-ns-asyncapi-3/.mocharc.json create mode 100644 packages/apidom-ns-asyncapi-3/test/.eslintrc delete mode 100644 packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json delete mode 100644 packages/apidom-ns-asyncapi-3/test/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/media-types.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/mocha-bootstrap.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/perf/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/perf/visitor-shortcut.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/predicates.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/License/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/License/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/fixtures/asyncapi-3-0-0.json create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/mappings.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/sequences.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/__snapshots__/index.ts.snap create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/index.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/mappings.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/sequences.ts create mode 100644 packages/apidom-ns-asyncapi-3/test/tsconfig.json diff --git a/packages/apidom-ns-asyncapi-2/src/index.ts b/packages/apidom-ns-asyncapi-2/src/index.ts index bb76365e57..5db7c01a29 100644 --- a/packages/apidom-ns-asyncapi-2/src/index.ts +++ b/packages/apidom-ns-asyncapi-2/src/index.ts @@ -859,30 +859,29 @@ export { WebSocketServerBindingElement, } from './refractor/registration.ts'; +export { default as ChannelItemsServersElement } from './elements/nces/ChannelItemsServers.ts'; +export { default as ComponentsChannelBindingsElement } from './elements/nces/ComponentsChannelBindings.ts'; export { default as ComponentsChannelsElement } from './elements/nces/ComponentsChannels.ts'; +export { default as ComponentsCorrelationIDsElement } from './elements/nces/ComponentsCorrelationIDs.ts'; +export { default as ComponentsMessageBindingsElement } from './elements/nces/ComponentsMessageBindings.ts'; +export { default as ComponentsMessagesElement } from './elements/nces/ComponentsMessages.ts'; +export { default as ComponentsMessageTraitsElement } from './elements/nces/ComponentsMessageTraits.ts'; +export { default as ComponentsOperationBindingsElement } from './elements/nces/ComponentsOperationBindings.ts'; +export { default as ComponentsOperationTraitsElement } from './elements/nces/ComponentsOperationTraits.ts'; +export { default as ComponentsParametersElement } from './elements/nces/ComponentsParameters.ts'; export { default as ComponentsSchemasElement } from './elements/nces/ComponentsSchemas.ts'; +export { default as ComponentsSecuritySchemesElement } from './elements/nces/ComponentsSecuritySchemes.ts'; +export { default as ComponentsServerBindingsElement } from './elements/nces/ComponentsServerBindings.ts'; +export { default as ComponentsServersElement } from './elements/nces/ComponentsServers.ts'; +export { default as ComponentsServerVariablesElement } from './elements/nces/ComponentsServerVariables.ts'; export { default as MessageExamplesElement } from './elements/nces/MessageExamples.ts'; export { default as MessageTraitsElement } from './elements/nces/MessageTraits.ts'; +export { default as MessageTraitExamplesElement } from './elements/nces/MessageTraitExamples.ts'; +export { default as OAuthFlowScopesElement } from './elements/nces/OAuthFlowScopes.ts'; export { default as OperationMessageElement } from './elements/nces/OperationMessage.ts'; +export { default as OperationMessageMapElement } from './elements/nces/OperationMessageMap.ts'; export { default as OperationSecurityElement } from './elements/nces/OperationSecurity.ts'; +export { default as ServerVariablesElement } from './elements/nces/ServerVariables.ts'; export { default as OperationTraitsElement } from './elements/nces/OperationTraits.ts'; +export { default as OperationTraitSecurityElement } from './elements/nces/OperationTraitSecurity.ts'; export { default as ServerSecurityElement } from './elements/nces/ServerSecurity.ts'; - -export type { default as ChannelItemsServersElement } from './elements/nces/ChannelItemsServers.ts'; -export type { default as ComponentsChannelBindingsElement } from './elements/nces/ComponentsChannelBindings.ts'; -export type { default as ComponentsCorrelationIDsElement } from './elements/nces/ComponentsCorrelationIDs.ts'; -export type { default as ComponentsMessageBindingsElement } from './elements/nces/ComponentsMessageBindings.ts'; -export type { default as ComponentsMessagesElement } from './elements/nces/ComponentsMessages.ts'; -export type { default as ComponentsMessageTraitsElement } from './elements/nces/ComponentsMessageTraits.ts'; -export type { default as ComponentsOperationBindingsElement } from './elements/nces/ComponentsOperationBindings.ts'; -export type { default as ComponentsOperationTraitsElement } from './elements/nces/ComponentsOperationTraits.ts'; -export type { default as ComponentsParametersElement } from './elements/nces/ComponentsParameters.ts'; -export type { default as ComponentsSecuritySchemesElement } from './elements/nces/ComponentsSecuritySchemes.ts'; -export type { default as ComponentsServerBindingsElement } from './elements/nces/ComponentsServerBindings.ts'; -export type { default as ComponentsServersElement } from './elements/nces/ComponentsServers.ts'; -export type { default as ComponentsServerVariablesElement } from './elements/nces/ComponentsServerVariables.ts'; -export type { default as MessageTraitExamplesElement } from './elements/nces/MessageTraitExamples.ts'; -export type { default as OAuthFlowScopesElement } from './elements/nces/OAuthFlowScopes.ts'; -export type { default as OperationMessageMapElement } from './elements/nces/OperationMessageMap.ts'; -export type { default as OperationTraitSecurityElement } from './elements/nces/OperationTraitSecurity.ts'; -export type { default as ServerVariablesElement } from './elements/nces/ServerVariables.ts'; diff --git a/packages/apidom-ns-asyncapi-3/.mocharc.json b/packages/apidom-ns-asyncapi-3/.mocharc.json new file mode 100644 index 0000000000..7f356d617c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/.mocharc.json @@ -0,0 +1,8 @@ +{ + "extensions": ["ts"], + "loader": "ts-node/esm", + "recursive": true, + "spec": "test/**/*.ts", + "file": ["test/mocha-bootstrap.ts"], + "ignore": ["test/perf/**/*.ts"] +} diff --git a/packages/apidom-ns-asyncapi-3/package.json b/packages/apidom-ns-asyncapi-3/package.json index b954d041b5..cf64ef6f39 100644 --- a/packages/apidom-ns-asyncapi-3/package.json +++ b/packages/apidom-ns-asyncapi-3/package.json @@ -23,7 +23,11 @@ "lint": "eslint ./", "lint:fix": "eslint ./ --fix", "clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types", - "test": "NODE_ENV=test ts-mocha --project tsconfig.json --exit \"test/**/*.ts\"", + "test": "NODE_ENV=test ts-mocha --exit", + "test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 BABEL_ENV=cjs mocha", + "perf": "cross-env BABEL_ENV=es babel ./test/perf --out-dir ./test/perf --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/index.mjs", + "perf:visitor-shortcut": "cross-env BABEL_ENV=es babel ./test/perf/visitor-shortcut.ts --out-file ./test/perf/visitor-shortcut.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/visitor-shortcut.mjs", + "typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit", "typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json 2>&1 | shx grep -v 'Visitor_base'" }, "repository": { diff --git a/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts index 674117dd8f..c409e8ed50 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/MultiFormatSchema.ts @@ -6,11 +6,11 @@ import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/api class MultiFormatSchema extends ObjectElement { constructor(content?: Record, meta?: Meta, attributes?: Attributes) { super(content, meta, attributes); - this.element = 'multiformatSchema'; + this.element = 'multiFormatSchema'; } get schemaFormat(): StringElement | undefined { - return this.get('schemaForamt'); + return this.get('schemaFormat'); } set schemaFormat(schemaFormat: StringElement | undefined) { diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts index dc45353c65..e2095db321 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -40,6 +40,14 @@ class Server extends ServerElement { this.set('pathName', pathName); } + get description(): StringElement | undefined { + return this.get('description'); + } + + set description(description: StringElement | undefined) { + this.set('description', description); + } + get title(): StringElement | undefined { return this.get('title'); } diff --git a/packages/apidom-ns-asyncapi-3/src/index.ts b/packages/apidom-ns-asyncapi-3/src/index.ts index fd85201e45..a529dc7e6a 100644 --- a/packages/apidom-ns-asyncapi-3/src/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/index.ts @@ -4,7 +4,30 @@ export type { Format } from './media-types.ts'; // eslint-disable-next-line no-restricted-exports export { default } from './namespace.ts'; -export { isAsyncApiVersionElement } from './predicates.ts'; +export { default as refractorPluginReplaceEmptyElement } from './refractor/plugins/replace-empty-element.ts'; + +export { + isAsyncApi3Element, + isAsyncApiVersionElement, + isChannelBindingsElement, + isChannelElement, + isChannelsElement, + isComponentsElement, + isContactElement, + isIdentifierElement, + isInfoElement, + isLicenseElement, + isMultiFormatSchemaElement, + isOperationElement, + isParameterElement, + isParametersElement, + isReferenceElement, + isSchemaElement, + isServerElement, + isServerBindingsElement, + isServersElement, + isServerVariableElement, +} from './predicates.ts'; export { /** diff --git a/packages/apidom-ns-asyncapi-3/src/namespace.ts b/packages/apidom-ns-asyncapi-3/src/namespace.ts index f7f9b27ef7..73eaaf9906 100644 --- a/packages/apidom-ns-asyncapi-3/src/namespace.ts +++ b/packages/apidom-ns-asyncapi-3/src/namespace.ts @@ -3,7 +3,6 @@ import { NamespacePluginOptions } from '@swagger-api/apidom-core'; import AsyncApi3Element from './elements/AsyncApi3.ts'; import AsyncApiVersionElement from './elements/AsyncApiVersion.ts'; import ChannelElement from './elements/Channel.ts'; -import ChannelAddressExpressionsElement from './elements/ChannelAddressExpressions.ts'; import ChannelBindingsElement from './elements/ChannelBindings.ts'; import ChannelsElement from './elements/Channels.ts'; import ComponentsElement from './elements/Components.ts'; @@ -148,7 +147,6 @@ const asyncApi3 = { base.register('asyncApi3', AsyncApi3Element); base.register('asyncApiVersion', AsyncApiVersionElement); base.register('channel', ChannelElement); - base.register('channelAddressExpressions', ChannelAddressExpressionsElement); base.register('channelBindings', ChannelBindingsElement); base.register('channels', ChannelsElement); base.register('components', ComponentsElement); diff --git a/packages/apidom-ns-asyncapi-3/src/predicates.ts b/packages/apidom-ns-asyncapi-3/src/predicates.ts index f581543f5e..5fd35cabd5 100644 --- a/packages/apidom-ns-asyncapi-3/src/predicates.ts +++ b/packages/apidom-ns-asyncapi-3/src/predicates.ts @@ -1,7 +1,8 @@ -import { createPredicate, isElement } from '@swagger-api/apidom-core'; +import { createPredicate } from '@swagger-api/apidom-core'; -import MultiFormatSchemaElement from './elements/MultiFormatSchema.ts'; +import AsyncApi3Element from './elements/AsyncApi3.ts'; import AsyncApiVersionElement from './elements/AsyncApiVersion.ts'; +import MultiFormatSchemaElement from './elements/MultiFormatSchema.ts'; import ChannelBindingsElement from './elements/ChannelBindings.ts'; import ChannelElement from './elements/Channel.ts'; import ChannelsElement from './elements/Channels.ts'; @@ -23,8 +24,16 @@ import ServerVariableElement from './elements/ServerVariable.ts'; /** * @public */ -export const isAsyncApi3Element = (node: unknown) => - isElement(node) && node.element === 'asyncApi3'; +export const isAsyncApi3Element = createPredicate( + ({ hasBasicElementProps, isElementType, primitiveEq, hasClass }) => { + return (element: unknown): element is AsyncApi3Element => + element instanceof AsyncApi3Element || + (hasBasicElementProps(element) && + isElementType('asyncApi3', element) && + primitiveEq('object', element) && + hasClass('api', element)); + }, +); /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts index 14c734dfb4..092a4ce824 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts @@ -1,3 +1,4 @@ +import { defaultTo } from 'ramda'; import { ArrayElement, ObjectElement, @@ -29,6 +30,7 @@ import { ServerVariablesElement, } from '@swagger-api/apidom-ns-asyncapi-2'; +import mediaTypes from '../../media-types.ts'; import AsyncApiVersionElement from '../../elements/AsyncApiVersion.ts'; import IdentifierElement from '../../elements/Identifier.ts'; import InfoElement from '../../elements/Info.ts'; @@ -65,6 +67,7 @@ import OperationsElement from '../../elements/Operations.ts'; import TagElement from '../../elements/Tag.ts'; import MessageExampleElement from '../../elements/MessageExample.ts'; import ReferenceElement from '../../elements/Reference.ts'; +import MultiFormatSchemaElement from '../../elements/MultiFormatSchema.ts'; import ComponentsRepliesElement from '../../elements/nces/ComponentsReplies.ts'; import ComponentsReplyAddressesElement from '../../elements/nces/ComponentsReplyAddresses.ts'; // binding elements @@ -156,7 +159,6 @@ import OperationSecurityElement from '../../elements/nces/OperationSecurity.ts'; import OperationTraitsElement from '../../elements/nces/OperationTraits.ts'; import OperationTraitSecurityElement from '../../elements/nces/OperationTraitSecurity.ts'; import SecuritySchemeScopesElement from '../../elements/nces/SecuritySchemeScopes.ts'; -// borrowed AsyncAPI 2 NCEs import { getNodeType } from '../../traversal/visitor.ts'; /** * This plugin targets YAML 1.2 empty nodes. When a mapping value is omitted, @@ -643,7 +645,7 @@ const schema: Record = { }, payload(...args: Record[]) { return new SchemaElement(...args); - } + }, }, MessageTraitElement: { @@ -742,6 +744,22 @@ const schema: Record = { }, }, + MultiFormatSchemaElement: { + schema(...args: any[]) { + const { context: multiFormatSchemaElement } = this as { context: MultiFormatSchemaElement }; + const schemaFormat = defaultTo( + mediaTypes.latest(), + toValue(multiFormatSchemaElement.schemaFormat), + ); + + if (mediaTypes.includes(schemaFormat)) { + return new SchemaElement(...args); + } + + return new ObjectElement(...args); + }, + }, + SchemaElement: { allOf(...args: ConstructorParameters) { const element = new ArrayElement(...args); @@ -1079,9 +1097,10 @@ const schema: Record = { }, [OperationMessagesElement.primaryClass]: { - '<*>': function asterisk(...args: ConstructorParameters) { - return new OperationMessagesElement(...args); + '<*>': function asterisk(...args: Record[]) { + return new ReferenceElement(...args); }, + }, [OperationReplyMessagesElement.primaryClass]: { @@ -1109,11 +1128,11 @@ const schema: Record = { }, [ChannelServersElement.primaryClass]: { - '<*>': function asterisk(...args: string[]) { - return new StringElement(...args); + '<*>': function asterisk(...args: Record[] ) { + return new ReferenceElement(...args); }, }, - + [ComponentsRepliesElement.primaryClass]: { '[key: *]': function key(...args: Record[]) { return new OperationReplyElement(...args); @@ -1152,7 +1171,7 @@ const schema: Record = { }; const findElementFactory = (ancestor: any , keyName: string) => { - const elementType = getNodeType(ancestor) + const elementType = getNodeType(ancestor); const keyMapping = (schema[elementType ?? ''] || schema[toValue(ancestor.classes.first)]) as Record | unknown | undefined ; if (keyMapping == null || typeof keyMapping !== 'object') { @@ -1164,6 +1183,9 @@ const findElementFactory = (ancestor: any , keyName: string) => { : (keyMapping as Record)[keyName]; }; +/** + * @public + */ const plugin = () => () => ({ visitor: { StringElement( @@ -1180,7 +1202,7 @@ const plugin = () => () => ({ context = element; elementFactory = findElementFactory(parentElement, '<*>'); } else if (isMemberElement(parentElement)) { - context = lineage.at(-2); + context = lineage.at(-2); elementFactory = findElementFactory(context, toValue(parentElement.key)); } diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts index 82e0162b1e..b1934ed94d 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -8,24 +8,25 @@ import ChannelBindingsVisitor from './visitors/async-api-3/channel-bindings/inde import ChannelServersVisitor from './visitors/async-api-3/channel/ServersVisitor.ts'; import ChannelVisitor from './visitors/async-api-3/channel/index.ts'; import ChannelsVisitor from './visitors/async-api-3/channels/index.ts'; -import ComponentsOperationsVisitor from './visitors/async-api-3/components/OperationsVisitor.ts'; -import ComponentsSchemasVisitor from './visitors/async-api-3/components/SchemasVisitor.ts'; import ComponentsChannelsVisitor from './visitors/async-api-3/components/ChannelsVisitor.ts'; import ComponentsExternalDocumentationVisitor from './visitors/async-api-3/components/ExternalDocumentationVisitor.ts'; +import ComponentsOperationsVisitor from './visitors/async-api-3/components/OperationsVisitor.ts'; import ComponentsRepliesVisitor from './visitors/async-api-3/components/RepliesVisitor.ts'; import ComponentsReplyAddressesVisitor from './visitors/async-api-3/components/ReplyAddressesVisitor.ts'; +import ComponentsSchemasVisitor from './visitors/async-api-3/components/SchemasVisitor.ts'; import ComponentsTagsVisitor from './visitors/async-api-3/components/TagsVisitor.ts'; import ComponentsVisitor from './visitors/async-api-3/components/index.ts'; import ContactVisitor from './visitors/async-api-3/contact/index.ts'; import CorrelationIDVisitor from './visitors/async-api-3/correlation-id/index.ts'; -import DefaultContentTypeVisitor from '../elements/DefaultContentType.ts'; +import DefaultContentTypeVisitor from './visitors/async-api-3/DefaultContentTypeVisitor.ts'; import ExternalDocumentationOrReferenceVisitor from './visitors/async-api-3/external-documentation-object/ExternalDocumentationOrReferenceVisitor.ts'; import ExternalDocumentationVisitor from './visitors/async-api-3/external-documentation-object/index.ts'; import FallbackVisitor from './visitors/FallbackVisitor.ts'; import IdentifierVisitor from './visitors/async-api-3/IdentifierVisitor.ts'; import InfoVisitor from './visitors/async-api-3/info/info.ts'; import LicenseVisitor from './visitors/async-api-3/license/index.ts'; -import MessageBindingsVisitor from './visitors/async-api-3/message/BindingsVisitor.ts'; +import MessageBindingsVisitor from './visitors/async-api-3/message-bindings/index.ts'; +import MessageBindingsVisitor_ from './visitors/async-api-3/message/BindingsVisitor.ts'; import MessageCorrelationIdVisitor from './visitors/async-api-3/message/CorrelationIdVisitor.ts'; import MessageExampleVisitor from './visitors/async-api-3/message-example/index.ts'; import MessageExamplesVisitor from './visitors/async-api-3/message/ExamplesVisitor.ts'; @@ -56,10 +57,12 @@ import OperationsVisitor from './visitors/async-api-3/operations/index.ts'; import ParameterVisitor from './visitors/async-api-3/parameter/index.ts'; import ParametersVisitor from './visitors/async-api-3/parameters/index.ts'; import ReferenceVisitor from './visitors/async-api-3/reference/index.ts'; +import SchemaOrReferenceVisitor from './visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts'; import SchemaVisitor from './visitors/async-api-3/schema/index.ts'; import SecuritySchemeScopesVisitor from './visitors/async-api-3/security-scheme/ScopesVisitor.ts'; import SecuritySchemeVisitor from './visitors/async-api-3/security-scheme/index.ts'; import ServerBindingsVisitor from './visitors/async-api-3/server-bindings/index.ts'; +import ServerSecurityVisitor from './visitors/async-api-3/server/SecurityVisitor.ts'; import ServerVariableVisitor from './visitors/async-api-3/server-variable/index.ts'; import ServerVisitor from './visitors/async-api-3/server/index.ts'; import ServersVisitor from './visitors/async-api-3/servers/index.ts'; @@ -164,7 +167,6 @@ import WebSocketChannelBindingVisitor from './visitors/async-api-3/bindings/ws/c import WebSocketMessageBindingVisitor from './visitors/async-api-3/bindings/ws/message-binding/index.ts'; import WebSocketOperationBindingVisitor from './visitors/async-api-3/bindings/ws/operation-binding/index.ts'; import WebSocketServerBindingVisitor from './visitors/async-api-3/bindings/ws/server-binding/index.ts'; -import SchemaOrReferenceVisitor from './visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts'; const SchemaSpecification = { $visitor: SchemaVisitor, @@ -204,8 +206,12 @@ const specification = { AsyncApi: { $visitor: AsyncApi3Visitor, fixedFields: { - asyncapi: { $ref: '#/visitors/docuemnt/objects/AsyncApiVersion' }, - id: { $ref: '#/visitors/docuemnt/objects/Identifier' }, + asyncapi: { + $ref: '#/visitors/document/objects/AsyncApiVersion', + }, + id: { + $ref: '#/visitors/document/objects/Identifier', + }, info: { $ref: '#/visitors/document/objects/Info' }, servers: { $ref: '#/visitors/document/objects/Servers' }, defaultContentType: { @@ -272,8 +278,7 @@ const specification = { summary: { $ref: '#/visitors/value' }, variables: AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.variables, - security: - AsyncApi2_0Specification.visitors.document.objects.Server.fixedFields.security, + security: ServerSecurityVisitor, tags: { $ref: '#/visitors/document/objects/Tags', }, @@ -340,12 +345,12 @@ const specification = { externalDocs: ExternalDocumentationOrReferenceVisitor, bindings: OperationBindingsVisitor_, traits: OperationTraitsVisitor, - message: OperationMessagesVisitor, + messages: OperationMessagesVisitor, reply: OperationReplyVisitor_, }, }, OperationTrait: { - $visitors: OperationTraitVisitor, + $visitor: OperationTraitVisitor, fixedFields: { title: { $ref: '#/visitors/value' }, summary: @@ -353,9 +358,7 @@ const specification = { description: AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields .description, - security: - AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields - .security, + security: OperationSecurityVisitor, tags: { $ref: '#/visitors/document/objects/Tags', }, @@ -655,8 +658,8 @@ const specification = { tags: { $ref: '#/visitors/document/objects/Tags', }, - externalDocs: ExternalDocumentationVisitor, - bindings: MessageBindingsVisitor, + externalDocs: ExternalDocumentationOrReferenceVisitor, + bindings: MessageBindingsVisitor_, examples: MessageExamplesVisitor, traits: MessageTraitsVisitor, }, @@ -664,6 +667,7 @@ const specification = { MessageTrait: { $visitor: MessageTraitVisitor, fixedFields: { + messageId: { $ref: '#/visitors/value' }, headers: MessageTraitHeadersVisitor, correlationId: AsyncApi2_0Specification.visitors.document.objects.MessageTrait.fixedFields @@ -726,12 +730,16 @@ const specification = { .fixedFields.url, }, }, + JSONReference: { + $ref: '#/visitors/document/objects/Reference', + }, Reference: { $visitor: ReferenceVisitor, fixedFields: { $ref: AsyncApi2_0Specification.visitors.document.objects.Reference.fixedFields.$ref, }, }, + LinkDescription: AsyncApi2_0Specification.visitors.document.objects.LinkDescription, Components: { $visitor: ComponentsVisitor, fixedFields: { diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts index ce3f518a6e..d0ea5e7ef0 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts @@ -1,26 +1,21 @@ import { Mixin } from 'ts-mixer'; import { ObjectElement } from '@swagger-api/apidom-core'; -import PatternedFieldsVisitor, { - PatternedFieldsVisitorOptions, - SpecPath, -} from '../../generics/PatternedFieldsVisitor.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; import ChannelsElement from '../../../../elements/Channels.ts'; -import ReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; import { isReferenceLikeElement } from '../../../predicates.ts'; /** * @public */ -export interface ChannelsVisitorOptions - extends PatternedFieldsVisitorOptions, - FallbackVisitorOptions {} +export interface ChannelsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} /** * @public */ -class ChannelsVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { +class ChannelsVisitor extends Mixin(MapVisitor, FallbackVisitor) { declare public readonly element: ChannelsElement; declare protected readonly specPath: SpecPath< @@ -32,17 +27,15 @@ class ChannelsVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { constructor(options: ChannelsVisitorOptions) { super(options); this.element = new ChannelsElement(); - this.element.classes.push('servers'); - this.specPath = (element: unknown) => { - return isReferenceLikeElement(element) + this.specPath = (element: unknown) => + isReferenceLikeElement(element) ? ['document', 'objects', 'Reference'] : ['document', 'objects', 'Channel']; - }; this.canSupportSpecificationExtensions = false; } ObjectElement(objectElement: ObjectElement) { - const result = PatternedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + const result = MapVisitor.prototype.ObjectElement.call(this, objectElement); // @ts-ignore this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => { diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts index 43497ae366..3965c93b81 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts @@ -30,7 +30,7 @@ class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { const element = this.toRefractedElement(specPath, item); if (isReferenceElement(element)) { - element.setMetaProperty('referenced-element', 'operation-reply-messages'); + element.setMetaProperty('referenced-element', 'operation-reply-message'); } this.element.push(element); diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts index 406d94b309..8fc1b6995e 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.ts @@ -23,23 +23,23 @@ class MessagesVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) { super(options); this.element = new OperationMessagesElement(); } - + ArrayElement(arrayElement: ArrayElement) { - arrayElement.forEach((item: Element): void => { - const specPath = ['document', 'objects', 'Reference']; - const element = this.toRefractedElement(specPath, item); - - if (isReferenceElement(element)) { - element.setMetaProperty('referenced-element', 'operation-messages'); - } - - this.element.push(element); - }); - - this.copyMetaAndAttributes(arrayElement, this.element); - - return BREAK; - } + arrayElement.forEach((item: Element): void => { + const specPath = ['document', 'objects', 'Reference']; + const element = this.toRefractedElement(specPath, item); + + if (isReferenceElement(element)) { + element.setMetaProperty('referenced-element', 'operation-message'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } } export default MessagesVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts b/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts index 756ba5def9..ba5e6af1bc 100644 --- a/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts +++ b/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts @@ -14,12 +14,14 @@ export const getNodeType = (element: T): string | undefined = * @public */ export const keyMap = { + /** + * `AsyncApi 3.0.0` specification elements. + */ AsyncApi3Element: ['content'], AsyncApiVersionElement: [], ChannelBindingsElement: ['content'], ChannelElement: ['content'], ChannelsElement: ['content'], - ChannelAddressExpressionsElement: ['content'], ComponentsElement: ['content'], ContactElement: ['content'], CorrelationIDElement: ['content'], @@ -32,18 +34,19 @@ export const keyMap = { MessageExampleElement: ['content'], MessageBindingsElement: ['content'], MessageTraitElement: ['content'], + MultiFormatSchemaElement: ['content'], OAuthFlowElement: ['content'], OAuthFlowsElement: ['content'], OperationsElement: ['content'], OperationElement: ['content'], OperationBindingsElement: ['content'], + OperationReplyElement: ['content'], + OperationReplyAddressElement: ['content'], OperationTraitElement: ['content'], ParameterElement: ['content'], ParametersElement: ['content'], ReferenceElement: ['content'], SchemaElement: ['content'], - MultiFormatSchemaElement: ['content'], - SecurityRequirementElement: ['content'], SecuritySchemeElement: ['content'], ServerElement: ['content'], ServerBindingsElement: ['content'], @@ -51,11 +54,6 @@ export const keyMap = { ServerVariableElement: ['content'], TagElement: ['content'], TagsElement: ['content'], - - // operation-reply/address - OperationReplyElement: ['content'], - OperationReplyAddressElement: ['content'], - /** * Binding elements. */ diff --git a/packages/apidom-ns-asyncapi-3/test/.eslintrc b/packages/apidom-ns-asyncapi-3/test/.eslintrc new file mode 100644 index 0000000000..5cc99718c6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/.eslintrc @@ -0,0 +1,57 @@ +{ + "env": { + "mocha": true + }, + "globals": { + "document": true + }, + "plugins": [ + "mocha" + ], + "rules": { + "no-void": 0, + "no-underscore-dangle": 0, + "func-names": 0, + "prefer-arrow-callback": 0, + "no-array-constructor": 0, + "prefer-rest-params": 0, + "no-new-wrappers": 0, + "mocha/no-skipped-tests": 2, + "mocha/handle-done-callback": 2, + "mocha/valid-suite-description": 2, + "mocha/no-mocha-arrows": 2, + "mocha/no-hooks-for-single-case": 2, + "mocha/no-sibling-hooks": 2, + "mocha/no-top-level-hooks": 2, + "mocha/no-identical-title": 2, + "mocha/no-nested-tests": 2, + "mocha/no-exclusive-tests": 2, + "max-classes-per-file": 0, + "@typescript-eslint/no-unused-expressions": 0, + "import/no-relative-packages": 0, + "@typescript-eslint/naming-convention": [ + "error", + { + "selector": "variable", + "format": ["camelCase", "PascalCase", "UPPER_CASE"], + "leadingUnderscore": "forbid" + }, + { + "selector": "variable", + "format": null, + "filter": { + "regex": "^__dirname$", + "match": true + } + }, + { + "selector": "variable", + "format": null, + "filter": { + "regex": "^__filename$", + "match": true + } + } + ] + } +} diff --git a/packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json b/packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json deleted file mode 100644 index 6045ebc0a2..0000000000 --- a/packages/apidom-ns-asyncapi-3/test/fixtures/simple-asyncapi-3.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "asyncapi": "3.0.0", - "info": { - "title": "Simple API", - "version": "1.0.0" - }, - "channels": { - "user/signedup": { - "publish": { - "message": { - "name": "UserSignedUp", - "payload": { - "type": "object", - "properties": { - "id": { "type": "string" } - } - } - } - } - } - }, - "components": { - "messages": { - "UserSignedUp": { - "name": "UserSignedUp", - "payload": { - "type": "object" - } - } - } - } -} diff --git a/packages/apidom-ns-asyncapi-3/test/index.ts b/packages/apidom-ns-asyncapi-3/test/index.ts deleted file mode 100644 index 8070601f68..0000000000 --- a/packages/apidom-ns-asyncapi-3/test/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -describe('apidom-ns-asyncapi-3 basic refractor', () => { - it('parses a simple asyncapi v3 fixture into elements', () => {}); -}); diff --git a/packages/apidom-ns-asyncapi-3/test/media-types.ts b/packages/apidom-ns-asyncapi-3/test/media-types.ts new file mode 100644 index 0000000000..8b754b937d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/media-types.ts @@ -0,0 +1,56 @@ +import { assert } from 'chai'; + +import { mediaTypes } from '../src/index.ts'; + +describe('media-types', function () { + context('findBy', function () { + context('given no version and format', function () { + specify('should return latest generic version', function () { + const mediaType = mediaTypes.findBy(); + + assert.strictEqual(mediaType, 'application/vnd.aai.asyncapi;version=3.0.0'); + }); + }); + + context('given version and no format', function () { + specify('should return generic version', function () { + const mediaType = mediaTypes.findBy('3.0.0'); + + assert.strictEqual(mediaType, 'application/vnd.aai.asyncapi;version=3.0.0'); + }); + }); + + context('given version and json format', function () { + specify('should return json version', function () { + const mediaType = mediaTypes.findBy('3.0.0', 'json'); + + assert.strictEqual(mediaType, 'application/vnd.aai.asyncapi+json;version=3.0.0'); + }); + }); + + context('given version and yaml format', function () { + specify('should return yaml version', function () { + const mediaType = mediaTypes.findBy('3.0.0', 'yaml'); + + assert.strictEqual(mediaType, 'application/vnd.aai.asyncapi+yaml;version=3.0.0'); + }); + }); + + context('given unknown version', function () { + specify('should return unknown media type', function () { + const mediaType = mediaTypes.findBy('2021-05-08'); + + assert.strictEqual(mediaType, mediaTypes.unknownMediaType); + }); + }); + + context('given unknown format', function () { + specify('should return unknown media type', function () { + // @ts-ignore + const mediaType = mediaTypes.findBy(undefined, 'test'); + + assert.strictEqual(mediaType, mediaTypes.unknownMediaType); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/mocha-bootstrap.ts b/packages/apidom-ns-asyncapi-3/test/mocha-bootstrap.ts new file mode 100644 index 0000000000..aec560d03f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/mocha-bootstrap.ts @@ -0,0 +1,11 @@ +import * as chai from 'chai'; +import { jestSnapshotPlugin, addSerializer } from 'mocha-chai-jest-snapshot'; + +// @ts-ignore +import * as jestApiDOMSerializer from '../../../scripts/jest-serializer-apidom.mjs'; +// @ts-ignore +import * as jestStringSerializer from '../../../scripts/jest-serializer-string.mjs'; + +chai.use(jestSnapshotPlugin()); +addSerializer(jestApiDOMSerializer); +addSerializer(jestStringSerializer); diff --git a/packages/apidom-ns-asyncapi-3/test/perf/index.ts b/packages/apidom-ns-asyncapi-3/test/perf/index.ts new file mode 100644 index 0000000000..d94a86420a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/perf/index.ts @@ -0,0 +1,18 @@ +import Benchmark from 'benchmark'; +import type { Event } from 'benchmark'; + +import visitorShortcutBench from './visitor-shortcut.ts'; + +const suite = new Benchmark.Suite(); + +suite + .add(visitorShortcutBench) + // add listeners + .on('cycle', function (event: Event) { + console.info(String(event.target)); + }) + .on('complete', function () { + console.info('\nAll benchmarks have completed'); + }) + // run + .run(); diff --git a/packages/apidom-ns-asyncapi-3/test/perf/visitor-shortcut.ts b/packages/apidom-ns-asyncapi-3/test/perf/visitor-shortcut.ts new file mode 100644 index 0000000000..8f7672e80d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/perf/visitor-shortcut.ts @@ -0,0 +1,40 @@ +import Benchmark from 'benchmark'; +import type { Event } from 'benchmark'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import { AsyncApi3Element } from '../../src/index.ts'; + +const genericObjectElement = new ObjectElement({ + asyncapi: '3.0.0', + info: { + title: 'Webhook Example', + version: '1.0.0', + description: 'description', + termsOfService: 'tos', + }, +}); + +const options = { + name: 'visitor-shortcut', + minSamples: 700, + expected: '1,090 ops/sec ±0.62% (790 runs sampled)', + fn() { + AsyncApi3Element.refract(genericObjectElement); + }, +}; + +export default options; + +// we're running as a script +if (import.meta.url === `file://${process.argv[1]}`) { + const bench = new Benchmark({ + ...options, + onComplete(event: Event) { + console.info(String(event.target)); + }, + onError(event: Event) { + console.error(event); + }, + }); + bench.run(); +} diff --git a/packages/apidom-ns-asyncapi-3/test/predicates.ts b/packages/apidom-ns-asyncapi-3/test/predicates.ts new file mode 100644 index 0000000000..ff11cd08a9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/predicates.ts @@ -0,0 +1,1108 @@ +import { assert } from 'chai'; +import { ArrayElement } from '@swagger-api/apidom-core'; + +import { + isAsyncApi3Element, + isAsyncApiVersionElement, + isChannelElement, + isChannelBindingsElement, + isChannelsElement, + isComponentsElement, + isContactElement, + isIdentifierElement, + isInfoElement, + isLicenseElement, + isMultiFormatSchemaElement, + isOperationElement, + isParameterElement, + isParametersElement, + isReferenceElement, + isSchemaElement, + isServerElement, + isServerBindingsElement, + isServersElement, + isServerVariableElement, + AsyncApi3Element, + AsyncApiVersionElement, + ChannelElement, + ChannelBindingsElement, + ChannelsElement, + ComponentsElement, + ContactElement, + IdentifierElement, + InfoElement, + LicenseElement, + OperationElement, + ParameterElement, + ParametersElement, + ReferenceElement, + SchemaElement, + ServerElement, + ServerBindingsElement, + ServersElement, + ServerVariableElement, + MultiFormatSchemaElement, +} from '../src/index.ts'; + +describe('predicates', function () { + context('isAsyncApi3Element', function () { + context('given AsyncApi3Element instance value', function () { + specify('should return true', function () { + const element = new AsyncApi3Element(); + + assert.isTrue(isAsyncApi3Element(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class AsyncApi3SubElement extends AsyncApi3Element {} + + assert.isTrue(isAsyncApi3Element(new AsyncApi3SubElement())); + }); + }); + + context('given non AsyncApi3Element instance value', function () { + specify('should return false', function () { + assert.isFalse(isAsyncApi3Element(1)); + assert.isFalse(isAsyncApi3Element(null)); + assert.isFalse(isAsyncApi3Element(undefined)); + assert.isFalse(isAsyncApi3Element({})); + assert.isFalse(isAsyncApi3Element([])); + assert.isFalse(isAsyncApi3Element('string')); + }); + }); + + specify('should support duck-typing', function () { + const asyncApi3ElementDuck = { + _storedElement: 'asyncApi3', + _content: [], + classes: new ArrayElement(['api']), + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const asyncApi3ElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isAsyncApi3Element(asyncApi3ElementDuck)); + assert.isFalse(isAsyncApi3Element(asyncApi3ElementSwan)); + }); + }); + + context('isSchemaElement', function () { + context('given SchemaElement instance value', function () { + specify('should return true', function () { + const element = new SchemaElement(); + + assert.isTrue(isSchemaElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class SchemaSubElement extends SchemaElement {} + + assert.isTrue(isSchemaElement(new SchemaSubElement())); + }); + }); + + context('given non SchemaElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isSchemaElement(1)); + assert.isFalse(isSchemaElement(null)); + assert.isFalse(isSchemaElement(undefined)); + assert.isFalse(isSchemaElement({})); + assert.isFalse(isSchemaElement([])); + assert.isFalse(isSchemaElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const schemaElementDuck = { + _storedElement: 'schema', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const schemaElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isSchemaElement(schemaElementDuck)); + assert.isFalse(isSchemaElement(schemaElementSwan)); + }); + }); + + context('isMultiFormatSchemaElement', function () { + context('given MultiFormatSchemaElement instance value', function () { + specify('should return true', function () { + const element = new MultiFormatSchemaElement(); + + assert.isTrue(isMultiFormatSchemaElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class MultiFormatSchemaSubElement extends MultiFormatSchemaElement {} + + assert.isTrue(isMultiFormatSchemaElement(new MultiFormatSchemaSubElement())); + }); + }); + + context('given non MultiFormatSchemaElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isMultiFormatSchemaElement(1)); + assert.isFalse(isMultiFormatSchemaElement(null)); + assert.isFalse(isMultiFormatSchemaElement(undefined)); + assert.isFalse(isMultiFormatSchemaElement({})); + assert.isFalse(isMultiFormatSchemaElement([])); + assert.isFalse(isMultiFormatSchemaElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const schemaElementDuck = { + _storedElement: 'multiFormatSchema', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const multiFormatSchemaElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isMultiFormatSchemaElement(schemaElementDuck)); + assert.isFalse(isMultiFormatSchemaElement(multiFormatSchemaElementSwan)); + }); + }); + + context('isIdentifierElement', function () { + context('given IdentifierElement instance value', function () { + specify('should return true', function () { + const element = new IdentifierElement(); + + assert.isTrue(isIdentifierElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class IdentifierSubElement extends IdentifierElement {} + + assert.isTrue(isIdentifierElement(new IdentifierSubElement())); + }); + }); + + context('given non IdentifierElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isIdentifierElement(1)); + assert.isFalse(isIdentifierElement(null)); + assert.isFalse(isIdentifierElement(undefined)); + assert.isFalse(isIdentifierElement({})); + assert.isFalse(isIdentifierElement([])); + assert.isFalse(isIdentifierElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const identifierElementDuck = { + _storedElement: 'identifier', + _content: [], + primitive() { + return 'string'; + }, + get element() { + return this._storedElement; + }, + }; + + const identifierElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isIdentifierElement(identifierElementDuck)); + assert.isFalse(isIdentifierElement(identifierElementSwan)); + }); + }); + + context('isAsyncApiVersionElement', function () { + context('given AsyncApiVersionElement instance value', function () { + specify('should return true', function () { + const element = new AsyncApiVersionElement(); + + assert.isTrue(isAsyncApiVersionElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class AsyncApiVersionSubElement extends AsyncApiVersionElement {} + + assert.isTrue(isAsyncApiVersionElement(new AsyncApiVersionSubElement())); + }); + }); + + context('given non AsyncApiVersionElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isAsyncApiVersionElement(1)); + assert.isFalse(isAsyncApiVersionElement(null)); + assert.isFalse(isAsyncApiVersionElement(undefined)); + assert.isFalse(isAsyncApiVersionElement({})); + assert.isFalse(isAsyncApiVersionElement([])); + assert.isFalse(isAsyncApiVersionElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const asyncApiVersionElementDuck = { + _storedElement: 'asyncApiVersion', + _content: '', + primitive() { + return 'string'; + }, + get element() { + return this._storedElement; + }, + }; + + const asyncapiElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isAsyncApiVersionElement(asyncApiVersionElementDuck)); + assert.isFalse(isAsyncApiVersionElement(asyncapiElementSwan)); + }); + }); + + context('isComponentsElement', function () { + context('given ComponentsElement instance value', function () { + specify('should return true', function () { + const element = new ComponentsElement(); + + assert.isTrue(isComponentsElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ComponentsSubElement extends ComponentsElement {} + + assert.isTrue(isComponentsElement(new ComponentsSubElement())); + }); + }); + + context('given non ComponentsElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isComponentsElement(1)); + assert.isFalse(isComponentsElement(null)); + assert.isFalse(isComponentsElement(undefined)); + assert.isFalse(isComponentsElement({})); + assert.isFalse(isComponentsElement([])); + assert.isFalse(isComponentsElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const componentsElementDuck = { + _storedElement: 'components', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const componentsElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isComponentsElement(componentsElementDuck)); + assert.isFalse(isComponentsElement(componentsElementSwan)); + }); + }); + + context('isInfoElement', function () { + context('given InfoElement instance value', function () { + specify('should return true', function () { + const element = new InfoElement(); + + assert.isTrue(isInfoElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class InfoSubElement extends InfoElement {} + + assert.isTrue(isInfoElement(new InfoSubElement())); + }); + }); + + context('given non InfoElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isInfoElement(1)); + assert.isFalse(isInfoElement(null)); + assert.isFalse(isInfoElement(undefined)); + assert.isFalse(isInfoElement({})); + assert.isFalse(isInfoElement([])); + assert.isFalse(isInfoElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const infoElementDuck = { + _storedElement: 'info', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const infoElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isInfoElement(infoElementDuck)); + assert.isFalse(isInfoElement(infoElementSwan)); + }); + }); + + context('isLicenseElement', function () { + context('given LicenseElement instance value', function () { + specify('should return true', function () { + const element = new LicenseElement(); + + assert.isTrue(isLicenseElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class LicenseSubElement extends LicenseElement {} + + assert.isTrue(isLicenseElement(new LicenseSubElement())); + }); + }); + + context('given non LicenseElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isLicenseElement(1)); + assert.isFalse(isLicenseElement(null)); + assert.isFalse(isLicenseElement(undefined)); + assert.isFalse(isLicenseElement({})); + assert.isFalse(isLicenseElement([])); + assert.isFalse(isLicenseElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const licenseElementDuck = { + _storedElement: 'license', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const licenseElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isLicenseElement(licenseElementDuck)); + assert.isFalse(isLicenseElement(licenseElementSwan)); + }); + }); + + context('isContactElement', function () { + context('given ContactElement instance value', function () { + specify('should return true', function () { + const element = new ContactElement(); + + assert.isTrue(isContactElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ContactSubElement extends ContactElement {} + + assert.isTrue(isContactElement(new ContactSubElement())); + }); + }); + + context('given non ContactElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isContactElement(1)); + assert.isFalse(isContactElement(null)); + assert.isFalse(isContactElement(undefined)); + assert.isFalse(isContactElement({})); + assert.isFalse(isContactElement([])); + assert.isFalse(isContactElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const concatElementDuck = { + _storedElement: 'contact', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const contactElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isContactElement(concatElementDuck)); + assert.isFalse(isContactElement(contactElementSwan)); + }); + }); + + context('isServersElement', function () { + context('given ServersElement instance value', function () { + specify('should return true', function () { + const element = new ServersElement(); + + assert.isTrue(isServersElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ServersSubElement extends ServersElement {} + + assert.isTrue(isServersElement(new ServersSubElement())); + }); + }); + + context('given non ServersElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isServersElement(1)); + assert.isFalse(isServersElement(null)); + assert.isFalse(isServersElement(undefined)); + assert.isFalse(isServersElement({})); + assert.isFalse(isServersElement([])); + assert.isFalse(isServersElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const serversElementDuck = { + _storedElement: 'servers', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const serversElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isServersElement(serversElementDuck)); + assert.isFalse(isServersElement(serversElementSwan)); + }); + }); + + context('isServerElement', function () { + context('given ServerElement instance value', function () { + specify('should return true', function () { + const element = new ServerElement(); + + assert.isTrue(isServerElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ServerSubElement extends ServerElement {} + + assert.isTrue(isServerElement(new ServerSubElement())); + }); + }); + + context('given non ServerElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isServerElement(1)); + assert.isFalse(isServerElement(null)); + assert.isFalse(isServerElement(undefined)); + assert.isFalse(isServerElement({})); + assert.isFalse(isServerElement([])); + assert.isFalse(isServerElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const serverElementDuck = { + _storedElement: 'server', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const serverElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isServerElement(serverElementDuck)); + assert.isFalse(isServerElement(serverElementSwan)); + }); + }); + + context('isServerVariableElement', function () { + context('given ServerVariableElement instance value', function () { + specify('should return true', function () { + const element = new ServerVariableElement(); + + assert.isTrue(isServerVariableElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ServerVariableSubElement extends ServerVariableElement {} + + assert.isTrue(isServerVariableElement(new ServerVariableSubElement())); + }); + }); + + context('given non ServerVariableElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isServerVariableElement(1)); + assert.isFalse(isServerVariableElement(null)); + assert.isFalse(isServerVariableElement(undefined)); + assert.isFalse(isServerVariableElement({})); + assert.isFalse(isServerVariableElement([])); + assert.isFalse(isServerVariableElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const serverVariableElementDuck = { + _storedElement: 'serverVariable', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const serverVariableElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isServerVariableElement(serverVariableElementDuck)); + assert.isFalse(isServerVariableElement(serverVariableElementSwan)); + }); + }); + + context('isChannelsElement', function () { + context('given ChannelsElement instance value', function () { + specify('should return true', function () { + const element = new ChannelsElement(); + + assert.isTrue(isChannelsElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ChannelsSubElement extends ChannelsElement {} + + assert.isTrue(isChannelsElement(new ChannelsSubElement())); + }); + }); + + context('given non ChannelsElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isChannelsElement(1)); + assert.isFalse(isChannelsElement(null)); + assert.isFalse(isChannelsElement(undefined)); + assert.isFalse(isChannelsElement({})); + assert.isFalse(isChannelsElement([])); + assert.isFalse(isChannelsElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const channelsElementDuck = { + _storedElement: 'channels', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const channelsElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isChannelsElement(channelsElementDuck)); + assert.isFalse(isChannelsElement(channelsElementSwan)); + }); + }); + + context('isChannelElement', function () { + context('given ChannelElement instance value', function () { + specify('should return true', function () { + const element = new ChannelElement(); + + assert.isTrue(isChannelElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ChannelItemSubElement extends ChannelElement {} + + assert.isTrue(isChannelElement(new ChannelItemSubElement())); + }); + }); + + context('given non ChannelElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isChannelElement(1)); + assert.isFalse(isChannelElement(null)); + assert.isFalse(isChannelElement(undefined)); + assert.isFalse(isChannelElement({})); + assert.isFalse(isChannelElement([])); + assert.isFalse(isChannelElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const channelElementDuck = { + _storedElement: 'channel', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const channelElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isChannelElement(channelElementDuck)); + assert.isFalse(isChannelElement(channelElementSwan)); + }); + }); + + context('isParameterElement', function () { + context('given ParameterElement instance value', function () { + specify('should return true', function () { + const element = new ParameterElement(); + + assert.isTrue(isParameterElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ParameterSubElement extends ParameterElement {} + + assert.isTrue(isParameterElement(new ParameterSubElement())); + }); + }); + + context('given non ParameterElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isParameterElement(1)); + assert.isFalse(isParameterElement(null)); + assert.isFalse(isParameterElement(undefined)); + assert.isFalse(isParameterElement({})); + assert.isFalse(isParameterElement([])); + assert.isFalse(isParameterElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const parameterElementDuck = { + _storedElement: 'parameter', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const parameterElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isParameterElement(parameterElementDuck)); + assert.isFalse(isParameterElement(parameterElementSwan)); + }); + }); + + context('isParametersElement', function () { + context('given ParametersElement instance value', function () { + specify('should return true', function () { + const element = new ParametersElement(); + + assert.isTrue(isParametersElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ParametersSubElement extends ParametersElement {} + + assert.isTrue(isParametersElement(new ParametersSubElement())); + }); + }); + + context('given non ParametersElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isParametersElement(1)); + assert.isFalse(isParametersElement(null)); + assert.isFalse(isParametersElement(undefined)); + assert.isFalse(isParametersElement({})); + assert.isFalse(isParametersElement([])); + assert.isFalse(isParametersElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const parametersElementDuck = { + _storedElement: 'parameters', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const parametersElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isParametersElement(parametersElementDuck)); + assert.isFalse(isParametersElement(parametersElementSwan)); + }); + }); + + context('isReferenceElement', function () { + context('given ReferenceElement instance value', function () { + specify('should return true', function () { + const element = new ReferenceElement(); + + assert.isTrue(isReferenceElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ReferenceSubElement extends ReferenceElement {} + + assert.isTrue(isReferenceElement(new ReferenceSubElement())); + }); + }); + + context('given non ReferenceElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isReferenceElement(1)); + assert.isFalse(isReferenceElement(null)); + assert.isFalse(isReferenceElement(undefined)); + assert.isFalse(isReferenceElement({})); + assert.isFalse(isReferenceElement([])); + assert.isFalse(isReferenceElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const referenceElementDuck = { + _storedElement: 'reference', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const referenceElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isReferenceElement(referenceElementDuck)); + assert.isFalse(isReferenceElement(referenceElementSwan)); + }); + }); + + context('isOperationElement', function () { + context('given OperationElement instance value', function () { + specify('should return true', function () { + const element = new OperationElement(); + + assert.isTrue(isOperationElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class OperationSubElement extends OperationElement {} + + assert.isTrue(isOperationElement(new OperationSubElement())); + }); + }); + + context('given non OperationElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isOperationElement(1)); + assert.isFalse(isOperationElement(null)); + assert.isFalse(isOperationElement(undefined)); + assert.isFalse(isOperationElement({})); + assert.isFalse(isOperationElement([])); + assert.isFalse(isOperationElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const operationElementDuck = { + _storedElement: 'operation', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const operationElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isOperationElement(operationElementDuck)); + assert.isFalse(isOperationElement(operationElementSwan)); + }); + }); + + context('isChannelBindingsElement', function () { + context('given ChannelBindingsElement instance value', function () { + specify('should return true', function () { + const element = new ChannelBindingsElement(); + + assert.isTrue(isChannelBindingsElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ChannelBindingsSubElement extends ChannelBindingsElement {} + + assert.isTrue(isChannelBindingsElement(new ChannelBindingsSubElement())); + }); + }); + + context('given non ChannelBindingsElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isChannelBindingsElement(1)); + assert.isFalse(isChannelBindingsElement(null)); + assert.isFalse(isChannelBindingsElement(undefined)); + assert.isFalse(isChannelBindingsElement({})); + assert.isFalse(isChannelBindingsElement([])); + assert.isFalse(isChannelBindingsElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const channelBindingsElementDuck = { + _storedElement: 'channelBindings', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const channelBindingsElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isChannelBindingsElement(channelBindingsElementDuck)); + assert.isFalse(isChannelBindingsElement(channelBindingsElementSwan)); + }); + }); + + context('isServerBindingsElement', function () { + context('given ServerBindingsElement instance value', function () { + specify('should return true', function () { + const element = new ServerBindingsElement(); + + assert.isTrue(isServerBindingsElement(element)); + }); + }); + + context('given subtype instance value', function () { + specify('should return true', function () { + class ServerBindingsSubElement extends ServerBindingsElement {} + + assert.isTrue(isServerBindingsElement(new ServerBindingsSubElement())); + }); + }); + + context('given non ServerBindingsElement instance value', function () { + specify('should return false', function () { + assert.isFalse(isServerBindingsElement(1)); + assert.isFalse(isServerBindingsElement(null)); + assert.isFalse(isServerBindingsElement(undefined)); + assert.isFalse(isServerBindingsElement({})); + assert.isFalse(isServerBindingsElement([])); + assert.isFalse(isServerBindingsElement('string')); + }); + }); + + specify('should support duck-typing', function () { + const serverBindingsElementDuck = { + _storedElement: 'serverBindings', + _content: [], + primitive() { + return 'object'; + }, + get element() { + return this._storedElement; + }, + }; + + const serverBindingsElementSwan = { + _storedElement: undefined, + _content: undefined, + primitive() { + return 'swan'; + }, + }; + + assert.isTrue(isServerBindingsElement(serverBindingsElementDuck)); + assert.isFalse(isServerBindingsElement(serverBindingsElementSwan)); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..490bbcdc2b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/__snapshots__/index.ts.snap @@ -0,0 +1,8999 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor given generic ApiDOM object in AsyncApi 3.0.0 shape should refract to AsyncApi3Element 1`] = ` +{ + "element": "asyncApi3", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "api" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "asyncapi" + }, + "value": { + "element": "asyncApiVersion", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "spec-version" + }, + { + "element": "string", + "content": "version" + } + ] + } + }, + "content": "3.0.0" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "id" + }, + "value": { + "element": "identifier", + "content": "urn:com:smartylighting:streetlights:server" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "info" + }, + "value": { + "element": "info", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "info" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "title" + }, + "value": { + "element": "string", + "content": "AsyncAPI Sample App" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "version" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "api-version" + }, + { + "element": "string", + "content": "version" + } + ] + } + }, + "content": "1.0.1" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "This is a sample server." + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "termsOfService" + }, + "value": { + "element": "string", + "content": "http://asyncapi.org/terms/" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "contact" + }, + "value": { + "element": "contact", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "API Support" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "http://www.asyncapi.org/support" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "email" + }, + "value": { + "element": "string", + "content": "support@asyncapi.org" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "license" + }, + "value": { + "element": "license", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "Apache 2.0" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "http://www.apache.org/licenses/LICENSE-2.0.html" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "tags" + }, + "value": { + "element": "tags", + "content": [ + { + "element": "tag", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "topLevelTag" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "topLevelTag description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of topLevelTag external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/topLevelTag" + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of this document external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/document" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "servers" + }, + "value": { + "element": "servers", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "servers" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "production" + }, + "value": { + "element": "server", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "host" + }, + "value": { + "element": "string", + "content": "{username}.gigantic-server.com" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "protocol" + }, + "value": { + "element": "string", + "content": "kafka" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "protocolVersion" + }, + "value": { + "element": "string", + "content": "1.0.0" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "pathname" + }, + "value": { + "element": "string", + "content": "/v2" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Production server description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "title" + }, + "value": { + "element": "string", + "content": "Production server" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "Production server summary." + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "variables" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "server-variables" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "username" + }, + "value": { + "element": "serverVariable", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "enum" + }, + "value": { + "element": "array", + "content": [ + { + "element": "string", + "content": "demo" + }, + { + "element": "string", + "content": "demo1" + }, + { + "element": "string", + "content": "demo2" + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "default" + }, + "value": { + "element": "string", + "content": "demo" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "This value is assigned by the service provider, in this example \`gigantic-server.com\`" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "examples" + }, + "value": { + "element": "array", + "content": [ + { + "element": "string", + "content": "demo" + }, + { + "element": "string", + "content": "demo1" + }, + { + "element": "string", + "content": "demo2" + } + ] + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "security" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "server-security" + } + ] + } + }, + "content": [ + { + "element": "securityScheme", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "petstore_auth" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "content": "apiKey" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Petstore Auth description" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "Petstore Auth" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "in" + }, + "value": { + "element": "string", + "content": "password" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "scheme" + }, + "value": { + "element": "string", + "content": "Authorization" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "bearerFormat" + }, + "value": { + "element": "string", + "content": "JWT" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "flows" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "implicit" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "password" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "clientCredentials" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "authorizationCode" + }, + "value": { + "element": "object" + } + } + } + ] + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "openIdConnectUrl" + }, + "value": { + "element": "string", + "content": "security-scheme-openIdConnectUrl" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "scopes" + }, + "value": { + "element": "array", + "content": [ + { + "element": "string", + "content": "write:pets" + }, + { + "element": "string", + "content": "read:pets" + } + ] + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindings" + }, + "value": { + "element": "serverBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaServerBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "server-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "tags" + }, + "value": { + "element": "tags", + "content": [ + { + "element": "tag", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "serversLevelTag" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "serversLevelTag description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of serversLevelTag external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/serversLevelTag" + } + } + } + ] + } + } + } + ] + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "development" + }, + "value": { + "element": "server", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "host" + }, + "value": { + "element": "string", + "content": "gigantic-server.com" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "protocol" + }, + "value": { + "element": "string", + "content": "kafka" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindings" + }, + "value": { + "element": "serverBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "jms" + }, + "value": { + "element": "jmsServerBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "server-binding" + } + ] + } + } + } + } + } + ] + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "defaultContentType" + }, + "value": { + "element": "defaultContentType", + "content": "application/json" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "channels" + }, + "value": { + "element": "channels", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "userSignedUp" + }, + "value": { + "element": "channel", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "address" + }, + "value": { + "element": "string", + "content": "users.{userId}" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "title" + }, + "value": { + "element": "string", + "content": "Users channel" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "This channel is used to exchange messages about user events." + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "Exchange messages about user events." + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "messages" + }, + "value": { + "element": "messages", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "messages" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "userSignedUp" + }, + "value": { + "element": "message", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "headers" + }, + "value": { + "element": "schema", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-draft-7" + } + ] + }, + "schema": { + "element": "string", + "content": "header-schema" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-type" + } + ] + } + }, + "content": "object" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "payload" + }, + "value": { + "element": "schema", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-draft-7" + } + ] + }, + "schema": { + "element": "string", + "content": "payload-schema" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-type" + } + ] + } + }, + "content": "object" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "properties" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-properties" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "user" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "schema" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/schemas/user" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "signup" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "schema" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/schemas/signup" + } + } + } + ] + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "correlationId" + }, + "value": { + "element": "correlationID", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "correlation id description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "location" + }, + "value": { + "element": "string", + "content": "http://asyncapi.com/" + } + } + } + ] + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "contentType" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "name of the message" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "title" + }, + "value": { + "element": "string", + "content": "title of the message" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "summary of the message" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "A longer description of the message" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "tags" + }, + "value": { + "element": "tags", + "content": [ + { + "element": "tag", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "tag3" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of tag3" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of tag 3 external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/tag3" + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of message 1 external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/message-1-external-docs" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindings" + }, + "value": { + "element": "messageBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaMessageBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "message-binding" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "key" + }, + "value": { + "element": "schema", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-draft-7" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-type" + } + ] + } + }, + "content": "integer" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindingVersion" + }, + "value": { + "element": "string", + "content": "0.1.0" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "examples" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "message-examples" + } + ] + } + }, + "content": [ + { + "element": "messageExample", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "headers" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "payload" + }, + "value": { + "element": "string", + "content": "{\\"a\\":\\"b\\"}" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "example name" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "example summary" + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "traits" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "message-traits" + } + ] + } + }, + "content": [ + { + "element": "messageTrait", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "headers" + }, + "value": { + "element": "schema", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-draft-7" + } + ] + }, + "schema": { + "element": "string", + "content": "header-schema" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-type" + } + ] + } + }, + "content": "object" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "correlationId" + }, + "value": { + "element": "correlationID", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "correlation id description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "location" + }, + "value": { + "element": "string", + "content": "http://asyncapi.com/" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "contentType" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "name of the message trait" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "title" + }, + "value": { + "element": "string", + "content": "title of the message trait" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "summary of the message trait" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "A longer description of the message trait" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "tags" + }, + "value": { + "element": "tags", + "content": [ + { + "element": "tag", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "tag4" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of tag4" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of tag 4 external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/tag4" + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of message 1 trait external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/message-1-trait-external-docs" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindings" + }, + "value": { + "element": "messageBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaMessageBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "message-binding" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "key" + }, + "value": { + "element": "schema", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-draft-7" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-type" + } + ] + } + }, + "content": "integer" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindingVersion" + }, + "value": { + "element": "string", + "content": "0.1.0" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "examples" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "message-trait-examples" + } + ] + } + }, + "content": [ + { + "element": "messageExample", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "headers" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "payload" + }, + "value": { + "element": "string", + "content": "{\\"a\\":\\"b\\"}" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "example name" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "example summary" + } + } + } + ] + } + ] + } + } + } + ] + } + ] + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "parameters" + }, + "value": { + "element": "parameters", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "userId" + }, + "value": { + "element": "parameter", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "User identifier" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "servers" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "channel-servers" + } + ] + } + }, + "content": [ + { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "channel-servers" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/servers/rabbitmqInProd" + } + } + } + ] + }, + { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "channel-servers" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/servers/rabbitmqInStaging" + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindings" + }, + "value": { + "element": "channelBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "amqp" + }, + "value": { + "element": "amqpChannelBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "channel-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "tags" + }, + "value": { + "element": "tags", + "content": [ + { + "element": "tag", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "user" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "User-related messages" + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Find more info here" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "user/loggedout" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "channel" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "https://outside.com/#/path/to/channel" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "components" + }, + "value": { + "element": "components", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "schemas" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-schemas" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "Schema1" + }, + "value": { + "element": "schema", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-draft-7" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-type" + } + ] + } + }, + "content": "object" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "Schema2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "schema" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/schemas/Schema1" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "Schema3" + }, + "value": { + "element": "multiFormatSchema", + "meta": { + "multiformat-schema-element": { + "element": "string", + "content": "schema" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "schemaFormat" + }, + "value": { + "element": "string", + "content": "application/vnd.aai.asyncapi;version=3.0.0" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "schema" + }, + "value": { + "element": "schema", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-schema-draft-7" + } + ] + } + } + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "messages" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-messages" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "Message1" + }, + "value": { + "element": "message" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "Message2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "message" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/messages/Message1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "securitySchemes" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-security-schemes" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "SecurityScheme1" + }, + "value": { + "element": "securityScheme" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "SecurityScheme2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "securityScheme" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/securitySchemes/SecurityScheme1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "parameters" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-parameters" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "Parameter1" + }, + "value": { + "element": "parameter", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "parameter description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "location" + }, + "value": { + "element": "string", + "content": "http://example.com" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "Parameter2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "parameter" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/parameters/Parameter1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "correlationIds" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-correlation-ids" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "CorrelationID1" + }, + "value": { + "element": "correlationID" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "CorrelationID2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "correlationID" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/correlationIds/CorrelationID1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "operationTraits" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-operation-traits" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "OperationTrait1" + }, + "value": { + "element": "operationTrait" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "OperationTrait2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "operationTrait" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/operationTraits/OperationTrait1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "messageTraits" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-message-traits" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "MessageTrait1" + }, + "value": { + "element": "messageTrait" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "MessageTrait2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "messageTrait" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/messageTraits/MessageTrait1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "serverBindings" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-server-bindings" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "ServerBinding1" + }, + "value": { + "element": "serverBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaServerBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "server-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "ServerBinding2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "serverBindings" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/serverBindings/ServerBinding1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "channelBindings" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-channel-bindings" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "ChannelBinding1" + }, + "value": { + "element": "channelBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaChannelBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "channel-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "ChannelBinding2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "channelBindings" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/channelBindings/ChannelBinding1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "operationBindings" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-operation-bindings" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "OperationBinding1" + }, + "value": { + "element": "operationBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaOperationBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "OperationBinding2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "operationBindings" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/operationBindings/OperationBinding1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "messageBindings" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-message-bindings" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "MessageBinding1" + }, + "value": { + "element": "messageBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaMessageBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "message-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "MessageBinding2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "messageBindings" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/messageBindings/MessageBinding1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "servers" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-servers" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "server1" + }, + "value": { + "element": "server" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "server2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "server" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/servers/server1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "serverVariables" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-server-variables" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "port" + }, + "value": { + "element": "serverVariable", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "enum" + }, + "value": { + "element": "array", + "content": [ + { + "element": "string", + "content": "8883" + }, + { + "element": "string", + "content": "8884" + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "default" + }, + "value": { + "element": "string", + "content": "8883" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "port1" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "serverVariable" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/serverVariables/port" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "channels" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-channels" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "channel1" + }, + "value": { + "element": "channel" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "channel2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "channel" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/channels/channel1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "operations" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-operations" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "SignUp1" + }, + "value": { + "element": "operation" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "SignUp2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "operation" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/operations/SignUp1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "replies" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-replies" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "UserReply1" + }, + "value": { + "element": "operationReply" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "UserReply2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "operationReply" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/replies/UserReply1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "replyAddresses" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-reply-addresses" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "UserReplyAddress1" + }, + "value": { + "element": "operationReplyAddress" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "UserReplyAddress2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "operation-reply-address" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/replyAddresses/UserReplyAddress1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-external-documentation" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "ExternalDoc1" + }, + "value": { + "element": "externalDocumentation" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "ExternalDoc2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "externalDocumentation" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/externalDocs/ExternalDoc1" + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "tags" + }, + "value": { + "element": "object", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "components-tags" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "UserTag1" + }, + "value": { + "element": "tag" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "UserTag2" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "tag" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/tags/UserTag1" + } + } + } + ] + } + } + } + ] + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "operations" + }, + "value": { + "element": "operations", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operations" + } + ] + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "patterned-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "onUserSignUp" + }, + "value": { + "element": "operation", + "meta": { + "operation-action": { + "element": "string", + "content": "send" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "title" + }, + "value": { + "element": "string", + "content": "User sign up" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "Action to sign a user up." + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "A longer description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "channel" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "channel" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/channels/userSignup" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "action" + }, + "value": { + "element": "string", + "content": "send" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "tags" + }, + "value": { + "element": "tags", + "content": [ + { + "element": "tag", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "operationTag" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "operationTag description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "description of operationTag external docs" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com/operationTag" + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindings" + }, + "value": { + "element": "operationBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaOperationBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "traits" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-traits" + } + ] + } + }, + "content": [ + { + "element": "operationTrait", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "title" + }, + "value": { + "element": "string", + "content": "Operation trait title" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Operation trait description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "summary" + }, + "value": { + "element": "string", + "content": "Operation trait summary" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "bindings" + }, + "value": { + "element": "operationBindings", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "kafka" + }, + "value": { + "element": "kafkaOperationBinding", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-binding" + } + ] + } + } + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "security" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-security" + } + ] + } + }, + "content": [ + { + "element": "securityScheme", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "petstore_auth" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "content": "apiKey" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Petstore Auth description" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "Petstore Auth" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "in" + }, + "value": { + "element": "string", + "content": "password" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "scheme" + }, + "value": { + "element": "string", + "content": "Authorization" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "bearerFormat" + }, + "value": { + "element": "string", + "content": "JWT" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "flows" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "implicit" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "password" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "clientCredentials" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "authorizationCode" + }, + "value": { + "element": "object" + } + } + } + ] + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "openIdConnectUrl" + }, + "value": { + "element": "string", + "content": "security-scheme-openIdConnectUrl" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "scopes" + }, + "value": { + "element": "array", + "content": [ + { + "element": "string", + "content": "write:pets" + }, + { + "element": "string", + "content": "read:pets" + } + ] + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Find more info here" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com" + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "security" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-security" + } + ] + } + }, + "content": [ + { + "element": "securityScheme", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "petstore_auth" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "type" + }, + "value": { + "element": "string", + "content": "apiKey" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Petstore Auth description" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "name" + }, + "value": { + "element": "string", + "content": "Petstore Auth" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "in" + }, + "value": { + "element": "string", + "content": "password" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "scheme" + }, + "value": { + "element": "string", + "content": "Authorization" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "bearerFormat" + }, + "value": { + "element": "string", + "content": "JWT" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "flows" + }, + "value": { + "element": "object", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "implicit" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "password" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "clientCredentials" + }, + "value": { + "element": "object" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "authorizationCode" + }, + "value": { + "element": "object" + } + } + } + ] + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "openIdConnectUrl" + }, + "value": { + "element": "string", + "content": "security-scheme-openIdConnectUrl" + } + } + }, + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "scopes" + }, + "value": { + "element": "array", + "content": [ + { + "element": "string", + "content": "write:pets" + }, + { + "element": "string", + "content": "read:pets" + } + ] + } + } + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "externalDocs" + }, + "value": { + "element": "externalDocumentation", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Find more info here" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "url" + }, + "value": { + "element": "string", + "content": "https://example.com" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "messages" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-messages" + } + ] + } + }, + "content": [ + { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "operation-message" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/messages/Message1" + } + } + } + ] + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "reply" + }, + "value": { + "element": "operationReply", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "address" + }, + "value": { + "element": "operationReplyAddress", + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "description" + }, + "value": { + "element": "string", + "content": "Reply address description" + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "location" + }, + "value": { + "element": "string", + "content": "http://example.com/reply" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "channel" + }, + "value": { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "channel" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/channels/channel1" + } + } + } + ] + } + } + }, + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "messages" + }, + "value": { + "element": "array", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "operation-reply-messages" + } + ] + } + }, + "content": [ + { + "element": "reference", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "json-reference" + }, + { + "element": "string", + "content": "asyncapi-reference" + }, + { + "element": "string", + "content": "reference-element" + } + ] + }, + "referenced-element": { + "element": "string", + "content": "operation-reply-message" + } + }, + "content": [ + { + "element": "member", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "fixed-field" + } + ] + } + }, + "content": { + "key": { + "element": "string", + "content": "$ref" + }, + "value": { + "element": "string", + "meta": { + "classes": { + "element": "array", + "content": [ + { + "element": "string", + "content": "reference-value" + } + ] + } + }, + "content": "#/components/messages/Message1" + } + } + } + ] + } + ] + } + } + } + ] + } + } + } + ] + } + } + } + ] + } + } + } + ] +} +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..b172726ed2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/__snapshots__/index.ts.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AsyncApi3Element should refract to semantic ApiDOM tree 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (IdentifierElement)) + (MemberElement + (StringElement) + (InfoElement)) + (MemberElement + (StringElement) + (ServersElement)) + (MemberElement + (StringElement) + (DefaultContentTypeElement)) + (MemberElement + (StringElement) + (ChannelsElement)) + (MemberElement + (StringElement) + (OperationsElement)) + (MemberElement + (StringElement) + (ComponentsElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/index.ts new file mode 100644 index 0000000000..10a46a8ba9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApi3/index.ts @@ -0,0 +1,25 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AsyncApi3Element } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AsyncApi3Element', function () { + specify('should refract to semantic ApiDOM tree', function () { + const asyncApiElement = AsyncApi3Element.refract({ + asyncapi: '3.0.0', + id: 'urn:com:smartylighting:streetlights:server', + info: {}, + servers: {}, + defaultContentType: 'application/json', + channels: {}, + operations: {}, + components: {}, + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..2ad7b45979 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AsyncApiVersionElement should refract to semantic ApiDOM tree 1`] = `(AsyncApiVersionElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/index.ts new file mode 100644 index 0000000000..be0ebeffdf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/AsyncApiVersion/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AsyncApiVersionElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AsyncApiVersionElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const asyncApiVersion = AsyncApiVersionElement.refract('3.0.0'); + + expect(sexprs(asyncApiVersion)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..4ad1962f02 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/__snapshots__/index.ts.snap @@ -0,0 +1,127 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ChannelElement given bindings field of type ChannelBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (ChannelBindingsElement))) +`; + +exports[`refractor elements ChannelElement given bindings field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements ChannelElement given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements ChannelElement given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements ChannelElement given messages field contains field of type MessageElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (MessagesElement + (MemberElement + (StringElement) + (MessageElement))))) +`; + +exports[`refractor elements ChannelElement given messages field contains field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (MessagesElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))))) +`; + +exports[`refractor elements ChannelElement given parameters field contains field of type ParameterElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (ParametersElement + (MemberElement + (StringElement) + (ParameterElement))))) +`; + +exports[`refractor elements ChannelElement given parameters field contains field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (ParametersElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))))) +`; + +exports[`refractor elements ChannelElement given tags field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (TagsElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements ChannelElement given tags field contains list of type TagElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (TagsElement + (TagElement)))) +`; + +exports[`refractor elements ChannelElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/index.ts new file mode 100644 index 0000000000..3987d231b5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channel/index.ts @@ -0,0 +1,142 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ChannelElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ChannelElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + address: 'channel.address', + title: 'channel-item-title', + summary: 'channel-item-summary', + description: 'channel-item-description', + servers: [{ $ref: '#/path/to/server1' }, { $ref: '#/path/to/server2' }], + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + + context('given bindings field of type ChannelBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + bindings: {}, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + bindings: { + $ref: '#/path/to/bindings', + }, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given messages field contains field of type MessageElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + messages: { + userSignedUp: {}, + }, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given messages field contains field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + messages: { + userSignedUp: { + $ref: '#/path/to/message', + }, + }, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given parameters field contains field of type ParameterElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + parameters: { + userId: {}, + }, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given parameters field contains field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + parameters: { + userId: { + $ref: '#/path/to/parameter', + }, + }, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + tags: [{}], + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + tags: [ + { + $ref: '#/path/to/tag', + }, + ], + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelElement = ChannelElement.refract({ + externalDocs: { + $ref: '#/path/to/externalDocs', + }, + }); + + expect(sexprs(channelElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..f3536485e9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/__snapshots__/index.ts.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ChannelBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelBindingsElement + (MemberElement + (StringElement) + (HttpChannelBindingElement)) + (MemberElement + (StringElement) + (WebSocketChannelBindingElement)) + (MemberElement + (StringElement) + (KafkaChannelBindingElement)) + (MemberElement + (StringElement) + (AnypointmqChannelBindingElement)) + (MemberElement + (StringElement) + (AmqpChannelBindingElement)) + (MemberElement + (StringElement) + (Amqp1ChannelBindingElement)) + (MemberElement + (StringElement) + (MqttChannelBindingElement)) + (MemberElement + (StringElement) + (Mqtt5ChannelBindingElement)) + (MemberElement + (StringElement) + (NatsChannelBindingElement)) + (MemberElement + (StringElement) + (JmsChannelBindingElement)) + (MemberElement + (StringElement) + (SnsChannelBindingElement)) + (MemberElement + (StringElement) + (SolaceChannelBindingElement)) + (MemberElement + (StringElement) + (SqsChannelBindingElement)) + (MemberElement + (StringElement) + (StompChannelBindingElement)) + (MemberElement + (StringElement) + (RedisChannelBindingElement)) + (MemberElement + (StringElement) + (MercureChannelBindingElement)) + (MemberElement + (StringElement) + (IbmmqChannelBindingElement)) + (MemberElement + (StringElement) + (GooglepubsubChannelBindingElement)) + (MemberElement + (StringElement) + (PulsarChannelBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/index.ts new file mode 100644 index 0000000000..25298b7546 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ChannelBindings/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ChannelBindingsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ChannelBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelBindingsElement = ChannelBindingsElement.refract({ + http: {}, + ws: {}, + kafka: {}, + anypointmq: {}, + amqp: {}, + amqp1: {}, + mqtt: {}, + mqtt5: {}, + nats: {}, + jms: {}, + sns: {}, + solace: {}, + sqs: {}, + stomp: {}, + redis: {}, + mercure: {}, + ibmmq: {}, + googlepubsub: {}, + pulsar: {}, + }); + + expect(sexprs(channelBindingsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..597389885e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/__snapshots__/index.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ChannelsElement should refract to semantic ApiDOM tree 1`] = ` +(ChannelsElement + (MemberElement + (StringElement) + (ChannelElement)) + (MemberElement + (StringElement) + (ChannelElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/index.ts new file mode 100644 index 0000000000..d0aeecd211 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Channels/index.ts @@ -0,0 +1,22 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ChannelsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ChannelsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const channelsElement = ChannelsElement.refract({ + 'user/signedup': {}, + 'user/loggedout': {}, + 'user/ref': { + $ref: '#/path/to/channel', + }, + }); + + expect(sexprs(channelsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..dd72497edf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/__snapshots__/index.ts.snap @@ -0,0 +1,250 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ComponentsElement should refract to semantic ApiDOM tree 1`] = ` +(ComponentsElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ServerElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ServerVariableElement + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (StringElement))) + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ChannelElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (MessageElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SecuritySchemeElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ParameterElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (CorrelationIDElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (OperationTraitElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (MessageTraitElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ServerBindingsElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ChannelBindingsElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (OperationBindingsElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (MessageBindingsElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (OperationElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (OperationReplyElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (OperationReplyAddressElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ExternalDocumentationElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (TagElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/index.ts new file mode 100644 index 0000000000..e6c5840a78 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Components/index.ts @@ -0,0 +1,138 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ComponentsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ComponentsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const componentsElement = ComponentsElement.refract({ + schemas: { + User: {}, + UserRef: { + $ref: '#/path/to/UserSchema', + }, + UserMulti: { + schemaFormat: 'application/vnd.aai.asyncapi;version=3.0.0', + schema: {}, + }, + }, + servers: { + development: {}, + production: { + $ref: '#/path/to/production/server', + }, + }, + serverVariables: { + port: { + enum: ['8883', '8884'], + default: '8883', + }, + port1: { + $ref: '#/components/serverVariables/port', + }, + }, + channels: { + channel: {}, + channelRef: { + $ref: '#/path/to/channel', + }, + }, + messages: { + Message: {}, + MessageRef: { + $ref: '#/path/to/Message', + }, + }, + securitySchemes: { + SecurityScheme: {}, + SecuritySchemeRef: { + $ref: '#/path/to/SecurityScheme', + }, + }, + parameters: { + Parameter: {}, + ParameterRef: { + $ref: '#/path/to/Parameter', + }, + }, + correlationIds: { + CorrelationID: {}, + CorrelationIDRef: { + $ref: '#/path/to/CorrelationID', + }, + }, + operationTraits: { + OperationTrait: {}, + OperationTraitRef: { + $ref: '#/path/to/OperationTrait', + }, + }, + messageTraits: { + MessageTrait: {}, + MessageTraitRef: { + $ref: '#/path/to/MessageTrait', + }, + }, + serverBindings: { + ServerBindings: {}, + ServerBindingsRef: { + $ref: '#/path/to/ServerBindings', + }, + }, + channelBindings: { + ChannelBindings: {}, + ChannelBindingsRef: { + $ref: '#/path/to/ChannelBindings', + }, + }, + operationBindings: { + OperationBindings: {}, + OperationBindingsRef: { + $ref: '#/path/to/OperationBindings', + }, + }, + messageBindings: { + MessageBindings: {}, + MessageBindingsRef: { + $ref: '#/path/to/MessageBindings', + }, + }, + operations: { + SignUp: {}, + SignUpRef: { + $ref: '#/path/to/SignUpOperation', + }, + }, + replies: { + UserReply: {}, + UserReplyRef: { + $ref: '#/path/to/UserReply', + }, + }, + replyAddresses: { + UserReplyAddress: {}, + UserReplyAddressRef: { + $ref: '#/path/to/UserReplyAddress', + }, + }, + externalDocs: { + ExternalDoc: {}, + ExternalDocRef: { + $ref: '#/path/to/ExternalDoc', + }, + }, + tags: { + UserTag: {}, + UserTagRef: { + $ref: '#/path/to/UserTag', + }, + }, + }); + + expect(sexprs(componentsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..ba97c975e4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/__snapshots__/index.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ContactElement should refract to semantic ApiDOM tree 1`] = ` +(ContactElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/index.ts new file mode 100644 index 0000000000..245a99fca2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Contact/index.ts @@ -0,0 +1,20 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ContactElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ContactElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const contactElement = ContactElement.refract({ + name: 'API Support', + url: 'http://www.asyncapi.org/support', + email: 'support@asyncapi.org', + }); + + expect(sexprs(contactElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..6bb018fcdf --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements CorrelationIDElement should refract to semantic ApiDOM tree 1`] = ` +(CorrelationIDElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/index.ts new file mode 100644 index 0000000000..a7c93bc7ae --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/CorrelationID/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { CorrelationIDElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('CorrelationIDElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const correlationIDElement = CorrelationIDElement.refract({ + description: 'correlation-id-description', + location: 'correlation-id-location', + }); + + expect(sexprs(correlationIDElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..1cac4c9788 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements DefaultContentTypeElement should refract to semantic ApiDOM tree 1`] = `(DefaultContentTypeElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/index.ts new file mode 100644 index 0000000000..3a041f0549 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/DefaultContentType/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { DefaultContentTypeElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('DefaultContentTypeElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const defaultContentTypeElement = DefaultContentTypeElement.refract('application/json'); + + expect(sexprs(defaultContentTypeElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..d4930307ad --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(ExternalDocumentationElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/index.ts new file mode 100644 index 0000000000..7ea08649f0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ExternalDocumentation/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ExternalDocumentationElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const externalDocumentationElement = ExternalDocumentationElement.refract({ + description: 'external-documentation-description', + url: 'http://www.asyncapi.org/support', + }); + + expect(sexprs(externalDocumentationElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..11b1cc9a1c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements IdentifierElement should refract to semantic ApiDOM tree 1`] = `(IdentifierElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/index.ts new file mode 100644 index 0000000000..be2ccf633a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Identifier/index.ts @@ -0,0 +1,18 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { IdentifierElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('IdentifierElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const identifierElement = IdentifierElement.refract( + 'urn:com:smartylighting:streetlights:server', + ); + + expect(sexprs(identifierElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..0d4a7f0d04 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/__snapshots__/index.ts.snap @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements InfoElement given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(InfoElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements InfoElement given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(InfoElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements InfoElement given tags field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(InfoElement + (MemberElement + (StringElement) + (TagsElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements InfoElement given tags field contains list of type TagElement should refract to semantic ApiDOM tree 1`] = ` +(InfoElement + (MemberElement + (StringElement) + (TagsElement + (TagElement)))) +`; + +exports[`refractor elements InfoElement should refract to semantic ApiDOM tree 1`] = ` +(InfoElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ContactElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (LicenseElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/index.ts new file mode 100644 index 0000000000..becc5a9868 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Info/index.ts @@ -0,0 +1,76 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { InfoElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('InfoElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const infoElement = InfoElement.refract({ + title: 'AsyncAPI Sample App', + version: '1.0.1', + description: 'This is a sample server.', + termsOfService: 'http://asyncapi.org/terms/', + contact: { + name: 'API Support', + url: 'http://www.asyncapi.org/support', + email: 'support@asyncapi.org', + }, + license: { + name: 'Apache 2.0', + url: 'http://www.apache.org/licenses/LICENSE-2.0.html', + }, + }); + + expect(sexprs(infoElement)).toMatchSnapshot(); + }); + + context('given tags field contains list of type TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const infoElement = InfoElement.refract({ + tags: [{}], + }); + + expect(sexprs(infoElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const infoElement = InfoElement.refract({ + tags: [ + { + $ref: '#/path/to/tag', + }, + ], + }); + + expect(sexprs(infoElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const infoElement = InfoElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(infoElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const infoElement = InfoElement.refract({ + externalDocs: { + $ref: '#/path/to/externalDocs', + }, + }); + + expect(sexprs(infoElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/License/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/License/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..7118444fb3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/License/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements LicenseElement should refract to semantic ApiDOM tree 1`] = ` +(LicenseElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/License/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/License/index.ts new file mode 100644 index 0000000000..1ad36a941e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/License/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { LicenseElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('LicenseElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const licenseElement = LicenseElement.refract({ + name: 'Apache 2.0', + url: 'http://www.apache.org/licenses/LICENSE-2.0.html', + }); + + expect(sexprs(licenseElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..b5549179b4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/__snapshots__/index.ts.snap @@ -0,0 +1,185 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MessageElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (MessageExampleElement + (MemberElement + (StringElement) + (ObjectElement)) + (MemberElement + (StringElement) + (ObjectElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements given bindings field of type MessageBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (MessageBindingsElement))) +`; + +exports[`refractor elements given bindings field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given correlationId field of type CorrelationIDElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (CorrelationIDElement))) +`; + +exports[`refractor elements given correlationId field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given headers field of type MultiFormatSchemaElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement))))) +`; + +exports[`refractor elements given headers field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given headers field of type SchemaElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (SchemaElement))) +`; + +exports[`refractor elements given payload field of type MultiFormatSchemaElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement))))) +`; + +exports[`refractor elements given payload field of type ReferenceElement should refract payload to ReferenceElement 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given payload field of type SchemaElement should refract payload to SchemaElement 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (SchemaElement))) +`; + +exports[`refractor elements given tags field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (TagsElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements given tags field contains list of type TagElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (TagsElement + (TagElement)))) +`; + +exports[`refractor elements given traits field contains list of type MessageTraitElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ArrayElement + (MessageTraitElement)))) +`; + +exports[`refractor elements given traits field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageElement + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/index.ts new file mode 100644 index 0000000000..094dc5a533 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Message/index.ts @@ -0,0 +1,214 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MessageElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MessageElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + contentType: 'application/json', + name: 'message-name', + title: 'message-title', + summary: 'message-summary', + description: 'message-description', + examples: [ + { + payload: {}, + headers: {}, + name: 'example name', + summary: 'example summary', + }, + ], + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given headers field of type SchemaElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + headers: {}, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given headers field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + headers: { + $ref: '#/path/to/schema', + }, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given headers field of type MultiFormatSchemaElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + headers: { + schemaFormat: 'application/vnd.aai.asyncapi;version=3.0.0', + schema: {}, + }, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given payload field of type SchemaElement', function () { + specify('should refract payload to SchemaElement', function () { + const messageElement = MessageElement.refract({ + payload: {}, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given payload field of type ReferenceElement', function () { + specify('should refract payload to ReferenceElement', function () { + const messageElement = MessageElement.refract({ + payload: { + $ref: '#/json-pointer', + }, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given payload field of type MultiFormatSchemaElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + payload: { + schemaFormat: 'application/vnd.aai.asyncapi;version=3.0.0', + schema: {}, + }, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given correlationId field of type CorrelationIDElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + correlationId: {}, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given correlationId field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + correlationId: { + $ref: '#/path/to/correlationID', + }, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type MessageBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + bindings: {}, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + bindings: { + $ref: '#/path/to/message-bindings', + }, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given traits field contains list of type MessageTraitElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + traits: [{}], + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given traits field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + traits: [ + { + $ref: '#/path/to/message-bindings', + }, + ], + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + tags: [{}], + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + tags: [ + { + $ref: '#/path/to/tag', + }, + ], + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageElement = MessageElement.refract({ + externalDocs: { + $ref: '#/path/to/externalDocs', + }, + }); + + expect(sexprs(messageElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..42af5b6969 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/__snapshots__/index.ts.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MessageBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(MessageBindingsElement + (MemberElement + (StringElement) + (HttpMessageBindingElement)) + (MemberElement + (StringElement) + (WebSocketMessageBindingElement)) + (MemberElement + (StringElement) + (KafkaMessageBindingElement)) + (MemberElement + (StringElement) + (AnypointmqMessageBindingElement)) + (MemberElement + (StringElement) + (AmqpMessageBindingElement)) + (MemberElement + (StringElement) + (Amqp1MessageBindingElement)) + (MemberElement + (StringElement) + (MqttMessageBindingElement)) + (MemberElement + (StringElement) + (Mqtt5MessageBindingElement)) + (MemberElement + (StringElement) + (NatsMessageBindingElement)) + (MemberElement + (StringElement) + (JmsMessageBindingElement)) + (MemberElement + (StringElement) + (SnsMessageBindingElement)) + (MemberElement + (StringElement) + (SolaceMessageBindingElement)) + (MemberElement + (StringElement) + (SqsMessageBindingElement)) + (MemberElement + (StringElement) + (StompMessageBindingElement)) + (MemberElement + (StringElement) + (RedisMessageBindingElement)) + (MemberElement + (StringElement) + (MercureMessageBindingElement)) + (MemberElement + (StringElement) + (IbmmqMessageBindingElement)) + (MemberElement + (StringElement) + (GooglepubsubMessageBindingElement)) + (MemberElement + (StringElement) + (PulsarMessageBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/index.ts new file mode 100644 index 0000000000..68f835e7be --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageBindings/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MessageBindingsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MessageBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageBindingsElement = MessageBindingsElement.refract({ + http: {}, + ws: {}, + kafka: {}, + anypointmq: {}, + amqp: {}, + amqp1: {}, + mqtt: {}, + mqtt5: {}, + nats: {}, + jms: {}, + sns: {}, + solace: {}, + sqs: {}, + stomp: {}, + redis: {}, + mercure: {}, + ibmmq: {}, + googlepubsub: {}, + pulsar: {}, + }); + + expect(sexprs(messageBindingsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..4e0c68729e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/__snapshots__/index.ts.snap @@ -0,0 +1,20 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MessageExampleElement should refract to semantic ApiDOM tree 1`] = ` +(MessageExampleElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/index.ts new file mode 100644 index 0000000000..a7bc6cfe84 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageExample/index.ts @@ -0,0 +1,21 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MessageExampleElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MessageExampleElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageExampleElement = MessageExampleElement.refract({ + headers: { 'Content-Type': 'application/json' }, + payload: '{"a":"b"}', + name: 'example name', + summary: 'example summary', + }); + + expect(sexprs(messageExampleElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..48aa9ba43f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/__snapshots__/index.ts.snap @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MessageTraitElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (MessageExampleElement + (MemberElement + (StringElement) + (ObjectElement)) + (MemberElement + (StringElement) + (ObjectElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements given bindings field of type MessageBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (MessageBindingsElement))) +`; + +exports[`refractor elements given bindings field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given correlationId field of type CorrelationIDElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (CorrelationIDElement))) +`; + +exports[`refractor elements given correlationId field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given headers field of type MultiFormatSchemaElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement))))) +`; + +exports[`refractor elements given headers field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements given headers field of type SchemaElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (SchemaElement))) +`; + +exports[`refractor elements given tags field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (TagsElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements given tags field contains list of type TagElement should refract to semantic ApiDOM tree 1`] = ` +(MessageTraitElement + (MemberElement + (StringElement) + (TagsElement + (TagElement)))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/index.ts new file mode 100644 index 0000000000..f466232af7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MessageTrait/index.ts @@ -0,0 +1,155 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MessageTraitElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MessageTraitElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + contentType: 'application/json', + name: 'message-trait-name', + title: 'message-trait-title', + summary: 'message-trait-summary', + description: 'message-trait-description', + examples: [ + { + payload: {}, + headers: {}, + name: 'example name', + summary: 'example summary', + }, + ], + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given headers field of type SchemaElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + headers: {}, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given headers field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + headers: { + $ref: '#/path/to/schema', + }, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given headers field of type MultiFormatSchemaElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + headers: { + schemaFormat: 'application/vnd.aai.asyncapi;version=3.0.0', + schema: {}, + }, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given correlationId field of type CorrelationIDElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + correlationId: {}, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given correlationId field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + correlationId: { + $ref: '#/path/to/correlationID', + }, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type MessageBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + bindings: {}, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + bindings: { + $ref: '#/path/to/message-bindings', + }, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + tags: [{}], + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + tags: [ + { + $ref: '#/path/to/tag', + }, + ], + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messageTraitElement = MessageTraitElement.refract({ + externalDocs: { + $ref: '#/path/to/externalDocs', + }, + }); + + expect(sexprs(messageTraitElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..fd61fbdb05 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/__snapshots__/index.ts.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MessagesElement should refract to semantic ApiDOM tree 1`] = ` +(MessagesElement + (MemberElement + (StringElement) + (MessageElement)) + (MemberElement + (StringElement) + (MessageElement))) +`; + +exports[`refractor elements given field is of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MessagesElement + (MemberElement + (StringElement) + (MessageElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/index.ts new file mode 100644 index 0000000000..61f1e0b8d5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Messages/index.ts @@ -0,0 +1,32 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MessagesElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MessagesElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messagesElement = MessagesElement.refract({ + userMessage: {}, + orderMessage: {}, + }); + + expect(sexprs(messagesElement)).toMatchSnapshot(); + }); + }); + + context('given field is of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const messagesElement = MessagesElement.refract({ + userMessage: {}, + orderMessage: { + $ref: '#/path/to/message', + }, + }); + + expect(sexprs(messagesElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..744a7903c8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/__snapshots__/index.ts.snap @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MultiFormatSchemaElement given schema of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements MultiFormatSchemaElement given unsupported schemaFormat should refract to semantic ApiDOM tree 1`] = ` +(MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement))) +`; + +exports[`refractor elements MultiFormatSchemaElement given unsupported schemaFormat with referenced schema should refract to semantic ApiDOM tree 1`] = ` +(MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements MultiFormatSchemaElement should refract to semantic ApiDOM tree 1`] = ` +(MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/index.ts new file mode 100644 index 0000000000..12338f4472 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/MultiFormatSchema/index.ts @@ -0,0 +1,56 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MultiFormatSchemaElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MultiFormatSchemaElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const multiFormatSchemaElement = MultiFormatSchemaElement.refract({ + schemaFormat: 'application/vnd.aai.asyncapi;version=3.0.0', + schema: {}, + }); + + expect(sexprs(multiFormatSchemaElement)).toMatchSnapshot(); + }); + + context('given schema of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const multiFormatSchemaElement = MultiFormatSchemaElement.refract({ + schemaFormat: 'application/vnd.aai.asyncapi;version=3.0.0', + schema: { + $ref: '#/path/to/schema', + }, + }); + + expect(sexprs(multiFormatSchemaElement)).toMatchSnapshot(); + }); + }); + + context('given unsupported schemaFormat', function () { + specify('should refract to semantic ApiDOM tree', function () { + const multiFormatSchemaElement = MultiFormatSchemaElement.refract({ + schemaFormat: 'application/vnd.apache.avro;version=1.9.0', + schema: {}, + }); + + expect(sexprs(multiFormatSchemaElement)).toMatchSnapshot(); + }); + }); + + context('given unsupported schemaFormat with referenced schema', function () { + specify('should refract to semantic ApiDOM tree', function () { + const multiFormatSchemaElement = MultiFormatSchemaElement.refract({ + schemaFormat: 'application/vnd.apache.avro;version=1.9.0', + schema: { + $ref: '#/path/to/schema', + }, + }); + + expect(sexprs(multiFormatSchemaElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..b37de8f88c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/__snapshots__/index.ts.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OAuthFlowElement should refract to semantic ApiDOM tree 1`] = ` +(OAuthFlowElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/index.ts new file mode 100644 index 0000000000..d4801d6c21 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlow/index.ts @@ -0,0 +1,24 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OAuthFlowElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OAuthFlowElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const oAuthFlowElement = OAuthFlowElement.refract({ + authorizationUrl: 'oauth-flow-authorizationURL', + tokenUrl: 'oauth-flow-tokenUrl', + refreshUrl: 'oauth-flow-refreshUrl', + availableScopes: { + 'write:pets': 'modify pets in your account', + 'read:pets': 'read your pets', + }, + }); + + expect(sexprs(oAuthFlowElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..581924601a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/__snapshots__/index.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OAuthFlowsElement should refract to semantic ApiDOM tree 1`] = ` +(OAuthFlowsElement + (MemberElement + (StringElement) + (OAuthFlowElement)) + (MemberElement + (StringElement) + (OAuthFlowElement)) + (MemberElement + (StringElement) + (OAuthFlowElement)) + (MemberElement + (StringElement) + (OAuthFlowElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/index.ts new file mode 100644 index 0000000000..86afdf9074 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OAuthFlows/index.ts @@ -0,0 +1,21 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OAuthFlowsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OAuthFlowsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const oAuthFlowsElement = OAuthFlowsElement.refract({ + implicit: {}, + password: {}, + clientCredentials: {}, + authorizationCode: {}, + }); + + expect(sexprs(oAuthFlowsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..f5de34b3c3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/__snapshots__/index.ts.snap @@ -0,0 +1,141 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OperationElement given bindings field of type OperationBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (OperationBindingsElement))) +`; + +exports[`refractor elements OperationElement given bindings field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements OperationElement given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements OperationElement given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements OperationElement given reply field of type OperationReplyElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (OperationReplyElement))) +`; + +exports[`refractor elements OperationElement given reply field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements OperationElement given security field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements OperationElement given security field contains list of type SecuritySchemeElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ArrayElement + (SecuritySchemeElement + (MemberElement + (StringElement) + (ArrayElement)))))) +`; + +exports[`refractor elements OperationElement given tags field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (TagsElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements OperationElement given tags field contains list of type TagElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (TagsElement + (TagElement)))) +`; + +exports[`refractor elements OperationElement given traits field contains list of type OperationTraitElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ArrayElement + (OperationTraitElement)))) +`; + +exports[`refractor elements OperationElement given traits field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements OperationElement should refract to semantic ApiDOM tree 1`] = ` +(OperationElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/index.ts new file mode 100644 index 0000000000..f1550dcdc0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operation/index.ts @@ -0,0 +1,161 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OperationElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OperationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + action: 'send', + title: 'operation-title', + summary: 'operation-summary', + description: 'operation-description', + messages: [{ $ref: '#/path/to/message' }], + channel: { $ref: '#/path/to/channel' }, + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + + context('given bindings field of type OperationBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + bindings: {}, + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + bindings: { + $ref: '#/path/to/bindings', + }, + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given traits field contains list of type OperationTraitElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + traits: [{}], + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given traits field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + traits: [ + { + $ref: '#/path/to/operation-trait', + }, + ], + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given security field contains list of type SecuritySchemeElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + security: [{ user_pass: [] }], + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given security field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + security: [ + { + $ref: '#/path/to/operation-security', + }, + ], + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given reply field of type OperationReplyElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + reply: {}, + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given reply field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + reply: { + $ref: '#/path/to/operation-trait', + }, + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + tags: [{}], + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + tags: [ + { + $ref: '#/path/to/tag', + }, + ], + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationElement = OperationElement.refract({ + externalDocs: { + $ref: '#/path/to/external-docs', + }, + }); + + expect(sexprs(operationElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..4237704e8c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/__snapshots__/index.ts.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OperationBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(OperationBindingsElement + (MemberElement + (StringElement) + (HttpOperationBindingElement)) + (MemberElement + (StringElement) + (WebSocketOperationBindingElement)) + (MemberElement + (StringElement) + (KafkaOperationBindingElement)) + (MemberElement + (StringElement) + (AnypointmqOperationBindingElement)) + (MemberElement + (StringElement) + (AmqpOperationBindingElement)) + (MemberElement + (StringElement) + (Amqp1OperationBindingElement)) + (MemberElement + (StringElement) + (MqttOperationBindingElement)) + (MemberElement + (StringElement) + (Mqtt5OperationBindingElement)) + (MemberElement + (StringElement) + (NatsOperationBindingElement)) + (MemberElement + (StringElement) + (JmsOperationBindingElement)) + (MemberElement + (StringElement) + (SnsOperationBindingElement)) + (MemberElement + (StringElement) + (SolaceOperationBindingElement)) + (MemberElement + (StringElement) + (SqsOperationBindingElement)) + (MemberElement + (StringElement) + (StompOperationBindingElement)) + (MemberElement + (StringElement) + (RedisOperationBindingElement)) + (MemberElement + (StringElement) + (MercureOperationBindingElement)) + (MemberElement + (StringElement) + (GooglepubsubOperationBindingElement)) + (MemberElement + (StringElement) + (IbmmqOperationBindingElement)) + (MemberElement + (StringElement) + (PulsarOperationBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/index.ts new file mode 100644 index 0000000000..fbf0a97c0d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationBindings/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OperationBindingsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OperationBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationBindingsElement = OperationBindingsElement.refract({ + http: {}, + ws: {}, + kafka: {}, + anypointmq: {}, + amqp: {}, + amqp1: {}, + mqtt: {}, + mqtt5: {}, + nats: {}, + jms: {}, + sns: {}, + solace: {}, + sqs: {}, + stomp: {}, + redis: {}, + mercure: {}, + googlepubsub: {}, + ibmmq: {}, + pulsar: {}, + }); + + expect(sexprs(operationBindingsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..372faf318b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/__snapshots__/index.ts.snap @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OperationReplyElement given address field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationReplyElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements OperationReplyElement should refract to semantic ApiDOM tree 1`] = ` +(OperationReplyElement + (MemberElement + (StringElement) + (OperationReplyAddressElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/index.ts new file mode 100644 index 0000000000..972a826b32 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReply/index.ts @@ -0,0 +1,38 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OperationReplyElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OperationReplyElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationReplyElement = OperationReplyElement.refract({ + address: {}, + channel: { + $ref: '#/path/to/channel', + }, + messages: [ + { + $ref: '#/path/to/message', + }, + ], + }); + + expect(sexprs(operationReplyElement)).toMatchSnapshot(); + }); + + context('given address field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationReplyElement = OperationReplyElement.refract({ + address: { + $ref: '#/path/to/address', + }, + }); + + expect(sexprs(operationReplyElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..c484bcda69 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OperationReplyAddressElement should refract to semantic ApiDOM tree 1`] = ` +(OperationReplyAddressElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/index.ts new file mode 100644 index 0000000000..a3b6c40c3e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationReplyAddress/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OperationReplyAddressElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OperationReplyAddressElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationReplyAddressElement = OperationReplyAddressElement.refract({ + description: 'operation-reply-address-description', + location: 'operation-reply-address-location', + }); + + expect(sexprs(operationReplyAddressElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..7e87b57258 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/__snapshots__/index.ts.snap @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OperationTraitElement given bindings field of type OperationBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (OperationBindingsElement))) +`; + +exports[`refractor elements OperationTraitElement given bindings field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements OperationTraitElement given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements OperationTraitElement given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements OperationTraitElement given security field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements OperationTraitElement given security field contains list of type SecuritySchemeElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (ArrayElement + (SecuritySchemeElement)))) +`; + +exports[`refractor elements OperationTraitElement given tags field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (TagsElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements OperationTraitElement given tags field contains list of type TagElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (TagsElement + (TagElement)))) +`; + +exports[`refractor elements OperationTraitElement should refract to semantic ApiDOM tree 1`] = ` +(OperationTraitElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/index.ts new file mode 100644 index 0000000000..43aacf46fd --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/OperationTrait/index.ts @@ -0,0 +1,113 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OperationTraitElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OperationTraitElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + title: 'operation-trait-title', + operationId: 'operation-trait-operationId', + summary: 'operation-trait-summary', + description: 'operation-trait-description', + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + + context('given bindings field of type OperationBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + bindings: {}, + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + bindings: { + $ref: '#/path/to/bindings', + }, + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + + context('given security field contains list of type SecuritySchemeElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + security: [{}], + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + + context('given security field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + security: [ + { + $ref: '#/path/to/security-scheme', + }, + ], + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + tags: [{}], + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + tags: [ + { + $ref: '#/path/to/tag', + }, + ], + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationTraitElement = OperationTraitElement.refract({ + externalDocs: { + $ref: '#/path/to/externalDocs', + }, + }); + + expect(sexprs(operationTraitElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..bfc454d7dd --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/__snapshots__/index.ts.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements OperationsElement should refract to semantic ApiDOM tree 1`] = ` +(OperationsElement + (MemberElement + (StringElement) + (OperationElement)) + (MemberElement + (StringElement) + (OperationElement))) +`; + +exports[`refractor elements given field is of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(OperationsElement + (MemberElement + (StringElement) + (OperationElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/index.ts new file mode 100644 index 0000000000..e442da7918 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Operations/index.ts @@ -0,0 +1,32 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { OperationsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('OperationsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationsElement = OperationsElement.refract({ + onUserSignUp: {}, + onUserSignOut: {}, + }); + + expect(sexprs(operationsElement)).toMatchSnapshot(); + }); + }); + + context('given field is of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const operationsElement = OperationsElement.refract({ + onUserSignUp: {}, + onUserSignOut: { + $ref: '#/path/to/operation', + }, + }); + + expect(sexprs(operationsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..eaa8fbde62 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/__snapshots__/index.ts.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ParameterElement should refract to semantic ApiDOM tree 1`] = ` +(ParameterElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (StringElement))) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (StringElement)))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/index.ts new file mode 100644 index 0000000000..2c4b3c5319 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameter/index.ts @@ -0,0 +1,22 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ParameterElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ParameterElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const parameterElement = ParameterElement.refract({ + description: 'parameter-description', + location: 'parameter-location', + enum: ['value1', 'value2'], + default: 'value1', + examples: ['value1', 'value2'], + }); + + expect(sexprs(parameterElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..dab139d658 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/__snapshots__/index.ts.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ParametersElement should refract to semantic ApiDOM tree 1`] = ` +(ParametersElement + (MemberElement + (StringElement) + (ParameterElement)) + (MemberElement + (StringElement) + (ParameterElement))) +`; + +exports[`refractor elements given field is of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ParametersElement + (MemberElement + (StringElement) + (ParameterElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/index.ts new file mode 100644 index 0000000000..53e89f6655 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Parameters/index.ts @@ -0,0 +1,32 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ParametersElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ParametersElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const parametersElement = ParametersElement.refract({ + userId: {}, + orderId: {}, + }); + + expect(sexprs(parametersElement)).toMatchSnapshot(); + }); + }); + + context('given field is of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const parametersElement = ParametersElement.refract({ + userId: {}, + orderId: { + $ref: '#/path/to/parameter', + }, + }); + + expect(sexprs(parametersElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..c474f010c5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/__snapshots__/index.ts.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ReferenceElement given generic ApiDOM element should refract to semantic ApiDOM tree 1`] = ` +(ReferenceElement + (MemberElement + (StringElement) + (StringElement))) +`; + +exports[`refractor elements ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ReferenceElement + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/index.ts new file mode 100644 index 0000000000..7d2bd1aca9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Reference/index.ts @@ -0,0 +1,46 @@ +import { assert, expect } from 'chai'; +import { ObjectElement, sexprs, toValue } from '@swagger-api/apidom-core'; + +import { ReferenceElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const referenceElement = ReferenceElement.refract({ + $ref: '#/path/to/somewhere', + }); + + expect(sexprs(referenceElement)).toMatchSnapshot(); + }); + + context('given generic ApiDOM element', function () { + let referenceElement: ReferenceElement; + + beforeEach(function () { + referenceElement = ReferenceElement.refract( + new ObjectElement( + { $ref: '#/path/to/somewhere' }, + { classes: ['example'] }, + { attr: true }, + ), + ) as ReferenceElement; + }); + + specify('should refract to semantic ApiDOM tree', function () { + expect(sexprs(referenceElement)).toMatchSnapshot(); + }); + + specify('should deepmerge meta', function () { + assert.deepEqual(toValue(referenceElement.meta), { + classes: ['json-reference', 'asyncapi-reference', 'example', 'reference-element'], + }); + }); + + specify('should deepmerge attributes', function () { + assert.isTrue(referenceElement.attributes.get('attr').equals(true)); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..90a6b4901e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/__snapshots__/index.ts.snap @@ -0,0 +1,286 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SchemaElement given embedded SchemaElements should refract to semantic ApiDOM tree 1`] = ` +(SchemaElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement + (MemberElement + (StringElement) + (SchemaElement)))))) + (MemberElement + (StringElement) + (ArrayElement + (SchemaElement + (MemberElement + (StringElement) + (SchemaElement))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement + (MemberElement + (StringElement) + (SchemaElement))))))) +`; + +exports[`refractor elements SchemaElement given fields of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(SchemaElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ArrayElement + (SchemaElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements SchemaElement should refract to semantic ApiDOM tree 1`] = ` +(SchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (SchemaElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) + (MemberElement + (StringElement) + (ArrayElement + (SchemaElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) + (MemberElement + (StringElement) + (ArrayElement + (SchemaElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (NumberElement))) + (MemberElement + (StringElement) + (NullElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (NumberElement))) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) + (MemberElement + (StringElement) + (ArrayElement + (LinkDescriptionElement))) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ExternalDocumentationElement)) + (MemberElement + (StringElement) + (BooleanElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/index.ts new file mode 100644 index 0000000000..e54a71e71e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Schema/index.ts @@ -0,0 +1,127 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SchemaElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SchemaElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const schemaElement = SchemaElement.refract({ + // core vocabulary + $id: '#foo', + $comment: 'comment', + // validation vocabulary + // validation keywords for Applying Subschemas With Boolean Logic + allOf: [{}, { $ref: '#/components/schemas/Schema1' }], + anyOf: [{}, { $ref: '#/components/schemas/Schema1' }], + oneOf: [{}, { $ref: '#/components/schemas/Schema1' }], + // validation Keywords for Applying Subschemas Conditionally + if: {}, + then: {}, + else: {}, + // validation Keywords for Any Instance Type + type: 'object', + enum: ['a', 1], + const: null, + // validation Keywords for Numeric Instances (number and integer) + multipleOf: 2, + maximum: 100, + exclusiveMaximum: 99, + minimum: 20, + exclusiveMinimum: 19, + // validation Keywords for Strings + maxLength: 20, + minLength: 10, + pattern: 'abc', + // validation Keywords for Arrays + items: {}, + additionalItems: {}, + maxItems: 5, + minItems: 1, + uniqueItems: true, + contains: {}, + // validation Keywords for Objects + maxProperties: 5, + minProperties: 4, + require: ['prop1'], + properties: { + enabled: {}, + disabled: { $ref: '#/components/schemas/Schema1' }, + }, + patternProperties: { + abc: {}, + abcd: { $ref: '#/components/schemas/Schema1' }, + }, + additionalProperties: {}, // additional test + dependencies: { + prop1: {}, + prop2: { $ref: '#/components/schemas/Schema1' }, + }, // need addtional test for [] as value of prop + propertyNames: {}, // additional test + // validation vocabulary for Schema Annotations + title: 'schema-title', + description: 'schema-description', + default: 'test', + readOnly: true, + writeOnly: false, + examples: ['a', 1], + // validation Vocabularies for Semantic Validation With "format" + format: 'time', + // validation Vocabulary for String-Encoding Non-JSON Data + contentEncoding: 'base64', + contentMediaType: 'image/png', + // validation Vocabulary for Schema Re-Use With "definitions" + definitions: { + enabledToggle: {}, + disableToggle: { $ref: '#/components/schemas/Schema1' }, + }, + // hyper-schema vocabulary + links: [{}], + // AsyncAPI vocabulary + discriminator: 'schema-discriminator', + externalDocs: {}, + deprecated: true, + }); + + expect(sexprs(schemaElement)).toMatchSnapshot(); + }); + + context('given embedded SchemaElements', function () { + specify('should refract to semantic ApiDOM tree', function () { + const schemaElement = SchemaElement.refract({ + definitions: { + enabledToggle: { not: {} }, + }, + allOf: [{ not: {} }], + properties: { + enabled: { not: {} }, + }, + }); + + expect(sexprs(schemaElement)).toMatchSnapshot(); + }); + }); + + context('given fields of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const schemaElement = SchemaElement.refract({ + // validation Keywords for Applying Subschemas Conditionally + if: { $ref: '#/components/schemas/Schema1' }, + then: { $ref: '#/components/schemas/Schema1' }, + else: { $ref: '#/components/schemas/Schema1' }, + // validation Keywords for Arrays + items: [{}, { $ref: '#/components/schemas/Schema1' }], + additionalItems: { $ref: '#/components/schemas/Schema1' }, + contains: { $ref: '#/components/schemas/Schema1' }, + // validation Keywords for Objects + additionalProperties: { $ref: '#/components/schemas/Schema1' }, + propertyNames: { $ref: '#/components/schemas/Schema1' }, + }); + + expect(sexprs(schemaElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..ebad820dda --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/__snapshots__/index.ts.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SecurityScheme should refract to semantic ApiDOM tree 1`] = ` +(SecuritySchemeElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (OAuthFlowsElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement)))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/index.ts new file mode 100644 index 0000000000..06f6343ad2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/SecurityScheme/index.ts @@ -0,0 +1,26 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SecuritySchemeElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SecurityScheme', function () { + specify('should refract to semantic ApiDOM tree', function () { + const securitySchemeElement = SecuritySchemeElement.refract({ + type: 'security-scheme-type', + description: 'security-scheme-description', + name: 'security-scheme-name', + in: 'security-scheme-in', + scheme: 'security-scheme-scheme', + bearerFormat: 'security-scheme-bearerFormat', + flows: {}, + openIdConnectUrl: 'security-scheme-openIdConnectUrl', + scopes: ['security-scheme-scope'], + }); + + expect(sexprs(securitySchemeElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..e5b62da7f7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/__snapshots__/index.ts.snap @@ -0,0 +1,117 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ServerElement given bindings field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements ServerElement given bindings field of type ServerBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (ServerBindingsElement))) +`; + +exports[`refractor elements ServerElement given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements ServerElement given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements ServerElement given security field values contain ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements ServerElement given security field values contain SecuritySchemeElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (ArrayElement + (SecuritySchemeElement)))) +`; + +exports[`refractor elements ServerElement given tags field contains list of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (TagsElement + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))))) +`; + +exports[`refractor elements ServerElement given tags field contains list of type TagElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (TagsElement + (TagElement)))) +`; + +exports[`refractor elements ServerElement given variables field values contain ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))))) +`; + +exports[`refractor elements ServerElement should refract to semantic ApiDOM tree 1`] = ` +(ServerElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ServerVariableElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/index.ts new file mode 100644 index 0000000000..71b84495ad --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Server/index.ts @@ -0,0 +1,133 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ServerElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ServerElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + title: 'server-title', + summary: 'server-summary', + description: 'server-description', + host: '{username}.gigantic-server.com', + protocol: 'kafka', + protocolVersion: '1.0.0', + pathname: '/v2', + variables: { + username: {}, + }, + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + + context('given bindings field of type ServerBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + bindings: {}, + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given bindings field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + bindings: { + $ref: '#/path/to/bindings', + }, + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given variables field values contain ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + variables: { + username: { + $ref: '#/path/to/server-variable', + }, + }, + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given security field values contain SecuritySchemeElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + security: [{}], + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given security field values contain ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + security: [ + { + $ref: '#/path/to/security-scheme', + }, + ], + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + tags: [{}], + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given tags field contains list of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + tags: [ + { + $ref: '#/path/to/tag', + }, + ], + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverElement = ServerElement.refract({ + externalDocs: { + $ref: '#/path/to/external-docs', + }, + }); + + expect(sexprs(serverElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..7e5c724575 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/__snapshots__/index.ts.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ServerBindingsElement should refract to semantic ApiDOM tree 1`] = ` +(ServerBindingsElement + (MemberElement + (StringElement) + (HttpServerBindingElement)) + (MemberElement + (StringElement) + (WebSocketServerBindingElement)) + (MemberElement + (StringElement) + (KafkaServerBindingElement)) + (MemberElement + (StringElement) + (AnypointmqServerBindingElement)) + (MemberElement + (StringElement) + (AmqpServerBindingElement)) + (MemberElement + (StringElement) + (Amqp1ServerBindingElement)) + (MemberElement + (StringElement) + (MqttServerBindingElement)) + (MemberElement + (StringElement) + (Mqtt5ServerBindingElement)) + (MemberElement + (StringElement) + (NatsServerBindingElement)) + (MemberElement + (StringElement) + (JmsServerBindingElement)) + (MemberElement + (StringElement) + (SnsServerBindingElement)) + (MemberElement + (StringElement) + (SolaceServerBindingElement)) + (MemberElement + (StringElement) + (SqsServerBindingElement)) + (MemberElement + (StringElement) + (StompServerBindingElement)) + (MemberElement + (StringElement) + (RedisServerBindingElement)) + (MemberElement + (StringElement) + (MercureServerBindingElement)) + (MemberElement + (StringElement) + (IbmmqServerBindingElement)) + (MemberElement + (StringElement) + (GooglepubsubServerBindingElement)) + (MemberElement + (StringElement) + (PulsarServerBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/index.ts new file mode 100644 index 0000000000..b6652909a0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerBindings/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ServerBindingsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ServerBindingsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverBindingsElement = ServerBindingsElement.refract({ + http: {}, + ws: {}, + kafka: {}, + anypointmq: {}, + amqp: {}, + amqp1: {}, + mqtt: {}, + mqtt5: {}, + nats: {}, + jms: {}, + sns: {}, + solace: {}, + sqs: {}, + stomp: {}, + redis: {}, + mercure: {}, + ibmmq: {}, + googlepubsub: {}, + pulsar: {}, + }); + + expect(sexprs(serverBindingsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..bc83446d6b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/__snapshots__/index.ts.snap @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ServerVariableElement should refract to semantic ApiDOM tree 1`] = ` +(ServerVariableElement + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (StringElement))) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (StringElement)))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/index.ts new file mode 100644 index 0000000000..eb4cd3f10a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/ServerVariable/index.ts @@ -0,0 +1,21 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ServerVariableElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ServerVariableElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serverVariableElement = ServerVariableElement.refract({ + enum: ['val1', 'val2'], + default: 'val1', + description: 'server-variable-description', + examples: ['val1', 'val2'], + }); + + expect(sexprs(serverVariableElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..987f8b6556 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/__snapshots__/index.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements ServersElement should refract to semantic ApiDOM tree 1`] = ` +(ServersElement + (MemberElement + (StringElement) + (ServerElement)) + (MemberElement + (StringElement) + (ServerElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/index.ts new file mode 100644 index 0000000000..a85e043dca --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Servers/index.ts @@ -0,0 +1,22 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { ServersElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('ServersElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const serversElement = ServersElement.refract({ + dev: {}, + staging: {}, + production: { + $ref: '#/path/to/production/server', + }, + }); + + expect(sexprs(serversElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..0f829b64d7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/__snapshots__/index.ts.snap @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements TagElement given externalDocs field of type ExternalDocumentationElement should refract to semantic ApiDOM tree 1`] = ` +(TagElement + (MemberElement + (StringElement) + (ExternalDocumentationElement))) +`; + +exports[`refractor elements TagElement given externalDocs field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(TagElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement))))) +`; + +exports[`refractor elements TagElement should refract to semantic ApiDOM tree 1`] = ` +(TagElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/index.ts new file mode 100644 index 0000000000..0e274a4e48 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tag/index.ts @@ -0,0 +1,41 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { TagElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('TagElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const tagElement = TagElement.refract({ + name: 'tag-name', + description: 'tag-description', + }); + + expect(sexprs(tagElement)).toMatchSnapshot(); + }); + + context('given externalDocs field of type ExternalDocumentationElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const tagElement = TagElement.refract({ + externalDocs: {}, + }); + + expect(sexprs(tagElement)).toMatchSnapshot(); + }); + }); + + context('given externalDocs field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const tagElement = TagElement.refract({ + externalDocs: { + $ref: '#/path/to/external-docs', + }, + }); + + expect(sexprs(tagElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..1e3b166694 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements TagsElement should refract to semantic ApiDOM tree 1`] = ` +(TagsElement + (TagElement) + (TagElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/index.ts new file mode 100644 index 0000000000..a7a8483e87 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/Tags/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { TagsElement } from '../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('TagsElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const tagsElement = TagsElement.refract([{}, {}, { $ref: '#/path/to/tag' }]); + + expect(sexprs(tagsElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..2acfbedd21 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AmqpChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(AmqpChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/index.ts new file mode 100644 index 0000000000..b963c55e1b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpChannelBinding/index.ts @@ -0,0 +1,33 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AmqpChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AmqpChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqpChannelBindingElement = AmqpChannelBindingElement.refract({ + is: 'routingKey', + exchange: { + name: 'myExchange', + type: 'topic', + durable: true, + autoDelete: false, + vhost: '/', + }, + queue: { + name: 'my-queue-name', + durable: true, + exclusive: true, + autoDelete: false, + vhost: '/', + }, + bindingVersion: '0.2.0', + }); + + expect(sexprs(amqpChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..92a78f4b3b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AmqpMessageBindingElement should refract to semantic ApiDOM tree 1`] = ` +(AmqpMessageBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/index.ts new file mode 100644 index 0000000000..8a73fee89b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpMessageBinding/index.ts @@ -0,0 +1,20 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AmqpMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AmqpMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqpMessageBindingElement = AmqpMessageBindingElement.refract({ + contentEncoding: 'gzip', + messageType: 'user.signup', + bindingVersion: '0.2.0', + }); + + expect(sexprs(amqpMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..2e6adae409 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AmqpOperationBindingElement should refract to semantic ApiDOM tree 1`] = ` +(AmqpOperationBindingElement + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement))) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement))) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/index.ts new file mode 100644 index 0000000000..d4131080d1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpOperationBinding/index.ts @@ -0,0 +1,28 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AmqpOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AmqpOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqpOperationBindingElement = AmqpOperationBindingElement.refract({ + expiration: 100000, + userId: 'guest', + cc: ['user.logs'], + priority: 10, + deliveryMode: 2, + mandatory: false, + bcc: ['external.audit'], + replyTo: 'user.signedup', + timestamp: true, + ack: false, + bindingVersion: '0.2.0', + }); + + expect(sexprs(amqpOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..be35aebf8f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AmqpServerBindingElement should refract to semantic ApiDOM tree 1`] = `(AmqpServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/index.ts new file mode 100644 index 0000000000..649f062650 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp/AmqpServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AmqpServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AmqpServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqpServerBindingElement = AmqpServerBindingElement.refract({}); + + expect(sexprs(amqpServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..fc5dbae82e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Amqp1ChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(Amqp1ChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/index.ts new file mode 100644 index 0000000000..315348dd91 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Amqp1ChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Amqp1ChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqp1ChannelBindingElement = Amqp1ChannelBindingElement.refract({}); + + expect(sexprs(amqp1ChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..69040f9db7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Amqp1MessageBindingElement should refract to semantic ApiDOM tree 1`] = `(Amqp1MessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/index.ts new file mode 100644 index 0000000000..709fea23ba --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1MessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Amqp1MessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Amqp1MessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqp1MessageBindingElement = Amqp1MessageBindingElement.refract({}); + + expect(sexprs(amqp1MessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..8addcc8b32 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Amqp1OperationBindingElement should refract to semantic ApiDOM tree 1`] = `(Amqp1OperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/index.ts new file mode 100644 index 0000000000..65e14158ec --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1OperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Amqp1OperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Amqp1OperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqp1OperationBindingElement = Amqp1OperationBindingElement.refract({}); + + expect(sexprs(amqp1OperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..16e1204821 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Amqp1ServerBindingElement should refract to semantic ApiDOM tree 1`] = `(Amqp1ServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/index.ts new file mode 100644 index 0000000000..861fda5ce9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/amqp1/Amqp1ServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Amqp1ServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Amqp1ServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const amqp1ServerBindingElement = Amqp1ServerBindingElement.refract({}); + + expect(sexprs(amqp1ServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..1a7879fe64 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AnypointmqChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(AnypointmqChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/index.ts new file mode 100644 index 0000000000..cb50ec8565 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqChannelBinding/index.ts @@ -0,0 +1,20 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AnypointmqChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AnypointmqChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const anypointmqChannelBindingElement = AnypointmqChannelBindingElement.refract({ + destination: 'channel-name', + destinationType: 'queue', + bindingVersion: 'latest', + }); + + expect(sexprs(anypointmqChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..c830f1579e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AnypointmqMessageBindingElement given headers field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(AnypointmqMessageBindingElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement))) +`; + +exports[`refractor elements AnypointmqMessageBindingElement should refract to semantic ApiDOM tree 1`] = ` +(AnypointmqMessageBindingElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/index.ts new file mode 100644 index 0000000000..c798bb9ac6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqMessageBinding/index.ts @@ -0,0 +1,32 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AnypointmqMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AnypointmqMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const anypointmqMessageBindingElement = AnypointmqMessageBindingElement.refract({ + headers: {}, + bindingVersion: '0.1.0', + }); + + expect(sexprs(anypointmqMessageBindingElement)).toMatchSnapshot(); + }); + + context('given headers field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const anypointmqMessageBindingElement = AnypointmqMessageBindingElement.refract({ + headers: { + $ref: '#/pointer', + }, + bindingVersion: '0.1.0', + }); + + expect(sexprs(anypointmqMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..e0a098208f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AnypointmqOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(AnypointmqOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/index.ts new file mode 100644 index 0000000000..41a30192a7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AnypointmqOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AnypointmqOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const anypointmqOperationBindingElement = AnypointmqOperationBindingElement.refract({}); + + expect(sexprs(anypointmqOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..96bcf9ed8e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements AnypointmqServerBindingElement should refract to semantic ApiDOM tree 1`] = `(AnypointmqServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/index.ts new file mode 100644 index 0000000000..eb61f07a00 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/anypointmq/AnypointmqServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { AnypointmqServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('AnypointmqServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const anypointmqServerBindingElement = AnypointmqServerBindingElement.refract({}); + + expect(sexprs(anypointmqServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..0fd76a6078 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements GooglepubsubChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(GooglepubsubChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (ArrayElement + (StringElement))))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/index.ts new file mode 100644 index 0000000000..21f94cdf1a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubChannelBinding/index.ts @@ -0,0 +1,28 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { GooglepubsubChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('GooglepubsubChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const googlepubsubChannelBindingElement = GooglepubsubChannelBindingElement.refract({ + bindingVersion: '0.1.0', + labels: {}, + messageRetentionDuration: '86400s', + messageStoragePolicy: { + allowedPersistenceRegions: ['us-central1'], + }, + schemaSettings: { + encoding: 'binary', + name: 'projects/your-project/schemas/message-proto', + }, + topic: 'projects/your-project/topics/topic-avro-schema', + }); + + expect(sexprs(googlepubsubChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..a6e54bc75c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements GooglepubsubChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(GooglepubsubMessageBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/index.ts new file mode 100644 index 0000000000..0d3dddca26 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubMessageBinding/index.ts @@ -0,0 +1,24 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { GooglepubsubMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('GooglepubsubChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const googlepubsubMessageBindingElement = GooglepubsubMessageBindingElement.refract({ + bindingVersion: '0.1.0', + attributes: {}, + orderingKey: '', + schema: { + name: 'projects/your-project/schemas/message-avro', + type: 'avro', + }, + }); + + expect(sexprs(googlepubsubMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..89d4ff1259 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements GooglepubsubOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(GooglepubsubOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/index.ts new file mode 100644 index 0000000000..7c31ce5163 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { GooglepubsubOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('GooglepubsubOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const googlepubsubOperationBindingElement = GooglepubsubOperationBindingElement.refract({}); + + expect(sexprs(googlepubsubOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..84dce17b90 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements GooglepubsubServerBindingElement should refract to semantic ApiDOM tree 1`] = `(GooglepubsubServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/index.ts new file mode 100644 index 0000000000..feddf7b359 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/googlepubsub/googlepubsubServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { GooglepubsubServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('GooglepubsubServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const googlepubsubServerBindingElement = GooglepubsubServerBindingElement.refract({}); + + expect(sexprs(googlepubsubServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..18bf4612aa --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements HttpChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(HttpChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/index.ts new file mode 100644 index 0000000000..eabad95b22 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { HttpChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('HttpChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const httpChannelBindingElement = HttpChannelBindingElement.refract({}); + + expect(sexprs(httpChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..e5229e353f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements HttpMessageBindingElement given query field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(HttpMessageBindingElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement))) +`; + +exports[`refractor elements HttpMessageBindingElement should refract to semantic ApiDOM tree 1`] = ` +(HttpMessageBindingElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/index.ts new file mode 100644 index 0000000000..c736d09328 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpMessageBinding/index.ts @@ -0,0 +1,32 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { HttpMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('HttpMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const httpMessageBindingElement = HttpMessageBindingElement.refract({ + headers: {}, + bindingVersion: '0.1.0', + }); + + expect(sexprs(httpMessageBindingElement)).toMatchSnapshot(); + }); + + context('given query field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const httpMessageBindingElement = HttpMessageBindingElement.refract({ + headers: { + $ref: '#/pointer', + }, + bindingVersion: '0.1.0', + }); + + expect(sexprs(httpMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..98e42b41ac --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements HttpOperationBindingElement given query field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(HttpOperationBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement))) +`; + +exports[`refractor elements HttpOperationBindingElement should refract to semantic ApiDOM tree 1`] = ` +(HttpOperationBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/index.ts new file mode 100644 index 0000000000..0ef35a5a35 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpOperationBinding/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { HttpOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('HttpOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const httpOperationBindingElement = HttpOperationBindingElement.refract({ + type: 'request', + method: 'GET', + query: {}, + bindingVersion: '0.1.0', + }); + + expect(sexprs(httpOperationBindingElement)).toMatchSnapshot(); + }); + + context('given query field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const httpOperationBindingElement = HttpOperationBindingElement.refract({ + type: 'request', + method: 'GET', + query: { + $ref: '#/pointer', + }, + bindingVersion: '0.1.0', + }); + + expect(sexprs(httpOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..28c0fff007 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements HttpServerBindingElement should refract to semantic ApiDOM tree 1`] = `(HttpServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/index.ts new file mode 100644 index 0000000000..4a3375df8e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/http/HttpServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { HttpServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('HttpServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const httpServerBindingElement = HttpServerBindingElement.refract({}); + + expect(sexprs(httpServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..bd1368f64f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements IbmmqChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(IbmmqChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (BooleanElement)))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (BooleanElement)))) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/index.ts new file mode 100644 index 0000000000..b7bd901e86 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqChannelBinding/index.ts @@ -0,0 +1,30 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { IbmmqChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('IbmmqChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const ibmmqChannelBindingElement = IbmmqChannelBindingElement.refract({ + destinationType: 'topic', + topic: { + objectName: 'myTopicName', + durablePermitted: true, + lastMsgRetained: true, + }, + queue: { + objectName: 'myQueueName', + isPartitioned: true, + exclusive: true, + }, + maxMsgLength: 20, + bindingVersion: '0.1.0', + }); + + expect(sexprs(ibmmqChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..4d4be1e0c2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,20 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements IbmmqMessageBindingElement should refract to semantic ApiDOM tree 1`] = ` +(IbmmqMessageBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/index.ts new file mode 100644 index 0000000000..94811a271a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqMessageBinding/index.ts @@ -0,0 +1,22 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { IbmmqMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('IbmmqMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const ibmmqMessageBindingElement = IbmmqMessageBindingElement.refract({ + type: 'jms', + headers: 'MQFMT_CICS,MQFMT_ADMIN', + description: 'JMS stream message', + expiry: 1, + bindingVersion: '0.1.0', + }); + + expect(sexprs(ibmmqMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..020cfde331 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements IbmmqServerBindingElement should refract to semantic ApiDOM tree 1`] = ` +(IbmmqServerBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/index.ts new file mode 100644 index 0000000000..0a6f5fd1fc --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/IbmmqServerBinding/index.ts @@ -0,0 +1,23 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { IbmmqServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('IbmmqServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const ibmmqServerBindingElement = IbmmqServerBindingElement.refract({ + groupId: 'PRODCLSTR1', + ccdtQueueManagerName: 'qm1', + cipherSpec: 'ANY_TLS12_OR_HIGHER', + multiEndpointServer: true, + heartBeatInterval: 1, + bindingVersion: '0.1.0', + }); + + expect(sexprs(ibmmqServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..74978374cc --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements IbmmqOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(IbmmqOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/index.ts new file mode 100644 index 0000000000..eb9129e84d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ibmmq/ibmmqOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { IbmmqOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('IbmmqOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const ibmmqOperationBindingElement = IbmmqOperationBindingElement.refract({}); + + expect(sexprs(ibmmqOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..4b1a4fa93c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements JmsChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(JmsChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/index.ts new file mode 100644 index 0000000000..d8fe0b6ae2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { JmsChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('JmsChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const jmsChannelBindingElement = JmsChannelBindingElement.refract({}); + + expect(sexprs(jmsChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..27fbc78118 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements JmsMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(JmsMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/index.ts new file mode 100644 index 0000000000..1f17638829 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { JmsMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('JmsMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const jmsMessageBindingElement = JmsMessageBindingElement.refract({}); + + expect(sexprs(jmsMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..325252f7b0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements JmsOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(JmsOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/index.ts new file mode 100644 index 0000000000..491814e5f5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { JmsOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('JmsOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const jmsOperationBindingElement = JmsOperationBindingElement.refract({}); + + expect(sexprs(jmsOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..fef869b3f6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements JmsServerBindingElement should refract to semantic ApiDOM tree 1`] = `(JmsServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/index.ts new file mode 100644 index 0000000000..a6e4474e76 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/jms/JmsServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { JmsServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('JmsServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const jmsServerBindingElement = JmsServerBindingElement.refract({}); + + expect(sexprs(jmsServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..70cdeedf1e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements KafkaChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(KafkaChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/index.ts new file mode 100644 index 0000000000..d1657accbe --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaChannelBinding/index.ts @@ -0,0 +1,21 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { KafkaChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('KafkaChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const kafkaChannelBindingElement = KafkaChannelBindingElement.refract({ + topic: 'my-specific-topic-name', + partitions: 20, + replicas: 3, + bindingVersion: '0.3.0', + }); + + expect(sexprs(kafkaChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..7893b32ef4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements KafkaMessageBindingElement given query field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(KafkaMessageBindingElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; + +exports[`refractor elements KafkaMessageBindingElement should refract to semantic ApiDOM tree 1`] = ` +(KafkaMessageBindingElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/index.ts new file mode 100644 index 0000000000..a7800e885a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaMessageBinding/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { KafkaMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('KafkaMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const kafkaMessageBindingElement = KafkaMessageBindingElement.refract({ + key: {}, + schemaIdLocation: 'payload', + schemaIdPayloadEncoding: '4', + bindingVersion: '0.3.0', + }); + + expect(sexprs(kafkaMessageBindingElement)).toMatchSnapshot(); + }); + + context('given query field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const kafkaMessageBindingElement = KafkaMessageBindingElement.refract({ + key: { + $ref: '#/pointer', + }, + schemaIdLocation: 'payload', + schemaIdPayloadEncoding: '4', + bindingVersion: '0.3.0', + }); + + expect(sexprs(kafkaMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..7ab91d2209 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements KafkaOperationBindingElement given query field of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(KafkaOperationBindingElement + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement))) +`; + +exports[`refractor elements KafkaOperationBindingElement should refract to semantic ApiDOM tree 1`] = ` +(KafkaOperationBindingElement + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/index.ts new file mode 100644 index 0000000000..ec9127c87c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaOperationBinding/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { KafkaOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('KafkaOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const kafkaOperationBindingElement = KafkaOperationBindingElement.refract({ + groupId: {}, + clientId: {}, + bindingVersion: '0.1.0', + }); + + expect(sexprs(kafkaOperationBindingElement)).toMatchSnapshot(); + }); + + context('given query field of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const kafkaOperationBindingElement = KafkaOperationBindingElement.refract({ + groupId: { + $ref: '#/pointer', + }, + clientId: { + $ref: '#/pointer', + }, + bindingVersion: '0.1.0', + }); + + expect(sexprs(kafkaOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..ccf91d1efe --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements KafkaServerBindingElement should refract to semantic ApiDOM tree 1`] = ` +(KafkaServerBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/index.ts new file mode 100644 index 0000000000..894bd72421 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/kafka/KafkaServerBinding/index.ts @@ -0,0 +1,20 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { KafkaServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('KafkaServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const kafkaServerBindingElement = KafkaServerBindingElement.refract({ + schemaRegistryUrl: 'https://my-schema-registry.com', + schemaRegistryVendor: 'confluent', + bindingVersion: '0.3.0', + }); + + expect(sexprs(kafkaServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..6c43881252 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MercureChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(MercureChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/index.ts new file mode 100644 index 0000000000..ccf74aa89b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MercureChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MercureChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mercureChannelBindingElement = MercureChannelBindingElement.refract({}); + + expect(sexprs(mercureChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..2dcede4134 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MercureMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(MercureMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/index.ts new file mode 100644 index 0000000000..d9d8235354 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MercureMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MercureMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mercureMessageBindingElement = MercureMessageBindingElement.refract({}); + + expect(sexprs(mercureMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..4f63fe544a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MercureOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(MercureOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/index.ts new file mode 100644 index 0000000000..938caa02c6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MercureOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MercureOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mercureOperationBindingElement = MercureOperationBindingElement.refract({}); + + expect(sexprs(mercureOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..c95abbdd1e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MercureServerBindingElement should refract to semantic ApiDOM tree 1`] = `(MercureServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/index.ts new file mode 100644 index 0000000000..f0fcdadce5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mercure/MercureServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MercureServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MercureServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mercureServerBindingElement = MercureServerBindingElement.refract({}); + + expect(sexprs(mercureServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..0989cbec79 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MqttChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(MqttChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/index.ts new file mode 100644 index 0000000000..afb20bdebb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MqttChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MqttChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqttChannelBindingElement = MqttChannelBindingElement.refract({}); + + expect(sexprs(mqttChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..88f8016081 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MqttMessageBindingElement should refract to semantic ApiDOM tree 1`] = ` +(MqttMessageBindingElement + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/index.ts new file mode 100644 index 0000000000..070117811c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttMessageBinding/index.ts @@ -0,0 +1,18 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MqttMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MqttMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqttMessageBindingElement = MqttMessageBindingElement.refract({ + bindingVersion: '0.1.0', + }); + + expect(sexprs(mqttMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..8d923a4d9f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MqttOperationBindingElement should refract to semantic ApiDOM tree 1`] = ` +(MqttOperationBindingElement + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/index.ts new file mode 100644 index 0000000000..a01f36fd45 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttOperationBinding/index.ts @@ -0,0 +1,20 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MqttOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MqttOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqttOperationBindingElement = MqttOperationBindingElement.refract({ + qos: 2, + retain: true, + bindingVersion: '0.1.0', + }); + + expect(sexprs(mqttOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..dcf21d28d3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements MqttServerBindingElement should refract to semantic ApiDOM tree 1`] = ` +(MqttServerBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (BooleanElement)))) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/index.ts new file mode 100644 index 0000000000..6e761d4d99 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt/MqttServerBinding/index.ts @@ -0,0 +1,27 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { MqttServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('MqttServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqttServerBindingElement = MqttServerBindingElement.refract({ + clientId: 'guest', + cleanSession: true, + lastWill: { + topic: '/last-wills', + qos: 2, + message: 'Guest gone offline.', + retain: false, + }, + keepAlive: 60, + bindingVersion: '0.1.0', + }); + + expect(sexprs(mqttServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..f3a7234d7c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Mqtt5ChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(Mqtt5ChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/index.ts new file mode 100644 index 0000000000..1bc541b82d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Mqtt5ChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Mqtt5ChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqtt5ChannelBindingElement = Mqtt5ChannelBindingElement.refract({}); + + expect(sexprs(mqtt5ChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..b614fea518 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Mqtt5MessageBindingElement should refract to semantic ApiDOM tree 1`] = `(Mqtt5MessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/index.ts new file mode 100644 index 0000000000..70f4a7062b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5MessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Mqtt5MessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Mqtt5MessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqtt5MessageBindingElement = Mqtt5MessageBindingElement.refract({}); + + expect(sexprs(mqtt5MessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..249bfaf71d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Mqtt5OperationBindingElement should refract to semantic ApiDOM tree 1`] = `(Mqtt5OperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/index.ts new file mode 100644 index 0000000000..0b1fd25c40 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5OperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Mqtt5OperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Mqtt5OperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqtt5OperationBindingElement = Mqtt5OperationBindingElement.refract({}); + + expect(sexprs(mqtt5OperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..9654d1a450 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements Mqtt5ServerBindingElement should refract to semantic ApiDOM tree 1`] = `(Mqtt5ServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/index.ts new file mode 100644 index 0000000000..f003b478f1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/mqtt5/Mqtt5ServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { Mqtt5ServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('Mqtt5ServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const mqtt5ServerBindingElement = Mqtt5ServerBindingElement.refract({}); + + expect(sexprs(mqtt5ServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..988a76d92c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements NatsChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(NatsChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/index.ts new file mode 100644 index 0000000000..4ef78951f7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { NatsChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('NatsChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const natsChannelBindingElement = NatsChannelBindingElement.refract({}); + + expect(sexprs(natsChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..e4b9c02f6d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements NatsMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(NatsMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/index.ts new file mode 100644 index 0000000000..fcd90560ac --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { NatsMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('NatsMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const natsMessageBindingElement = NatsMessageBindingElement.refract({}); + + expect(sexprs(natsMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..e2d4ca344c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements NatsOperationBindingElement should refract to semantic ApiDOM tree 1`] = ` +(NatsOperationBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/index.ts new file mode 100644 index 0000000000..38bdadd16d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsOperationBinding/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { NatsOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('NatsOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const natsOperationBindingElement = NatsOperationBindingElement.refract({ + queue: 'test', + bindingVersion: '0.1.0', + }); + + expect(sexprs(natsOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..b0c04a7e84 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements NatsServerBindingElement should refract to semantic ApiDOM tree 1`] = `(NatsServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/index.ts new file mode 100644 index 0000000000..c1732034fa --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/nats/NatsServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { NatsServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('NatsServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const natsServerBindingElement = NatsServerBindingElement.refract({}); + + expect(sexprs(natsServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..65523f2750 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements PulsarChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(PulsarChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (ArrayElement + (StringElement) + (StringElement))) + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (NumberElement)))) + (MemberElement + (StringElement) + (NumberElement)) + (MemberElement + (StringElement) + (BooleanElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/index.ts new file mode 100644 index 0000000000..09f1348638 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarChannelBinding/index.ts @@ -0,0 +1,28 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { PulsarChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('PulsarChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const pulsarChannelBindingElement = PulsarChannelBindingElement.refract({ + namespace: 'namespace', + persistence: 'persistent', + compaction: 1, + 'geo-replication': ['europe', 'north america'], + retention: { + time: 0, + size: 0, + }, + ttl: 20, + deduplication: true, + bindingVersion: '0.1.0', + }); + + expect(sexprs(pulsarChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..db0d02ab60 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements PulsarMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(PulsarMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/index.ts new file mode 100644 index 0000000000..76b1021882 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { PulsarMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('PulsarMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const pulsarMessageBindingElement = PulsarMessageBindingElement.refract({}); + + expect(sexprs(pulsarMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..ea1fc7c9eb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements PulsarOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(PulsarOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/index.ts new file mode 100644 index 0000000000..4bcb245ee8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { PulsarOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('PulsarOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const pulsarOperationBindingElement = PulsarOperationBindingElement.refract({}); + + expect(sexprs(pulsarOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..fa430343d1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements PulsarServerBindingElement should refract to semantic ApiDOM tree 1`] = ` +(PulsarServerBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/index.ts new file mode 100644 index 0000000000..9af8466bf5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/pulsar/PulsarServerBinding/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { PulsarServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('PulsarServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const pulsarServerBindingElement = PulsarServerBindingElement.refract({ + tenant: 'public', + version: '0.1.0', + }); + + expect(sexprs(pulsarServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..462ae6a9b8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements RedisChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(RedisChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/index.ts new file mode 100644 index 0000000000..99834548ac --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { RedisChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('RedisChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const redisChannelBindingElement = RedisChannelBindingElement.refract({}); + + expect(sexprs(redisChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..3006624af6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements RedisMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(RedisMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/index.ts new file mode 100644 index 0000000000..57f8065134 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { RedisMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('RedisMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const redisMessageBindingElement = RedisMessageBindingElement.refract({}); + + expect(sexprs(redisMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..03e9a6e47f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements RedisOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(RedisOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/index.ts new file mode 100644 index 0000000000..1f37bce796 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { RedisOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('RedisOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const redisOperationBindingElement = RedisOperationBindingElement.refract({}); + + expect(sexprs(redisOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..4484722f53 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements RedisServerBindingElement should refract to semantic ApiDOM tree 1`] = `(RedisServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/index.ts new file mode 100644 index 0000000000..3d39535437 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/redis/RedisServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { RedisServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('RedisServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const redisServerBindingElement = RedisServerBindingElement.refract({}); + + expect(sexprs(redisServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..f3a5803dd5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SnsChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(SnsChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/index.ts new file mode 100644 index 0000000000..c14cdb2e37 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SnsChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SnsChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const snsChannelBindingElement = SnsChannelBindingElement.refract({}); + + expect(sexprs(snsChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..46ee95d324 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SnsMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(SnsMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/index.ts new file mode 100644 index 0000000000..ee64484084 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SnsMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SnsMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const snsMessageBindingElement = SnsMessageBindingElement.refract({}); + + expect(sexprs(snsMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..df7bedea87 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SnsOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(SnsOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/index.ts new file mode 100644 index 0000000000..dec3d6b5c9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SnsOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SnsOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const snsOperationBindingElement = SnsOperationBindingElement.refract({}); + + expect(sexprs(snsOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..e544b7d811 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SnsServerBindingElement should refract to semantic ApiDOM tree 1`] = `(SnsServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/index.ts new file mode 100644 index 0000000000..a49c0ade7e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sns/SnsServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SnsServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SnsServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const snsServerBindingElement = SnsServerBindingElement.refract({}); + + expect(sexprs(snsServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..830097cd57 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SolaceChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(SolaceChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/index.ts new file mode 100644 index 0000000000..fba6abea80 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SolaceChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SolaceChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const solaceChannelBindingElement = SolaceChannelBindingElement.refract({}); + + expect(sexprs(solaceChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..28e6e11bbb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SolaceMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(SolaceMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/index.ts new file mode 100644 index 0000000000..80170d0528 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SolaceMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SolaceMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const solaceMessageBindingElement = SolaceMessageBindingElement.refract({}); + + expect(sexprs(solaceMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..ee3ad06807 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SolaceOperationBindingElement should refract to semantic ApiDOM tree 1`] = ` +(SolaceOperationBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ArrayElement + (ObjectElement)))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/index.ts new file mode 100644 index 0000000000..40623f719c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceOperationBinding/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SolaceOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SolaceOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const solaceOperationBindingElement = SolaceOperationBindingElement.refract({ + bindingVersion: '0.2.0', + destinations: [{}], + }); + + expect(sexprs(solaceOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..8f49a62a2c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SolaceServerBindingElement should refract to semantic ApiDOM tree 1`] = ` +(SolaceServerBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/index.ts new file mode 100644 index 0000000000..38ea333e13 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/solace/SolaceServerBinding/index.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SolaceServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SolaceServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const solaceServerBindingElement = SolaceServerBindingElement.refract({ + bindingVersion: '0.2.0', + msgVpn: 'network1', + }); + + expect(sexprs(solaceServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..ef00a2cbe5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SqsChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(SqsChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/index.ts new file mode 100644 index 0000000000..76277a166a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SqsChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SqsChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const sqsChannelBindingElement = SqsChannelBindingElement.refract({}); + + expect(sexprs(sqsChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..d6c80ef5a3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SqsMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(SqsMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/index.ts new file mode 100644 index 0000000000..8572cf9cb8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SqsMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SqsMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const sqsMessageBindingElement = SqsMessageBindingElement.refract({}); + + expect(sexprs(sqsMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..1b92aaf787 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SqsOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(SqsOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/index.ts new file mode 100644 index 0000000000..6debb27311 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SqsOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SqsOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const sqsOperationBindingElement = SqsOperationBindingElement.refract({}); + + expect(sexprs(sqsOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..2b098e7a1f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements SqsServerBindingElement should refract to semantic ApiDOM tree 1`] = `(SqsServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/index.ts new file mode 100644 index 0000000000..f25794d807 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/sqs/SqsServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { SqsServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('SqsServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const sqsServerBindingElement = SqsServerBindingElement.refract({}); + + expect(sexprs(sqsServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..9db0e58407 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements StompChannelBindingElement should refract to semantic ApiDOM tree 1`] = `(StompChannelBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/index.ts new file mode 100644 index 0000000000..59b60772c5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompChannelBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { StompChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('StompChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const stompChannelBindingElement = StompChannelBindingElement.refract({}); + + expect(sexprs(stompChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..ed35858c02 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements StompMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(StompMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/index.ts new file mode 100644 index 0000000000..34292758a3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { StompMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('StompMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const stompMessageBindingElement = StompMessageBindingElement.refract({}); + + expect(sexprs(stompMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..61442d0fe2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements StompOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(StompOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/index.ts new file mode 100644 index 0000000000..e7fafe35ad --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { StompOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('StompOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const stompOperationBindingElement = StompOperationBindingElement.refract({}); + + expect(sexprs(stompOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..5f0d376309 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements StompServerBindingElement should refract to semantic ApiDOM tree 1`] = `(StompServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/index.ts new file mode 100644 index 0000000000..8c5a9430c4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/stomp/StompServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { StompServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('StompServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const stompServerBindingElement = StompServerBindingElement.refract({}); + + expect(sexprs(stompServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..92a0d902c3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/__snapshots__/index.ts.snap @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements WebSocketChannelBindingElement given query and header fields of type ReferenceElement should refract to semantic ApiDOM tree 1`] = ` +(WebSocketChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (ReferenceElement + (MemberElement + (StringElement) + (StringElement)))) + (MemberElement + (StringElement) + (StringElement))) +`; + +exports[`refractor elements WebSocketChannelBindingElement should refract to semantic ApiDOM tree 1`] = ` +(WebSocketChannelBindingElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (SchemaElement)) + (MemberElement + (StringElement) + (StringElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/index.ts new file mode 100644 index 0000000000..674259aee1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketChannelBinding/index.ts @@ -0,0 +1,38 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { WebSocketChannelBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('WebSocketChannelBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const webSocketChannelBindingElement = WebSocketChannelBindingElement.refract({ + method: 'web-socket-channel-method', + query: {}, + headers: {}, + bindingVersion: '0.1.0', + }); + + expect(sexprs(webSocketChannelBindingElement)).toMatchSnapshot(); + }); + + context('given query and header fields of type ReferenceElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const webSocketChannelBindingElement = WebSocketChannelBindingElement.refract({ + method: 'web-socket-channel-method', + query: { + $ref: '#/pointer', + }, + headers: { + $ref: '#/pointer', + }, + bindingVersion: '0.1.0', + }); + + expect(sexprs(webSocketChannelBindingElement)).toMatchSnapshot(); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..0450cca64f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements WebSocketMessageBindingElement should refract to semantic ApiDOM tree 1`] = `(WebSocketMessageBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/index.ts new file mode 100644 index 0000000000..c75d7e4425 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketMessageBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { WebSocketMessageBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('WebSocketMessageBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const webSocketMessageBindingElement = WebSocketMessageBindingElement.refract({}); + + expect(sexprs(webSocketMessageBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..cff05cb472 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements WebSocketOperationBindingElement should refract to semantic ApiDOM tree 1`] = `(WebSocketOperationBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/index.ts new file mode 100644 index 0000000000..6be1f4da3b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketOperationBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { WebSocketOperationBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('WebSocketOperationBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const webSocketOperationBindingElement = WebSocketOperationBindingElement.refract({}); + + expect(sexprs(webSocketOperationBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..54ef444582 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/__snapshots__/index.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`refractor elements WebSocketServerBindingElement should refract to semantic ApiDOM tree 1`] = `(WebSocketServerBindingElement)`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/index.ts new file mode 100644 index 0000000000..39743d6618 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/elements/bindings/ws/WebSocketServerBinding/index.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; + +import { WebSocketServerBindingElement } from '../../../../../../src/index.ts'; + +describe('refractor', function () { + context('elements', function () { + context('WebSocketServerBindingElement', function () { + specify('should refract to semantic ApiDOM tree', function () { + const webSocketServerBindingElement = WebSocketServerBindingElement.refract({}); + + expect(sexprs(webSocketServerBindingElement)).toMatchSnapshot(); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/fixtures/asyncapi-3-0-0.json b/packages/apidom-ns-asyncapi-3/test/refractor/fixtures/asyncapi-3-0-0.json new file mode 100644 index 0000000000..f1cbd29430 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/fixtures/asyncapi-3-0-0.json @@ -0,0 +1,458 @@ +{ + "asyncapi": "3.0.0", + "id": "urn:com:smartylighting:streetlights:server", + "info": { + "title": "AsyncAPI Sample App", + "version": "1.0.1", + "description": "This is a sample server.", + "termsOfService": "http://asyncapi.org/terms/", + "contact": { + "name": "API Support", + "url": "http://www.asyncapi.org/support", + "email": "support@asyncapi.org" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "tags": [ + { + "name": "topLevelTag", + "description": "topLevelTag description", + "externalDocs": { + "description": "description of topLevelTag external docs", + "url": "https://example.com/topLevelTag" + } + } + ], + "externalDocs": { + "description": "description of this document external docs", + "url": "https://example.com/document" + } + }, + "servers": { + "production": { + "host": "{username}.gigantic-server.com", + "protocol": "kafka", + "protocolVersion": "1.0.0", + "pathname": "/v2", + "description": "Production server description", + "title": "Production server", + "summary": "Production server summary.", + "variables": { + "username": { + "enum": ["demo", "demo1", "demo2"], + "default": "demo", + "description": "This value is assigned by the service provider, in this example `gigantic-server.com`", + "examples": ["demo", "demo1", "demo2"] + } + }, + "security": [ + { + "petstore_auth": { + "type": "apiKey", + "description": "Petstore Auth description", + "name": "Petstore Auth", + "in": "password", + "scheme": "Authorization", + "bearerFormat": "JWT", + "flows": { + "implicit": {}, + "password": {}, + "clientCredentials": {}, + "authorizationCode": {} + }, + "openIdConnectUrl": "security-scheme-openIdConnectUrl", + "scopes": ["write:pets", "read:pets"] + } + } + ], + "bindings": { + "kafka": {} + }, + "tags": [ + { + "name": "serversLevelTag", + "description": "serversLevelTag description", + "externalDocs": { + "description": "description of serversLevelTag external docs", + "url": "https://example.com/serversLevelTag" + } + } + ] + }, + "development": { + "host": "gigantic-server.com", + "protocol": "kafka", + "bindings": { + "jms": {} + } + } + }, + "defaultContentType": "application/json", + "channels": { + "userSignedUp": { + "address": "users.{userId}", + "title": "Users channel", + "description": "This channel is used to exchange messages about user events.", + "summary": "Exchange messages about user events.", + "messages": { + "userSignedUp": { + "headers": { + "type": "object" + }, + "payload": { + "type": "object", + "properties": { + "user": { + "$ref": "#/components/schemas/user" + }, + "signup": { + "$ref": "#/components/schemas/signup" + } + } + }, + "correlationId": { + "description": "correlation id description", + "location": "http://asyncapi.com/" + }, + "contentType": "application/json", + "name": "name of the message", + "title": "title of the message", + "summary": "summary of the message", + "description": "A longer description of the message", + "tags": [ + { + "name": "tag3", + "description": "description of tag3", + "externalDocs": { + "description": "description of tag 3 external docs", + "url": "https://example.com/tag3" + } + } + ], + "externalDocs": { + "description": "description of message 1 external docs", + "url": "https://example.com/message-1-external-docs" + }, + "bindings": { + "kafka": { + "key": { + "type": "integer" + }, + "bindingVersion": "0.1.0" + } + }, + "examples": [ + { + "headers": { "Content-Type": "application/json" }, + "payload": "{\"a\":\"b\"}", + "name": "example name", + "summary": "example summary" + } + ], + "traits": [ + { + "headers": { + "type": "object" + }, + "correlationId": { + "description": "correlation id description", + "location": "http://asyncapi.com/" + }, + "contentType": "application/json", + "name": "name of the message trait", + "title": "title of the message trait", + "summary": "summary of the message trait", + "description": "A longer description of the message trait", + "tags": [ + { + "name": "tag4", + "description": "description of tag4", + "externalDocs": { + "description": "description of tag 4 external docs", + "url": "https://example.com/tag4" + } + } + ], + "externalDocs": { + "description": "description of message 1 trait external docs", + "url": "https://example.com/message-1-trait-external-docs" + }, + "bindings": { + "kafka": { + "key": { + "type": "integer" + }, + "bindingVersion": "0.1.0" + } + }, + "examples": [ + { + "headers": { "Content-Type": "application/json" }, + "payload": "{\"a\":\"b\"}", + "name": "example name", + "summary": "example summary" + } + ] + } + ] + } + }, + "parameters": { + "userId": { + "description": "User identifier" + } + }, + "servers": [ + { "$ref": "#/servers/rabbitmqInProd" }, + { "$ref": "#/servers/rabbitmqInStaging" } + ], + "bindings": { + "amqp": {} + }, + "tags": [ + { + "name": "user", + "description": "User-related messages" + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } + }, + "user/loggedout": { + "$ref": "https://outside.com/#/path/to/channel" + } + }, + "components": { + "schemas": { + "Schema1": { + "type": "object" + }, + "Schema2": { + "$ref": "#/components/schemas/Schema1" + }, + "Schema3": { + "schemaFormat": "application/vnd.aai.asyncapi;version=3.0.0", + "schema": {} + } + }, + "messages": { + "Message1": {}, + "Message2": { + "$ref": "#/components/messages/Message1" + } + }, + "securitySchemes": { + "SecurityScheme1": {}, + "SecurityScheme2": { + "$ref": "#/components/securitySchemes/SecurityScheme1" + } + }, + "parameters": { + "Parameter1": { + "description": "parameter description", + "location": "http://example.com" + }, + "Parameter2": { + "$ref": "#/components/parameters/Parameter1" + } + }, + "correlationIds": { + "CorrelationID1": {}, + "CorrelationID2": { + "$ref": "#/components/correlationIds/CorrelationID1" + } + }, + "operationTraits": { + "OperationTrait1": {}, + "OperationTrait2": { + "$ref": "#/components/operationTraits/OperationTrait1" + } + }, + "messageTraits": { + "MessageTrait1": {}, + "MessageTrait2": { + "$ref": "#/components/messageTraits/MessageTrait1" + } + }, + "serverBindings": { + "ServerBinding1": { + "kafka": {} + }, + "ServerBinding2": { + "$ref": "#/components/serverBindings/ServerBinding1" + } + }, + "channelBindings": { + "ChannelBinding1": { + "kafka": {} + }, + "ChannelBinding2": { + "$ref": "#/components/channelBindings/ChannelBinding1" + } + }, + "operationBindings": { + "OperationBinding1": { + "kafka": {} + }, + "OperationBinding2": { + "$ref": "#/components/operationBindings/OperationBinding1" + } + }, + "messageBindings": { + "MessageBinding1": { + "kafka": {} + }, + "MessageBinding2": { + "$ref": "#/components/messageBindings/MessageBinding1" + } + }, + "servers": { + "server1": {}, + "server2": { + "$ref": "#/components/servers/server1" + } + }, + "serverVariables": { + "port": { + "enum": ["8883", "8884"], + "default": "8883" + }, + "port1": { + "$ref": "#/components/serverVariables/port" + } + }, + "channels": { + "channel1": {}, + "channel2": { + "$ref": "#/components/channels/channel1" + } + }, + "operations": { + "SignUp1": {}, + "SignUp2": { + "$ref": "#/components/operations/SignUp1" + } + }, + "replies": { + "UserReply1": {}, + "UserReply2": { + "$ref": "#/components/replies/UserReply1" + } + }, + "replyAddresses": { + "UserReplyAddress1": {}, + "UserReplyAddress2": { + "$ref": "#/components/replyAddresses/UserReplyAddress1" + } + }, + "externalDocs": { + "ExternalDoc1": {}, + "ExternalDoc2": { + "$ref": "#/components/externalDocs/ExternalDoc1" + } + }, + "tags": { + "UserTag1": {}, + "UserTag2": { + "$ref": "#/components/tags/UserTag1" + } + } + }, + "operations": { + "onUserSignUp": { + "title": "User sign up", + "summary": "Action to sign a user up.", + "description": "A longer description", + "channel": { + "$ref": "#/channels/userSignup" + }, + "action": "send", + "tags": [ + { + "name": "operationTag", + "description": "operationTag description", + "externalDocs": { + "description": "description of operationTag external docs", + "url": "https://example.com/operationTag" + } + } + ], + "bindings": { + "kafka": {} + }, + "traits": [ + { + "title": "Operation trait title", + "description": "Operation trait description", + "summary": "Operation trait summary", + "bindings": { + "kafka": {} + }, + "security": [ + { + "petstore_auth": { + "type": "apiKey", + "description": "Petstore Auth description", + "name": "Petstore Auth", + "in": "password", + "scheme": "Authorization", + "bearerFormat": "JWT", + "flows": { + "implicit": {}, + "password": {}, + "clientCredentials": {}, + "authorizationCode": {} + }, + "openIdConnectUrl": "security-scheme-openIdConnectUrl", + "scopes": ["write:pets", "read:pets"] + } + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } + } + ], + "security": [ + { + "petstore_auth": { + "type": "apiKey", + "description": "Petstore Auth description", + "name": "Petstore Auth", + "in": "password", + "scheme": "Authorization", + "bearerFormat": "JWT", + "flows": { + "implicit": {}, + "password": {}, + "clientCredentials": {}, + "authorizationCode": {} + }, + "openIdConnectUrl": "security-scheme-openIdConnectUrl", + "scopes": ["write:pets", "read:pets"] + } + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + }, + "messages": [{ "$ref": "#/components/messages/Message1" }], + "reply": { + "address": { + "description": "Reply address description", + "location": "http://example.com/reply" + }, + "channel": { + "$ref": "#/components/channels/channel1" + }, + "messages": [{ "$ref": "#/components/messages/Message1" }] + } + } + } +} diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/index.ts new file mode 100644 index 0000000000..0f485e6483 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/index.ts @@ -0,0 +1,283 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { assert, expect } from 'chai'; +import sinon from 'sinon'; +import { ObjectElement, toValue, Namespace } from '@swagger-api/apidom-core'; + +import * as predicates from '../../src/predicates.ts'; +import { + AsyncApi3Element, + AsyncApiVersionElement, + isAsyncApiVersionElement, +} from '../../src/index.ts'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +describe('refractor', function () { + context('given generic ApiDOM object in AsyncApi 3.0.0 shape', function () { + specify('should refract to AsyncApi3Element', function () { + const asyncApiString = fs + .readFileSync(path.join(__dirname, 'fixtures', 'asyncapi-3-0-0.json')) + .toString(); + const asyncApiPojo = JSON.parse(asyncApiString); + const genericObjectElement = new ObjectElement(asyncApiPojo); + const asyncApiElement = AsyncApi3Element.refract(genericObjectElement); + + expect(asyncApiElement).toMatchSnapshot(); + }); + }); + + context('supports plugins', function () { + let plugin1Spec: any; + let plugin2Spec: any; + let plugin1: any; + let plugin2: any; + + beforeEach(function () { + plugin1Spec = { + name: 'plugin1', + pre() {}, + visitor: { + AsyncApiVersionElement(element: AsyncApiVersionElement) { + // @ts-ignore + element.content = '3.0.1'; // eslint-disable-line no-param-reassign + }, + }, + post() {}, + }; + plugin2Spec = { + name: 'plugin2', + pre() {}, + visitor: { + AsyncApiVersionElement(element: AsyncApiVersionElement) { + // @ts-ignore + element.meta.set('metaKey', 'metaValue'); + }, + }, + post() {}, + }; + plugin1 = sinon.spy(() => plugin1Spec); + plugin2 = sinon.spy(() => plugin2Spec); + + sinon.spy(plugin1Spec, 'pre'); + sinon.spy(plugin1Spec, 'post'); + sinon.spy(plugin1Spec.visitor, 'AsyncApiVersionElement'); + + sinon.spy(plugin2Spec, 'pre'); + sinon.spy(plugin2Spec, 'post'); + sinon.spy(plugin2Spec.visitor, 'AsyncApiVersionElement'); + }); + + context('plugin', function () { + specify('should be called with toolbox object', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.hasAllKeys(plugin1.firstCall.args[0], ['predicates', 'namespace']); + }); + + specify('should have predicates in toolbox object', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.hasAnyKeys(plugin1.firstCall.args[0].predicates, Object.keys(predicates)); + }); + + specify('should have namespace in toolbox object', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.instanceOf(plugin1.firstCall.args[0].namespace, Namespace); + }); + }); + + context('pre hook', function () { + specify('should call it once', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.isTrue(plugin1Spec.pre.calledOnce); + }); + + specify('should call it before other plugin pre hook', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.isTrue(plugin1Spec.pre.calledBefore(plugin2Spec.pre)); + }); + + specify('should call it before visiting', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.isTrue(plugin1Spec.pre.calledBefore(plugin1Spec.visitor.AsyncApiVersionElement)); + assert.isTrue(plugin1Spec.pre.calledBefore(plugin2Spec.visitor.AsyncApiVersionElement)); + }); + }); + + context('post hook', function () { + specify('should call it once', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.isTrue(plugin1Spec.post.calledOnce); + }); + + specify('should call it before other plugin post hook', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.isTrue(plugin1Spec.post.calledBefore(plugin2Spec.post)); + }); + + specify('should call it after visiting', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.isTrue(plugin1Spec.post.calledAfter(plugin1Spec.visitor.AsyncApiVersionElement)); + assert.isTrue(plugin1Spec.post.calledAfter(plugin2Spec.visitor.AsyncApiVersionElement)); + }); + }); + + context('visitor', function () { + specify('should be called once', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.isTrue(plugin1Spec.visitor.AsyncApiVersionElement.calledOnce); + assert.isTrue(plugin2Spec.visitor.AsyncApiVersionElement.calledOnce); + }); + + specify('should be called in proper order', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.isTrue( + plugin1Spec.visitor.AsyncApiVersionElement.calledBefore( + plugin2Spec.visitor.AsyncApiVersionElement, + ), + ); + }); + + context('first plugin', function () { + specify('should receive arguments', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.lengthOf(plugin1Spec.visitor.AsyncApiVersionElement.firstCall.args, 6); + }); + + specify('should receive node as first argument', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.isTrue( + isAsyncApiVersionElement(plugin1Spec.visitor.AsyncApiVersionElement.firstCall.args[0]), + ); + }); + + specify('should augment asyncapi version', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + const asyncApiElement = AsyncApi3Element.refract(genericObject, { + plugins: [plugin1], + }); + + assert.deepEqual(toValue(asyncApiElement), { asyncapi: '3.0.1' }); + }); + }); + + context('second plugin', function () { + specify('should receive arguments', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.lengthOf(plugin2Spec.visitor.AsyncApiVersionElement.firstCall.args, 6); + }); + + specify('should receive node as first argument', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + assert.isTrue( + isAsyncApiVersionElement(plugin2Spec.visitor.AsyncApiVersionElement.firstCall.args[0]), + ); + }); + + specify('should append metadata to asyncapi version', function () { + const genericObject = new ObjectElement({ + asyncapi: '3.0.0', + }); + const asyncApiElement = AsyncApi3Element.refract(genericObject, { + plugins: [plugin1, plugin2], + }); + + // @ts-ignore + assert.strictEqual(toValue(asyncApiElement.asyncapi.meta.get('metaKey')), 'metaValue'); + }); + }); + }); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/mappings.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/mappings.ts.snap new file mode 100644 index 0000000000..fe88c2378a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/mappings.ts.snap @@ -0,0 +1,154 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`given AsyncAPI definition with no empty values should do nothing 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (IdentifierElement))) +`; + +exports[`given empty value instead for AsyncAPI.components.schemas should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ComponentsElement + (MemberElement + (StringElement) + (ObjectElement))))) +`; + +exports[`given empty value instead for AsyncAPI.components.schemas.* should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ComponentsElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement))))))) +`; + +exports[`given empty value instead for Schema.properties.* should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ComponentsElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement))))))))))) +`; + +exports[`given empty value instead of ContactElement should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (InfoElement + (MemberElement + (StringElement) + (ContactElement))))) +`; + +exports[`given empty value instead of InfoElement should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (InfoElement))) +`; + +exports[`given empty value instead of Message.payload with unspecified schema format should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ComponentsElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (MessageElement + (MemberElement + (StringElement) + (SchemaElement))))))))) +`; + +exports[`given empty value instead of Message.payload.schema with supported schema format should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ComponentsElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (MessageElement + (MemberElement + (StringElement) + (MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (SchemaElement))))))))))) +`; + +exports[`given empty value instead of Message.payload.schema with unsupported schema format should replace empty value with generic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ComponentsElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (MessageElement + (MemberElement + (StringElement) + (MultiFormatSchemaElement + (MemberElement + (StringElement) + (StringElement)) + (MemberElement + (StringElement) + (ObjectElement))))))))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/sequences.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/sequences.ts.snap new file mode 100644 index 0000000000..8d7cfb4c12 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/__snapshots__/sequences.ts.snap @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`given empty value instead of SecuritySchemeElement should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ServersElement + (MemberElement + (StringElement) + (ServerElement + (MemberElement + (StringElement) + (ArrayElement + (SecuritySchemeElement)))))))) +`; + +exports[`given empty values instead of MessageTraitElement should replace empty value with semantic element 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ChannelsElement + (MemberElement + (StringElement) + (ChannelElement + (MemberElement + (StringElement) + (MessagesElement + (MemberElement + (StringElement) + (MessageElement + (MemberElement + (StringElement) + (ArrayElement + (MessageTraitElement)))))))))))) +`; + +exports[`given empty values instead of ReferenceElement should replace empty values with semantic elements 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ChannelsElement + (MemberElement + (StringElement) + (ChannelElement + (MemberElement + (StringElement) + (ArrayElement + (ReferenceElement) + (ReferenceElement)))))))) +`; + +exports[`given empty values instead of SchemaElement for allOf keyword should replace empty values with semantic elements 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ComponentsElement + (MemberElement + (StringElement) + (ObjectElement + (MemberElement + (StringElement) + (SchemaElement + (MemberElement + (StringElement) + (ArrayElement + (SchemaElement)))))))))) +`; + +exports[`given empty values instead of TagElement should replace empty values with semantic elements 1`] = ` +(AsyncApi3Element + (MemberElement + (StringElement) + (AsyncApiVersionElement)) + (MemberElement + (StringElement) + (ChannelsElement + (MemberElement + (StringElement) + (ChannelElement + (MemberElement + (StringElement) + (MessagesElement + (MemberElement + (StringElement) + (MessageElement + (MemberElement + (StringElement) + (ArrayElement + (MessageTraitElement + (MemberElement + (StringElement) + (TagsElement + (TagElement))))))))))))))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..fc725118b6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/__snapshots__/index.ts.snap @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should refract to semantic ApiDOM tree 1`] = ` +(ChannelBindingsElement + (MemberElement + (StringElement) + (HttpChannelBindingElement)) + (MemberElement + (StringElement) + (WebSocketChannelBindingElement)) + (MemberElement + (StringElement) + (KafkaChannelBindingElement)) + (MemberElement + (StringElement) + (AnypointmqChannelBindingElement)) + (MemberElement + (StringElement) + (AmqpChannelBindingElement)) + (MemberElement + (StringElement) + (Amqp1ChannelBindingElement)) + (MemberElement + (StringElement) + (MqttChannelBindingElement)) + (MemberElement + (StringElement) + (Mqtt5ChannelBindingElement)) + (MemberElement + (StringElement) + (NatsChannelBindingElement)) + (MemberElement + (StringElement) + (JmsChannelBindingElement)) + (MemberElement + (StringElement) + (SnsChannelBindingElement)) + (MemberElement + (StringElement) + (SolaceChannelBindingElement)) + (MemberElement + (StringElement) + (SqsChannelBindingElement)) + (MemberElement + (StringElement) + (StompChannelBindingElement)) + (MemberElement + (StringElement) + (RedisChannelBindingElement)) + (MemberElement + (StringElement) + (MercureChannelBindingElement)) + (MemberElement + (StringElement) + (IbmmqChannelBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/index.ts new file mode 100644 index 0000000000..ca0505ffa4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ChannelBindings/index.ts @@ -0,0 +1,37 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; +import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; +import dedent from 'dedent'; + +import { + ChannelBindingsElement, + refractorPluginReplaceEmptyElement, +} from '../../../../../../src/index.ts'; + +it('should refract to semantic ApiDOM tree', async function () { + const yamlDefinition = dedent` + http: + ws: + kafka: + anypointmq: + amqp: + amqp1: + mqtt: + mqtt5: + nats: + jms: + sns: + solace: + sqs: + stomp: + redis: + mercure: + ibmmq: + `; + const apiDOM = await parse(yamlDefinition); + const channelBindingsElement = ChannelBindingsElement.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(channelBindingsElement)).toMatchSnapshot(); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..383f8a885c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/__snapshots__/index.ts.snap @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should refract to semantic ApiDOM tree 1`] = ` +(MessageBindingsElement + (MemberElement + (StringElement) + (HttpMessageBindingElement)) + (MemberElement + (StringElement) + (WebSocketMessageBindingElement)) + (MemberElement + (StringElement) + (KafkaMessageBindingElement)) + (MemberElement + (StringElement) + (AnypointmqMessageBindingElement)) + (MemberElement + (StringElement) + (AmqpMessageBindingElement)) + (MemberElement + (StringElement) + (Amqp1MessageBindingElement)) + (MemberElement + (StringElement) + (MqttMessageBindingElement)) + (MemberElement + (StringElement) + (Mqtt5MessageBindingElement)) + (MemberElement + (StringElement) + (NatsMessageBindingElement)) + (MemberElement + (StringElement) + (JmsMessageBindingElement)) + (MemberElement + (StringElement) + (SnsMessageBindingElement)) + (MemberElement + (StringElement) + (SolaceMessageBindingElement)) + (MemberElement + (StringElement) + (SqsMessageBindingElement)) + (MemberElement + (StringElement) + (StompMessageBindingElement)) + (MemberElement + (StringElement) + (RedisMessageBindingElement)) + (MemberElement + (StringElement) + (MercureMessageBindingElement)) + (MemberElement + (StringElement) + (IbmmqMessageBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/index.ts new file mode 100644 index 0000000000..2a73d7e56a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/MessageBindings/index.ts @@ -0,0 +1,37 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; +import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; +import dedent from 'dedent'; + +import { + MessageBindingsElement, + refractorPluginReplaceEmptyElement, +} from '../../../../../../src/index.ts'; + +it('should refract to semantic ApiDOM tree', async function () { + const yamlDefinition = dedent` + http: + ws: + kafka: + anypointmq: + amqp: + amqp1: + mqtt: + mqtt5: + nats: + jms: + sns: + solace: + sqs: + stomp: + redis: + mercure: + ibmmq: + `; + const apiDOM = await parse(yamlDefinition); + const messageBindingsElement = MessageBindingsElement.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(messageBindingsElement)).toMatchSnapshot(); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..8c67fba568 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/__snapshots__/index.ts.snap @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should refract to semantic ApiDOM tree 1`] = ` +(OperationBindingsElement + (MemberElement + (StringElement) + (HttpOperationBindingElement)) + (MemberElement + (StringElement) + (WebSocketOperationBindingElement)) + (MemberElement + (StringElement) + (KafkaOperationBindingElement)) + (MemberElement + (StringElement) + (AnypointmqOperationBindingElement)) + (MemberElement + (StringElement) + (AmqpOperationBindingElement)) + (MemberElement + (StringElement) + (Amqp1OperationBindingElement)) + (MemberElement + (StringElement) + (MqttOperationBindingElement)) + (MemberElement + (StringElement) + (Mqtt5OperationBindingElement)) + (MemberElement + (StringElement) + (NatsOperationBindingElement)) + (MemberElement + (StringElement) + (JmsOperationBindingElement)) + (MemberElement + (StringElement) + (SnsOperationBindingElement)) + (MemberElement + (StringElement) + (SolaceOperationBindingElement)) + (MemberElement + (StringElement) + (SqsOperationBindingElement)) + (MemberElement + (StringElement) + (StompOperationBindingElement)) + (MemberElement + (StringElement) + (RedisOperationBindingElement)) + (MemberElement + (StringElement) + (MercureOperationBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/index.ts new file mode 100644 index 0000000000..8314b9b185 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/OperationBindings/index.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; +import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; +import dedent from 'dedent'; + +import { + OperationBindingsElement, + refractorPluginReplaceEmptyElement, +} from '../../../../../../src/index.ts'; + +it('should refract to semantic ApiDOM tree', async function () { + const yamlDefinition = dedent` + http: + ws: + kafka: + anypointmq: + amqp: + amqp1: + mqtt: + mqtt5: + nats: + jms: + sns: + solace: + sqs: + stomp: + redis: + mercure: + `; + const apiDOM = await parse(yamlDefinition); + const operationBindingsElement = OperationBindingsElement.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(operationBindingsElement)).toMatchSnapshot(); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/__snapshots__/index.ts.snap b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/__snapshots__/index.ts.snap new file mode 100644 index 0000000000..1f3d85bb70 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/__snapshots__/index.ts.snap @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should refract to semantic ApiDOM tree 1`] = ` +(ServerBindingsElement + (MemberElement + (StringElement) + (HttpServerBindingElement)) + (MemberElement + (StringElement) + (WebSocketServerBindingElement)) + (MemberElement + (StringElement) + (KafkaServerBindingElement)) + (MemberElement + (StringElement) + (AnypointmqServerBindingElement)) + (MemberElement + (StringElement) + (AmqpServerBindingElement)) + (MemberElement + (StringElement) + (Amqp1ServerBindingElement)) + (MemberElement + (StringElement) + (MqttServerBindingElement)) + (MemberElement + (StringElement) + (Mqtt5ServerBindingElement)) + (MemberElement + (StringElement) + (NatsServerBindingElement)) + (MemberElement + (StringElement) + (JmsServerBindingElement)) + (MemberElement + (StringElement) + (SnsServerBindingElement)) + (MemberElement + (StringElement) + (SolaceServerBindingElement)) + (MemberElement + (StringElement) + (SqsServerBindingElement)) + (MemberElement + (StringElement) + (StompServerBindingElement)) + (MemberElement + (StringElement) + (RedisServerBindingElement)) + (MemberElement + (StringElement) + (MercureServerBindingElement)) + (MemberElement + (StringElement) + (IbmmqServerBindingElement))) +`; diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/index.ts b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/index.ts new file mode 100644 index 0000000000..33ce9be635 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/elements/ServerBindings/index.ts @@ -0,0 +1,37 @@ +import { expect } from 'chai'; +import { sexprs } from '@swagger-api/apidom-core'; +import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; +import dedent from 'dedent'; + +import { + ServerBindingsElement, + refractorPluginReplaceEmptyElement, +} from '../../../../../../src/index.ts'; + +it('should refract to semantic ApiDOM tree', async function () { + const yamlDefinition = dedent` + http: + ws: + kafka: + anypointmq: + amqp: + amqp1: + mqtt: + mqtt5: + nats: + jms: + sns: + solace: + sqs: + stomp: + redis: + mercure: + ibmmq: + `; + const apiDOM = await parse(yamlDefinition); + const serverBindingsElement = ServerBindingsElement.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(serverBindingsElement)).toMatchSnapshot(); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/mappings.ts b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/mappings.ts new file mode 100644 index 0000000000..fa04e0f6d3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/mappings.ts @@ -0,0 +1,188 @@ +import { expect } from 'chai'; +import dedent from 'dedent'; +import { sexprs } from '@swagger-api/apidom-core'; +import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; + +import { refractorPluginReplaceEmptyElement, AsyncApi3Element } from '../../../../src/index.ts'; + +describe('given empty value instead of InfoElement', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + info: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty value instead of ContactElement', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + info: + contact: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty value instead of Message.payload.schema with supported schema format', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + components: + messages: + userSignUp: + payload: + schemaFormat: application/vnd.aai.asyncapi;version=3.0.0 + schema: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty value instead of Message.payload.schema with unsupported schema format', function () { + it('should replace empty value with generic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + components: + messages: + userSignUp: + payload: + schemaFormat: application/vnd.apache.avro;version=1.9.0 + schema: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty value instead of Message.payload with unspecified schema format', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + components: + messages: + userSignUp: + payload: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty value instead for AsyncAPI.components.schemas', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + components: + schemas: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }) as AsyncApi3Element; + const isComponentsSchemas = asyncApiElement + .get('components') + .get('schemas') + .classes.includes('components-schemas'); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + expect(isComponentsSchemas).to.be.true; + }); +}); + +describe('given empty value instead for AsyncAPI.components.schemas.*', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + components: + schemas: + Schema1: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }) as AsyncApi3Element; + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty value instead for Schema.properties.*', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + components: + schemas: + User: + properties: + firstName: + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }) as AsyncApi3Element; + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given AsyncAPI definition with no empty values', function () { + it('should do nothing', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + id: urn:com:smartylighting:streetlights:server + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }) as AsyncApi3Element; + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given AsyncAPI definition with empty values', function () { + it('should generate proper source maps', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + info: + `; + const apiDOM = await parse(yamlDefinition, { sourceMap: true }); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }) as AsyncApi3Element; + const { info: infoValue } = asyncApiElement; + + expect(infoValue?.startPositionRow).to.equal(1); + expect(infoValue?.startPositionColumn).to.equal(5); + expect(infoValue?.startIndex).to.equal(21); + expect(infoValue?.endPositionRow).to.equal(1); + expect(infoValue?.endPositionColumn).to.equal(5); + expect(infoValue?.endIndex).to.equal(21); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/sequences.ts b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/sequences.ts new file mode 100644 index 0000000000..d784f08fe3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/refractor/plugins/replace-empty-element/sequences.ts @@ -0,0 +1,104 @@ +import { expect } from 'chai'; +import dedent from 'dedent'; +import { sexprs } from '@swagger-api/apidom-core'; +import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; + +import { refractorPluginReplaceEmptyElement, AsyncApi3Element } from '../../../../src/index.ts'; + +describe('given empty value instead of SecuritySchemeElement', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + servers: + server1: + security: + - + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty values instead of MessageTraitElement', function () { + it('should replace empty value with semantic element', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + channels: + "user/subscribe": + messages: + userSubscribed: + traits: + - + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty values instead of ReferenceElement', function () { + it('should replace empty values with semantic elements', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + channels: + "user/subscribe": + servers: + - + - + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty values instead of TagElement', function () { + it('should replace empty values with semantic elements', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + channels: + "user/subscribe": + messages: + userSubscribed: + traits: + - + tags: + - + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); + +describe('given empty values instead of SchemaElement for allOf keyword', function () { + it('should replace empty values with semantic elements', async function () { + const yamlDefinition = dedent` + asyncapi: 3.0.0 + components: + schemas: + Schema1: + allOf: + - + `; + const apiDOM = await parse(yamlDefinition); + const asyncApiElement = AsyncApi3Element.refract(apiDOM.result, { + plugins: [refractorPluginReplaceEmptyElement()], + }); + + expect(sexprs(asyncApiElement)).toMatchSnapshot(); + }); +}); diff --git a/packages/apidom-ns-asyncapi-3/test/tsconfig.json b/packages/apidom-ns-asyncapi-3/test/tsconfig.json new file mode 100644 index 0000000000..405aae2d2f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/test/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "module": "esnext", + "moduleResolution": "node" + }, + "include": [ + "." + ] +} From b66b50a58d7d5b0f917b3a64023407affeeabbbb Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Mon, 10 Nov 2025 13:15:31 +0530 Subject: [PATCH 26/27] chore: update dependency version --- package-lock.json | 4 ++-- packages/apidom-ns-asyncapi-3/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13c85646dd..b562569751 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26075,8 +26075,8 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.26.10", - "@swagger-api/apidom-core": "^1.0.0-rc.1", - "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-rc.1", + "@swagger-api/apidom-core": "^1.0.0-rc.3", + "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-rc.3", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", diff --git a/packages/apidom-ns-asyncapi-3/package.json b/packages/apidom-ns-asyncapi-3/package.json index cf64ef6f39..25a0abbbb6 100644 --- a/packages/apidom-ns-asyncapi-3/package.json +++ b/packages/apidom-ns-asyncapi-3/package.json @@ -38,8 +38,8 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.26.10", - "@swagger-api/apidom-core": "^1.0.0-rc.1", - "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-rc.1", + "@swagger-api/apidom-core": "^1.0.0-rc.3", + "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-rc.3", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", From 33a7028fd6003684a0ca695e8b9a5b0544d6ed7c Mon Sep 17 00:00:00 2001 From: ShikhaSaboo Date: Mon, 10 Nov 2025 16:55:05 +0530 Subject: [PATCH 27/27] chore: fix lint issue --- .../src/elements/AsyncApi3.ts | 16 +++--------- .../src/elements/Message.ts | 23 +++++++++------- .../src/elements/Operation.ts | 1 - .../src/elements/Schema.ts | 8 +++--- .../src/elements/Server.ts | 2 +- .../src/elements/nces/OperationMessages.ts | 10 +++---- .../plugins/replace-empty-element.ts | 26 ++++++++++++------- 7 files changed, 45 insertions(+), 41 deletions(-) diff --git a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts index fa83fe30e1..35f4f1e5e0 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts @@ -20,27 +20,19 @@ class AsyncApi3 extends AsyncApi2Element { } get tags(): TagsElement | undefined { - throw new UnsupportedOperationError( - 'tags keyword has been moved to info', - ); + throw new UnsupportedOperationError('tags keyword has been moved to info'); } set tags(tags: TagsElement | undefined) { - throw new UnsupportedOperationError( - 'tags keyword has been moved to info', - ); + throw new UnsupportedOperationError('tags keyword has been moved to info'); } get externalDocs(): ExternalDocumentationElement | undefined { - throw new UnsupportedOperationError( - 'externalDocs keyword has been moved to info.', - ); + throw new UnsupportedOperationError('externalDocs keyword has been moved to info.'); } set externalDocs(externalDocs: ExternalDocumentationElement | undefined) { - throw new UnsupportedOperationError( - 'externalDocs keyword has been moved to info.', - ); + throw new UnsupportedOperationError('externalDocs keyword has been moved to info.'); } get operations(): OperationsElement | undefined { diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Message.ts b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts index 461c434454..052ab4bcba 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Message.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts @@ -1,13 +1,10 @@ import { Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; -import { - ExternalDocumentationElement, - MessageElement, -} from '@swagger-api/apidom-ns-asyncapi-2'; +import { ExternalDocumentationElement, MessageElement } from '@swagger-api/apidom-ns-asyncapi-2'; +import { UnsupportedOperationError } from '@swagger-api/apidom-error'; import MultiformatSchemaElement from './MultiFormatSchema.ts'; import SchemaElement from './Schema.ts'; import ReferenceElement from './Reference.ts'; -import { UnsupportedOperationError } from '@swagger-api/apidom-error'; /* eslint-disable class-methods-use-this */ @@ -27,20 +24,24 @@ class Message extends MessageElement { set messageId(messageId: StringElement | undefined) { throw new UnsupportedOperationError('messageId has been removed'); } - + get headers(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any { return this.get('headers'); } - set headers(headers: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any) { + set headers( + headers: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any, + ) { this.set('headers', headers); } - get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any{ + get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any { return this.get('payload'); } - set payload(payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any) { + set payload( + payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any, + ) { this.set('payload', payload); } @@ -48,7 +49,9 @@ class Message extends MessageElement { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { this.set('externalDocs', externalDocs); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts index 498860ce1a..60e976415e 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts @@ -7,7 +7,6 @@ import { } from '@swagger-api/apidom-core'; import ReferenceElement from './Reference.ts'; -import OperationTraitElement from './OperationTrait.ts'; /** * @public diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts index 25fde6a0d2..0b7b10857b 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts @@ -1,4 +1,5 @@ import { SchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; + import ExternalDocumentationElement from './ExternalDocumentation.ts'; import ReferenceElement from './Reference.ts'; @@ -6,12 +7,13 @@ import ReferenceElement from './Reference.ts'; * @public */ class Schema extends SchemaElement { - - get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { return this.get('externalDocs'); } - set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any) { + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { this.set('externalDocs', externalDocs); } } diff --git a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts index e2095db321..3671de7a3d 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/Server.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -1,4 +1,4 @@ -import { Attributes, Meta, ObjectElement, StringElement } from '@swagger-api/apidom-core'; +import { Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; import { ServerElement } from '@swagger-api/apidom-ns-asyncapi-2'; import { UnsupportedOperationError } from '@swagger-api/apidom-error'; diff --git a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts index 0d34db0030..771123a836 100644 --- a/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts @@ -3,12 +3,12 @@ import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; * @public */ class OperationMessages extends ArrayElement { - static primaryClass = 'operation-messages'; + static primaryClass = 'operation-messages'; - constructor(content?: Array, meta?: Meta, attributes?: Attributes) { - super(content, meta, attributes); - this.classes.push(OperationMessages.primaryClass); - } + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(OperationMessages.primaryClass); + } } export default OperationMessages; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts index 092a4ce824..587f7d0263 100644 --- a/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts +++ b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts @@ -292,7 +292,7 @@ const schema: Record = { bindings(...args: Record[]) { return new ChannelBindingsElement(...args); }, - tags(...args: ConstructorParameters ) { + tags(...args: ConstructorParameters) { return new TagsElement(...args); }, externalDocs(...args: Record[]) { @@ -788,7 +788,7 @@ const schema: Record = { else(...args: Record[]) { return new SchemaElement(...args); }, - enum(...args: ConstructorParameters ) { + enum(...args: ConstructorParameters) { return new ArrayElement(...args); }, items(...args: Record[]) { @@ -974,7 +974,9 @@ const schema: Record = { }, PulsarChannelBindingElement: { - 'geo-replication': function geoReplication(...args: ConstructorParameters) { + 'geo-replication': function geoReplication( + ...args: ConstructorParameters + ) { return new ArrayElement(...args); }, retention(...args: Record[]) { @@ -1100,7 +1102,6 @@ const schema: Record = { '<*>': function asterisk(...args: Record[]) { return new ReferenceElement(...args); }, - }, [OperationReplyMessagesElement.primaryClass]: { @@ -1128,7 +1129,7 @@ const schema: Record = { }, [ChannelServersElement.primaryClass]: { - '<*>': function asterisk(...args: Record[] ) { + '<*>': function asterisk(...args: Record[]) { return new ReferenceElement(...args); }, }, @@ -1170,9 +1171,12 @@ const schema: Record = { }, }; -const findElementFactory = (ancestor: any , keyName: string) => { +const findElementFactory = (ancestor: any, keyName: string) => { const elementType = getNodeType(ancestor); - const keyMapping = (schema[elementType ?? ''] || schema[toValue(ancestor.classes.first)]) as Record | unknown | undefined ; + const keyMapping = (schema[elementType ?? ''] || schema[toValue(ancestor.classes.first)]) as + | Record + | unknown + | undefined; if (keyMapping == null || typeof keyMapping !== 'object') { return undefined; @@ -1189,8 +1193,12 @@ const findElementFactory = (ancestor: any , keyName: string) => { const plugin = () => () => ({ visitor: { StringElement( - element: StringElement, - key: unknown, parent: unknown, path: unknown, ancestors: Record[] | unknown[]) { + element: StringElement, + key: unknown, + parent: unknown, + path: unknown, + ancestors: Record[] | unknown[], + ) { if (!isEmptyElement(element)) return undefined; const lineage = [...ancestors, parent].filter(isElement);