diff --git a/package-lock.json b/package-lock.json index 9fb38fe57c..b562569751 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-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", + "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.3", diff --git a/packages/apidom-ns-asyncapi-2/src/index.ts b/packages/apidom-ns-asyncapi-2/src/index.ts index 9f417de0de..5db7c01a29 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,29 +859,29 @@ export { WebSocketServerBindingElement, } from './refractor/registration.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'; -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 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'; +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'; 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/.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/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..16089982b3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/config/webpack/browser.config.js @@ -0,0 +1,75 @@ +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..25a0abbbb6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/package.json @@ -0,0 +1,58 @@ +{ + "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: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 --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": { + "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-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", + "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..35f4f1e5e0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/AsyncApi3.ts @@ -0,0 +1,47 @@ +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 OperationsElement from './Operations.ts'; + +/* eslint-disable class-methods-use-this */ + +/** + * @public + */ +class AsyncApi3 extends AsyncApi2Element { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'asyncApi3'; + } + + get tags(): TagsElement | undefined { + 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'); + } + + get externalDocs(): ExternalDocumentationElement | undefined { + 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.'); + } + + get operations(): OperationsElement | undefined { + return this.get('operations'); + } + + set operations(operations: OperationsElement | undefined) { + this.set('operations', operations); + } +} + +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..01391bb249 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channel.ts @@ -0,0 +1,101 @@ +import { ObjectElement, Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; +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'; +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: 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; 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..39116fc8c9 --- /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..23acb0df99 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Channels.ts @@ -0,0 +1,8 @@ +import { ChannelsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +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 new file mode 100644 index 0000000000..5e0c600363 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Components.ts @@ -0,0 +1,56 @@ +import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; +import { ComponentsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import TagsElement from './Tags.ts'; + +/** + * @public + */ +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'); + } + + set operations(operations: ObjectElement | undefined) { + this.set('operations', operations); + } + + get replies(): ObjectElement | undefined { + return this.get('replies'); + } + + set replies(replies: ObjectElement | undefined) { + this.set('replies', 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); + } +} + +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..7ffac26c79 --- /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..53471e102a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Info.ts @@ -0,0 +1,34 @@ +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..4f1e28e713 --- /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; 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..052ab4bcba --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Message.ts @@ -0,0 +1,59 @@ +import { Attributes, Meta, StringElement } from '@swagger-api/apidom-core'; +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'; + +/* eslint-disable class-methods-use-this */ + +/** + * @public + */ +class Message extends MessageElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'message'; + } + + 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 | any, + ) { + this.set('headers', headers); + } + + get payload(): MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any { + return this.get('payload'); + } + + set payload( + payload: MultiformatSchemaElement | SchemaElement | ReferenceElement | undefined | any, + ) { + this.set('payload', payload); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { + return this.get('externalDocs'); + } + + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { + this.set('externalDocs', externalDocs); + } +} + +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..11b489fc70 --- /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..5901151bd7 --- /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; 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..0ce00d5abe --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/MessageTrait.ts @@ -0,0 +1,48 @@ +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'; + +/* eslint-disable class-methods-use-this */ + +/** + * @public + */ +class MessageTrait extends MessageTraitElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'messageTrait'; + } + + get messageId(): StringElement | undefined { + 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'); + } + + get headers(): MultiFormatSchema | SchemaElement | ReferenceElement | undefined | any { + return this.get('headers'); + } + + set headers(headers: MultiFormatSchema | SchemaElement | ReferenceElement | undefined | any) { + this.set('headers', headers); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { + return this.get('externalDocs'); + } + + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { + this.set('externalDocs', externalDocs); + } +} + +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..231e952be5 --- /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; 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..c409e8ed50 --- /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 schemaFormat(): StringElement | undefined { + return this.get('schemaFormat'); + } + + set schemaFormat(schemaFormat: StringElement | undefined) { + this.set('schemaFormat', schemaFormat); + } + + get schema() { + return this.get('schema'); + } + + set schema(schema) { + this.set('schema', schema); + } +} + +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 new file mode 100644 index 0000000000..201f5b3e53 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlow.ts @@ -0,0 +1,37 @@ +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 + */ +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; 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..3408a9ab23 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OauthFlows.ts @@ -0,0 +1,8 @@ +import { OAuthFlowsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class OAuthFlows extends OAuthFlowsElement {} + +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 new file mode 100644 index 0000000000..60e976415e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Operation.ts @@ -0,0 +1,85 @@ +import { + ArrayElement, + Attributes, + Meta, + ObjectElement, + StringElement, +} from '@swagger-api/apidom-core'; + +import ReferenceElement from './Reference.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(): ArrayElement | undefined { + return this.get('traits'); + } + + set traits(OperationTrait: ArrayElement | 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..4cf6a2358e --- /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..538bd54688 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationReply.ts @@ -0,0 +1,40 @@ +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 messages(): ArrayElement | undefined { + return this.get('messages'); + } + + set messages(messages: ArrayElement | undefined) { + this.set('messages', messages); + } +} + +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 new file mode 100644 index 0000000000..737286780c --- /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; 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..e61398f058 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/OperationTrait.ts @@ -0,0 +1,50 @@ +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'; + +/* eslint-disable class-methods-use-this */ + +/** + * @public + */ +class OperationTrait extends OperationTraitElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + 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'); + } + + set title(title: StringElement | undefined) { + this.set('title', title); + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { + return this.get('externalDocs'); + } + + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { + this.set('externalDocs', externalDocs); + } +} + +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..b74875f1d2 --- /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; 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..bd8285f57a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Parameter.ts @@ -0,0 +1,52 @@ +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; 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..96b55adefe --- /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; 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..0b7b10857b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Schema.ts @@ -0,0 +1,21 @@ +import { SchemaElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import ReferenceElement from './Reference.ts'; + +/** + * @public + */ +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/SecurityScheme.ts b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts new file mode 100644 index 0000000000..af0d048ede --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/SecurityScheme.ts @@ -0,0 +1,23 @@ +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); + 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..3671de7a3d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Server.ts @@ -0,0 +1,76 @@ +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'; + +import ExternalDocumentationElement from './ExternalDocumentation.ts'; +import ReferenceElement from './Reference.ts'; + +/* eslint-disable class-methods-use-this */ + +/** + * @public + */ +class Server extends ServerElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'server'; + } + + get url(): StringElement | undefined { + throw new UnsupportedOperationError('url keyword from Core vocabulary has been removed'); + } + + set url(url: StringElement | undefined) { + throw new UnsupportedOperationError('url keyword from Core vocabulary has been removed'); + } + + 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'); + } + + 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 externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined { + return this.get('externalDocs'); + } + + set externalDocs(externalDocs: ExternalDocumentationElement | ReferenceElement | undefined) { + this.set('externalDocs', externalDocs); + } +} + +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..8e18bf15ff --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/ServerBindings.ts @@ -0,0 +1,8 @@ +import { ServerBindingsElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +/** + * @public + */ +class ServerBindings extends ServerBindingsElement {} + +export default ServerBindings; 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..5174ee1d53 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Servers.ts @@ -0,0 +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 new file mode 100644 index 0000000000..07d788da17 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/Tag.ts @@ -0,0 +1,27 @@ +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'; + +/** + * @public + */ +class Tag extends TagElement { + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.element = 'tag'; + } + + get externalDocs(): ExternalDocumentationElement | ReferenceElement | undefined | any { + return this.get('externalDocs'); + } + + set externalDocs( + externalDocs: ExternalDocumentationElement | ReferenceElement | undefined | any, + ) { + 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..8efa1be72d --- /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; 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..b96603cbbe --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..133dceef58 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..0a62ad64e8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..9e99a5ea47 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp/AmqpServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..63e911d1b4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..e6e7d6f5ec --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1MessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..ae2f16b40c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1OperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..7f1e5117e1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/amqp1/Amqp1ServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..03af87cdfa --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..dd90dccb96 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..c1792c978c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..364a66d5dd --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/anypointmq/AnypointmqServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..ff434ed1fb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..0a8274aafe --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..0884c36ba9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..1294db1238 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/googlepubsub/GooglepubsubServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..154a1139e2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..066f3e184c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..4fa56acfb2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..864189da02 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/http/HttpServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..9bb33ef77a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..53b6014109 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..dbb1b9a8f8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..c2eb1d3ff7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ibmmq/IbmmqServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..3c3f8ece3b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..09ba163b6c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..3db69e93a1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..c1ac90afc3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/jms/JmsServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..d4c1490dea --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..66dc7874e9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..1ef41f691f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..8380f61880 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/kafka/KafkaServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..2b6156b78f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..42777a4885 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..08e88e4e34 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..e6d2b3e2b8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mercure/MercureServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..3d738efb81 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..04b86e4ba6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..0e19d99832 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..36aff65d36 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt/MqttServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..1f50cc4985 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..3b1676167a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5MessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..2392deaf0b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5OperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..0e78f3bf0e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/mqtt5/Mqtt5ServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..58134245a4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..99f05f0f4d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..82552e65a0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..a8dfbccf43 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/nats/NatsServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..da1bab337b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..4508d63cea --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..1aa75b3143 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..4add975537 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/pulsar/PulsarServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..66e7d3b725 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..65e08cc4c2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..5283b6863d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..d25a8aa537 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/redis/RedisServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..8cf0e96bd3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..9db00451b7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..c6c2e0c7f6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..922fabbd11 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sns/SnsServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..bc5ccdace4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..9be5f3e0e4 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..6d327a2d43 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..001188ebee --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/solace/SolaceServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..b70e5d1e63 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..a710662f97 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..205f9210c2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..abc56e95ad --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/sqs/SqsServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..d38075ea0e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..1cfac258e5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..5fba946776 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..bb53e4e583 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/stomp/StompServerBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..cd847499d6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketChannelBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..f15964ce8d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketMessageBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..9072d0774f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketOperationBinding.ts @@ -0,0 +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 new file mode 100644 index 0000000000..1bd0ff9667 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/bindings/ws/WebSocketServerBinding.ts @@ -0,0 +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/elements/nces/ChannelServers.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts new file mode 100644 index 0000000000..0b64c1848f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ChannelServers.ts @@ -0,0 +1,15 @@ +import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class ChannelServers extends ArrayElement { + static primaryClass = 'channel-servers'; + + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ChannelServers.primaryClass); + } +} + +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 new file mode 100644 index 0000000000..bbbbeef190 --- /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; 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/ComponentsOperations.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts new file mode 100644 index 0000000000..9d246719fb --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsOperations.ts @@ -0,0 +1,15 @@ +import { Attributes, Meta, ObjectElement } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class ComponentsOperations extends ObjectElement { + static primaryClass = 'components-operations'; + + constructor(content?: Record, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(ComponentsOperations.primaryClass); + } +} + +export default ComponentsOperations; 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/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/ComponentsTags.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/ComponentsTags.ts new file mode 100644 index 0000000000..73bc2481c1 --- /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; 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/OperationMessages.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationMessages.ts new file mode 100644 index 0000000000..771123a836 --- /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/OperationReplyMessages.ts b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessages.ts new file mode 100644 index 0000000000..b1909e3a6b --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/elements/nces/OperationReplyMessages.ts @@ -0,0 +1,15 @@ +import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; + +/** + * @public + */ +class OperationReplyMessages extends ArrayElement { + static primaryClass = 'operation-reply-messages'; + + constructor(content?: Array, meta?: Meta, attributes?: Attributes) { + super(content, meta, attributes); + this.classes.push(OperationReplyMessages.primaryClass); + } +} + +export default OperationReplyMessages; 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/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/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/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 new file mode 100644 index 0000000000..a529dc7e6a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/index.ts @@ -0,0 +1,173 @@ +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'; + +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 { + /** + * 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'; 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..f577e332ac --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/media-types.ts @@ -0,0 +1,45 @@ +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; + return this.filter((mediaType) => mediaType.includes(effectiveFormat)); + } + + findBy(version = '3.0.0', format: Format = 'generic') { + const search = + format === 'generic' + ? `vnd.aai.asyncapi;version=${version}` + : `vnd.aai.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; + } +} + +/** + * @public + */ +const mediaTypes = new AsyncAPIMediaTypes( + '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..73eaaf9906 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/namespace.ts @@ -0,0 +1,286 @@ +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 ChannelBindingsElement from './elements/ChannelBindings.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 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; + + base.register('asyncApi3', AsyncApi3Element); + base.register('asyncApiVersion', AsyncApiVersionElement); + base.register('channel', ChannelElement); + 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; 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..5fd35cabd5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/predicates.ts @@ -0,0 +1,282 @@ +import { createPredicate } from '@swagger-api/apidom-core'; + +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'; +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/Servers.ts'; +import ServerBindingsElement from './elements/ServerBindings.ts'; +import ServerVariableElement from './elements/ServerVariable.ts'; + +/** + * @public + */ +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 + */ +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 => + element instanceof MultiFormatSchemaElement || + (hasBasicElementProps(element) && + isElementType('multiFormatSchema', element) && + primitiveEq('object', element)); + }, +); 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..11d1444988 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/index.ts @@ -0,0 +1,46 @@ +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 = [] } = {}, +): T => { + const element = baseRefract(value); + const resolvedSpec = dereference(specification); + + /** + * 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 }); + + visit(element, rootVisitor); + + /** + * Running plugins visitors means extra single traversal === performance hit. + */ + return dispatchRefractorPlugins(rootVisitor.element, plugins, { + toolboxCreator: createToolbox, + visitorOptions: { keyMap, nodeTypeGetter: getNodeType }, + }) as T; +}; + +export const createRefractor = + (specPath: string[]) => + (value: unknown, options = {}) => + refract(value, { ...options, specPath }); + +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 new file mode 100644 index 0000000000..587f7d0263 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/plugins/replace-empty-element.ts @@ -0,0 +1,1232 @@ +import { defaultTo } from 'ramda'; +import { + ArrayElement, + ObjectElement, + StringElement, + assignSourceMap, + cloneDeep, + includesClasses, + isArrayElement, + isElement, + isMemberElement, + isStringElement, + toValue, +} from '@swagger-api/apidom-core'; +import { + ComponentsChannelBindingsElement, + ComponentsCorrelationIDsElement, + ComponentsMessageBindingsElement, + ComponentsMessageTraitsElement, + ComponentsMessagesElement, + ComponentsOperationBindingsElement, + ComponentsOperationTraitsElement, + ComponentsParametersElement, + ComponentsSecuritySchemesElement, + ComponentsServerBindingsElement, + ComponentsServerVariablesElement, + ComponentsServersElement, + MessageTraitExamplesElement, + 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 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'; +import MultiFormatSchemaElement from '../../elements/MultiFormatSchema.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'; +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 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'; +import SecuritySchemeScopesElement from '../../elements/nces/SecuritySchemeScopes.ts'; +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: string[]) { + return new AsyncApiVersionElement(...args); + }, + identifier(...args: string[]) { + return new IdentifierElement(...args); + }, + info(...args: Record[]) { + return new InfoElement(...args); + }, + servers(...args: Record[]) { + return new ServersElement(...args); + }, + defaultContentType(...args: string[]) { + return new DefaultContentTypeElement(...args); + }, + channels(...args: Record[]) { + return new ChannelsElement(...args); + }, + components(...args: Record[]) { + return new ComponentsElement(...args); + }, + operations(...args: Record[]) { + return new OperationsElement(...args); + }, + }, + + InfoElement: { + contact(...args: Record[]) { + return new ContactElement(...args); + }, + license(...args: Record[]) { + return new LicenseElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + ServersElement: { + '[key: *]': function key(...args: Record[]) { + return new ServerElement(...args); + }, + }, + + ServerElement: { + variables(...args: Record[]) { + return new ServerVariablesElement(...args); + }, + security(...args: ConstructorParameters) { + return new ServerSecurityElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: Record[]) { + return new ServerBindingsElement(...args); + }, + }, + + ServerVariableElement: { + enum(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + examples(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + }, + + ChannelsElement: { + '[key: *]': function key(...args: Record[]) { + return new ChannelElement(...args); + }, + }, + + ChannelElement: { + servers(...args: ConstructorParameters) { + return new ChannelServersElement(...args); + }, + parameters(...args: Record[]) { + return new ParametersElement(...args); + }, + messages(...args: Record[]) { + return new MessagesElement(...args); + }, + bindings(...args: Record[]) { + return new ChannelBindingsElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + MessagesElement: { + '[key: *]': function key(...args: Record[]) { + return new MessageElement(...args); + }, + }, + + OperationsElement: { + '[key: *]': function key(...args: Record[]) { + return new OperationElement(...args); + }, + }, + + OperationElement: { + channel(...args: Record[]) { + return new ReferenceElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: Record[]) { + return new OperationBindingsElement(...args); + }, + traits(...args: ConstructorParameters) { + return new OperationTraitsElement(...args); + }, + security(...args: ConstructorParameters) { + return new OperationSecurityElement(...args); + }, + messages(...args: ConstructorParameters) { + return new OperationMessagesElement(...args); + }, + reply(...args: Record[]) { + return new OperationReplyElement(...args); + }, + }, + + OperationTraitElement: { + security(...args: ConstructorParameters) { + return new OperationTraitSecurityElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: Record[]) { + return new OperationBindingsElement(...args); + }, + }, + + OperationReplyElement: { + address(...args: Record[]) { + return new OperationReplyAddressElement(...args); + }, + channel(...args: Record[]) { + return new ReferenceElement(...args); + }, + messages(...args: ConstructorParameters) { + return new OperationReplyMessagesElement(...args); + }, + }, + + ParametersElement: { + '[key: *]': function key(...args: unknown[]) { + return new ParameterElement(...args); + }, + }, + + ParameterElement: { + enum(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + examples(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + }, + + ServerBindingsElement: { + http(...args: Record[]) { + return new HttpServerBindingElement(...args); + }, + ws(...args: Record[]) { + return new WebSocketServerBindingElement(...args); + }, + kafka(...args: Record[]) { + return new KafkaServerBindingElement(...args); + }, + anypointmq(...args: Record[]) { + return new AnypointmqServerBindingElement(...args); + }, + amqp(...args: Record[]) { + return new AmqpServerBindingElement(...args); + }, + amqp1(...args: Record[]) { + return new Amqp1ServerBindingElement(...args); + }, + mqtt(...args: Record[]) { + return new MqttServerBindingElement(...args); + }, + mqtt5(...args: Record[]) { + return new Mqtt5ServerBindingElement(...args); + }, + nats(...args: Record[]) { + return new NatsServerBindingElement(...args); + }, + jms(...args: Record[]) { + return new JmsServerBindingElement(...args); + }, + sns(...args: Record[]) { + return new SnsServerBindingElement(...args); + }, + solace(...args: Record[]) { + return new SolaceServerBindingElement(...args); + }, + sqs(...args: Record[]) { + return new SqsServerBindingElement(...args); + }, + stomp(...args: Record[]) { + return new StompServerBindingElement(...args); + }, + redis(...args: Record[]) { + return new RedisServerBindingElement(...args); + }, + mercure(...args: Record[]) { + return new MercureServerBindingElement(...args); + }, + ibmmq(...args: Record[]) { + return new IbmmqServerBindingElement(...args); + }, + googlepubsub(...args: Record[]) { + return new GooglepubsubServerBindingElement(...args); + }, + pulsar(...args: Record[]) { + return new PulsarServerBindingElement(...args); + }, + }, + + ChannelBindingsElement: { + http(...args: Record[]) { + return new HttpChannelBindingElement(...args); + }, + ws(...args: Record[]) { + return new WebSocketChannelBindingElement(...args); + }, + kafka(...args: Record[]) { + return new KafkaChannelBindingElement(...args); + }, + anypointmq(...args: Record[]) { + return new AnypointmqChannelBindingElement(...args); + }, + amqp(...args: Record[]) { + return new AmqpChannelBindingElement(...args); + }, + amqp1(...args: Record[]) { + return new Amqp1ChannelBindingElement(...args); + }, + mqtt(...args: Record[]) { + return new MqttChannelBindingElement(...args); + }, + mqtt5(...args: Record[]) { + return new Mqtt5ChannelBindingElement(...args); + }, + nats(...args: Record[]) { + return new NatsChannelBindingElement(...args); + }, + jms(...args: Record[]) { + return new JmsChannelBindingElement(...args); + }, + sns(...args: Record[]) { + return new SnsChannelBindingElement(...args); + }, + solace(...args: Record[]) { + return new SolaceChannelBindingElement(...args); + }, + sqs(...args: Record[]) { + return new SqsChannelBindingElement(...args); + }, + stomp(...args: Record[]) { + return new StompChannelBindingElement(...args); + }, + redis(...args: Record[]) { + return new RedisChannelBindingElement(...args); + }, + mercure(...args: Record[]) { + return new MercureChannelBindingElement(...args); + }, + ibmmq(...args: Record[]) { + return new IbmmqChannelBindingElement(...args); + }, + googlepubsub(...args: Record[]) { + return new GooglepubsubChannelBindingElement(...args); + }, + pulsar(...args: Record[]) { + return new PulsarChannelBindingElement(...args); + }, + }, + + OperationBindingsElement: { + http(...args: Record[]) { + return new HttpOperationBindingElement(...args); + }, + ws(...args: Record[]) { + return new WebSocketOperationBindingElement(...args); + }, + kafka(...args: Record[]) { + return new KafkaOperationBindingElement(...args); + }, + anypointmq(...args: Record[]) { + return new AnypointmqOperationBindingElement(...args); + }, + amqp(...args: Record[]) { + return new AmqpOperationBindingElement(...args); + }, + amqp1(...args: Record[]) { + return new Amqp1OperationBindingElement(...args); + }, + mqtt(...args: Record[]) { + return new MqttOperationBindingElement(...args); + }, + mqtt5(...args: Record[]) { + return new Mqtt5OperationBindingElement(...args); + }, + nats(...args: Record[]) { + return new NatsOperationBindingElement(...args); + }, + jms(...args: Record[]) { + return new JmsOperationBindingElement(...args); + }, + sns(...args: Record[]) { + return new SnsOperationBindingElement(...args); + }, + solace(...args: Record[]) { + return new SolaceOperationBindingElement(...args); + }, + sqs(...args: Record[]) { + return new SqsOperationBindingElement(...args); + }, + stomp(...args: Record[]) { + return new StompOperationBindingElement(...args); + }, + redis(...args: Record[]) { + return new RedisOperationBindingElement(...args); + }, + mercure(...args: Record[]) { + return new MercureOperationBindingElement(...args); + }, + googlepubsub(...args: Record[]) { + return new GooglepubsubOperationBindingElement(...args); + }, + ibmmq(...args: Record[]) { + return new IbmmqOperationBindingElement(...args); + }, + pulsar(...args: Record[]) { + return new PulsarOperationBindingElement(...args); + }, + }, + + MessageBindingsElement: { + http(...args: Record[]) { + return new HttpMessageBindingElement(...args); + }, + ws(...args: Record[]) { + return new WebSocketMessageBindingElement(...args); + }, + kafka(...args: Record[]) { + return new KafkaMessageBindingElement(...args); + }, + anypointmq(...args: Record[]) { + return new AnypointmqMessageBindingElement(...args); + }, + amqp(...args: Record[]) { + return new AmqpMessageBindingElement(...args); + }, + amqp1(...args: Record[]) { + return new Amqp1MessageBindingElement(...args); + }, + mqtt(...args: Record[]) { + return new MqttMessageBindingElement(...args); + }, + mqtt5(...args: Record[]) { + return new Mqtt5MessageBindingElement(...args); + }, + nats(...args: Record[]) { + return new NatsMessageBindingElement(...args); + }, + jms(...args: Record[]) { + return new JmsMessageBindingElement(...args); + }, + sns(...args: Record[]) { + return new SnsMessageBindingElement(...args); + }, + solace(...args: Record[]) { + return new SolaceMessageBindingElement(...args); + }, + sqs(...args: Record[]) { + return new SqsMessageBindingElement(...args); + }, + stomp(...args: Record[]) { + return new StompMessageBindingElement(...args); + }, + redis(...args: Record[]) { + return new RedisMessageBindingElement(...args); + }, + mercure(...args: Record[]) { + return new MercureMessageBindingElement(...args); + }, + ibmmq(...args: Record[]) { + return new IbmmqMessageBindingElement(...args); + }, + googlepubsub(...args: Record[]) { + return new GooglepubsubMessageBindingElement(...args); + }, + pulsar(...args: Record[]) { + return new PulsarMessageBindingElement(...args); + }, + }, + + MessageElement: { + headers(...args: Record[]) { + return new SchemaElement(...args); + }, + correlationId(...args: Record[]) { + return new CorrelationIDElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: Record[]) { + return new MessageBindingsElement(...args); + }, + examples(...args: ConstructorParameters) { + return new MessageExamplesElement(...args); + }, + traits(...args: ConstructorParameters) { + return new MessageTraitsElement(...args); + }, + payload(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + MessageTraitElement: { + headers(...args: Record[]) { + return new SchemaElement(...args); + }, + correlationId(...args: Record[]) { + return new CorrelationIDElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + bindings(...args: Record[]) { + return new MessageBindingsElement(...args); + }, + examples(...args: ConstructorParameters) { + return new MessageExamplesElement(...args); + }, + }, + + MessageExampleElement: { + headers(...args: Record[]) { + return new ObjectElement(...args); + }, + }, + + TagsElement: { + '<*>': function asterisk(...args: Record[]) { + return new TagElement(...args); + }, + }, + + TagElement: { + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + ComponentsElement: { + schemas(...args: Record[]) { + return new ComponentsSchemasElement(...args); + }, + servers(...args: Record[]) { + return new ComponentsServersElement(...args); + }, + serverVariables(...args: Record[]) { + return new ComponentsServerVariablesElement(...args); + }, + messages(...args: Record[]) { + return new ComponentsMessagesElement(...args); + }, + securitySchemes(...args: Record[]) { + return new ComponentsSecuritySchemesElement(...args); + }, + parameters(...args: Record[]) { + return new ComponentsParametersElement(...args); + }, + correlationIds(...args: Record[]) { + return new ComponentsCorrelationIDsElement(...args); + }, + operationTraits(...args: Record[]) { + return new ComponentsOperationTraitsElement(...args); + }, + messageTraits(...args: Record[]) { + return new ComponentsMessageTraitsElement(...args); + }, + serverBindings(...args: Record[]) { + return new ComponentsServerBindingsElement(...args); + }, + channelBindings(...args: Record[]) { + return new ComponentsChannelBindingsElement(...args); + }, + operationBindings(...args: Record[]) { + return new ComponentsOperationBindingsElement(...args); + }, + messageBindings(...args: Record[]) { + return new ComponentsMessageBindingsElement(...args); + }, + operations(...args: Record[]) { + return new ComponentsOperationsElement(...args); + }, + replies(...args: Record[]) { + return new OperationReplyElement(...args); + }, + replyAddresses(...args: Record[]) { + return new OperationReplyAddressElement(...args); + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + tags(...args: ConstructorParameters) { + return new TagsElement(...args); + }, + }, + + 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); + element.classes.push('json-schema-allOf'); + return element; + }, + anyOf(...args: ConstructorParameters) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-anyOf'); + return element; + }, + oneOf(...args: ConstructorParameters) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-oneOf'); + return element; + }, + not(...args: Record[]) { + return new SchemaElement(...args); + }, + if(...args: Record[]) { + return new SchemaElement(...args); + }, + then(...args: Record[]) { + return new SchemaElement(...args); + }, + else(...args: Record[]) { + return new SchemaElement(...args); + }, + enum(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + items(...args: Record[]) { + return new SchemaElement(...args); + }, + additionalItems(...args: Record[]) { + return new SchemaElement(...args); + }, + contains(...args: Record[]) { + return new SchemaElement(...args); + }, + required(...args: ConstructorParameters) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-required'); + return element; + }, + properties(...args: Record[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-properties'); + return element; + }, + patternProperties(...args: Record[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-patternProperties'); + return element; + }, + additionalProperties(...args: Record[]) { + return new SchemaElement(...args); + }, + dependencies(...args: Record[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-dependencies'); + return element; + }, + propertyNames(...args: Record[]) { + return new SchemaElement(...args); + }, + examples(...args: ConstructorParameters) { + const element = new ArrayElement(...args); + element.classes.push('json-schema-examples'); + return element; + }, + definitions(...args: Record[]) { + const element = new ObjectElement(...args); + element.classes.push('json-schema-definitions'); + return element; + }, + externalDocs(...args: Record[]) { + return new ExternalDocumentationElement(...args); + }, + }, + + SecuritySchemeElement: { + flows(...args: Record[]) { + return new OAuthFlowsElement(...args); + }, + scopes(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + }, + + OAuthFlowsElement: { + implicit(...args: Record[]) { + return new OAuthFlowElement(...args); + }, + password(...args: Record[]) { + return new OAuthFlowElement(...args); + }, + clientCredentials(...args: Record[]) { + return new OAuthFlowElement(...args); + }, + authorizationCode(...args: Record[]) { + return new OAuthFlowElement(...args); + }, + }, + + OAuthFlowElement: { + availableScopes(...args: ConstructorParameters) { + return new SecuritySchemeScopesElement(...args); + }, + }, + + HttpOperationBindingElement: { + query(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + HttpMessageBindingElement: { + headers(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + WebSocketChannelBindingElement: { + query(...args: Record[]) { + return new SchemaElement(...args); + }, + headers(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + KafkaOperationBindingElement: { + groupId(...args: Record[]) { + return new SchemaElement(...args); + }, + clientId(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + KafkaMessageBindingElement: { + key(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + AnypointmqMessageBindingElement: { + headers(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + AmqpChannelBindingElement: { + exchange(...args: Record[]) { + return new ObjectElement(...args); + }, + queue(...args: Record[]) { + return new ObjectElement(...args); + }, + }, + + AmqpOperationBindingElement: { + cc(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + bcc(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + }, + + IbmmqChannelBindingElement: { + queue(...args: Record[]) { + return new ObjectElement(...args); + }, + topic(...args: Record[]) { + return new ObjectElement(...args); + }, + }, + + MqttServerBindingElement: { + lastWill(...args: Record[]) { + return new ObjectElement(...args); + }, + }, + + SolaceOperationBindingElement: { + destinations(...args: ConstructorParameters) { + return new ArrayElement(...args); + }, + }, + + GooglepubsubChannelBindingElement: { + labels(...args: Record[]) { + return new ObjectElement(...args); + }, + messageStoragePolicy(...args: Record[]) { + return new ObjectElement(...args); + }, + schemaSettings(...args: Record[]) { + return new ObjectElement(...args); + }, + }, + + GooglepubsubMessageBindingElement: { + attributes(...args: Record[]) { + return new ObjectElement(...args); + }, + schema(...args: Record[]) { + return new ObjectElement(...args); + }, + }, + + PulsarChannelBindingElement: { + 'geo-replication': function geoReplication( + ...args: ConstructorParameters + ) { + return new ArrayElement(...args); + }, + retention(...args: Record[]) { + return new ObjectElement(...args); + }, + }, + + [ComponentsSchemasElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + [ComponentsServersElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new ServerElement(...args); + }, + }, + + [ComponentsServerVariablesElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new ServerVariableElement(...args); + }, + }, + + [ComponentsMessagesElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new MessageElement(...args); + }, + }, + + [ComponentsSecuritySchemesElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new SecuritySchemeElement(...args); + }, + }, + + [ComponentsParametersElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new ParameterElement(...args); + }, + }, + + [ComponentsCorrelationIDsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new CorrelationIDElement(...args); + }, + }, + + [ComponentsOperationTraitsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new OperationTraitElement(...args); + }, + }, + + [ComponentsMessageTraitsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new MessageTraitElement(...args); + }, + }, + + [ComponentsServerBindingsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new ServerBindingsElement(...args); + }, + }, + + [ComponentsChannelBindingsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new ChannelBindingsElement(...args); + }, + }, + + [ComponentsOperationBindingsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new OperationBindingsElement(...args); + }, + }, + + [ComponentsOperationsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new OperationBindingsElement(...args); + }, + }, + + [ComponentsMessageBindingsElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new MessageBindingsElement(...args); + }, + }, + + [ComponentsOperationsElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new OperationElement(...args); + }, + }, + + [ServerVariablesElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new ServerVariableElement(...args); + }, + }, + + [ServerSecurityElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new SecuritySchemeElement(...args); + }, + }, + + [OperationTraitsElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new OperationTraitElement(...args); + }, + }, + + [OperationSecurityElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new SecuritySchemeElement(...args); + }, + }, + + [OperationMessagesElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new ReferenceElement(...args); + }, + }, + + [OperationReplyMessagesElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new ReferenceElement(...args); + }, + }, + + [MessageExamplesElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new MessageExampleElement(...args); + }, + }, + + [MessageTraitsElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new MessageTraitElement(...args); + }, + }, + + [MessageTraitExamplesElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new MessageExampleElement(...args); + }, + }, + + [ChannelServersElement.primaryClass]: { + '<*>': function asterisk(...args: Record[]) { + return new ReferenceElement(...args); + }, + }, + + [ComponentsRepliesElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new OperationReplyElement(...args); + }, + }, + + [ComponentsReplyAddressesElement.primaryClass]: { + '[key: *]': function key(...args: Record[]) { + return new OperationReplyAddressElement(...args); + }, + }, + + 'json-schema-properties': { + '[key: *]': function key(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + 'json-schema-allOf': { + '<*>': function asterisk(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + 'json-schema-anyOf': { + '<*>': function asterisk(...args: Record[]) { + return new SchemaElement(...args); + }, + }, + + 'json-schema-oneOf': { + '<*>': function asterisk(...args: Record[]) { + return new SchemaElement(...args); + }, + }, +}; + +const findElementFactory = (ancestor: any, keyName: string) => { + const elementType = getNodeType(ancestor); + 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]; +}; + +/** + * @public + */ +const plugin = () => () => ({ + visitor: { + StringElement( + element: StringElement, + key: unknown, + parent: unknown, + path: unknown, + ancestors: Record[] | unknown[], + ) { + if (!isEmptyElement(element)) return undefined; + + const lineage = [...ancestors, parent].filter(isElement); + const parentElement = lineage.at(-1); + let elementFactory; + let context; + + if (isArrayElement(parentElement)) { + context = element; + elementFactory = findElementFactory(parentElement, '<*>'); + } else if (isMemberElement(parentElement)) { + context = lineage.at(-2); + 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; 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..a46bee4cfd --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/predicates.ts @@ -0,0 +1,52 @@ +import { startsWith } from 'ramda'; +import { + MemberElement, + ObjectElement, + isObjectElement, + 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')); +}; + +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 + */ +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/registration.ts b/packages/apidom-ns-asyncapi-3/src/refractor/registration.ts new file mode 100644 index 0000000000..9d1acf17f6 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/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, +}; 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..b1934ed94d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/specification.ts @@ -0,0 +1,1467 @@ +import { specificationObj as AsyncApi2_0Specification } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AsyncApi3Visitor from './visitors/async-api-3/index.ts'; +import AsyncApiVersionVisitor from './visitors/async-api-3/AsyncApiVersionVisitor.ts'; +import ChanneBindingsVisitor from './visitors/async-api-3/channel/BindingsVisitor.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 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 './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-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'; +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'; +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 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'; +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 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'; +import TagVisitor from './visitors/async-api-3/tag/index.ts'; +import TagsVisitor from './visitors/async-api-3/tags/index.ts'; +import schemaInheritedFixedFields from './visitors/async-api-3/schema/inherited-fixed-fields.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'; + +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: { + value: FallbackVisitor, + document: { + objects: { + /** + * `AsyncApi 3.0.0` specification elements. + */ + AsyncApi: { + $visitor: AsyncApi3Visitor, + fixedFields: { + 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: { + $ref: '#/visitors/document/objects/DefaultContentType', + }, + channels: { $ref: '#/visitors/document/objects/Channels' }, + operations: { $ref: '#/visitors/document/objects/Operations' }, + components: { $ref: '#/visitors/document/objects/Components' }, + }, + }, + AsyncApiVersion: { + $visitor: AsyncApiVersionVisitor, + }, + Identifier: { + $visitor: IdentifierVisitor, + }, + Info: { + $visitor: InfoVisitor, + fixedFields: { + 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, + contact: { $ref: '#/visitors/document/objects/Contact' }, + license: { $ref: '#/visitors/document/objects/License' }, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + externalDocs: ExternalDocumentationOrReferenceVisitor, + }, + }, + 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, + }, + }, + License: { + $visitor: LicenseVisitor, + fixedFields: { + name: AsyncApi2_0Specification.visitors.document.objects.License.fixedFields.name, + url: AsyncApi2_0Specification.visitors.document.objects.License.fixedFields.url, + }, + }, + Servers: { + $visitor: ServersVisitor, + }, + Server: { + $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, + pathname: { $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: ServerSecurityVisitor, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + externalDocs: ExternalDocumentationOrReferenceVisitor, + 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, + }, + }, + DefaultContentType: { + $visitor: DefaultContentTypeVisitor, + }, + Channels: { + $visitor: ChannelsVisitor, + }, + Channel: { + $visitor: ChannelVisitor, + fixedFields: { + address: { $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/objects/Parameters' }, + tags: { $ref: '#/visitors/document/objects/Tags' }, + externalDocs: ExternalDocumentationOrReferenceVisitor, + bindings: ChanneBindingsVisitor, + }, + }, + ChannelAddressExpressions: { + $visitor: ChannelAddressExpressionsVisitor, + }, + Messages: { + $visitor: MessagesVisitor, + }, + Operations: { + $visitor: OperationsVisitor, + }, + Operation: { + $visitor: OperationVisitor, + fixedFields: { + action: { $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: ExternalDocumentationOrReferenceVisitor, + bindings: OperationBindingsVisitor_, + traits: OperationTraitsVisitor, + messages: OperationMessagesVisitor, + reply: OperationReplyVisitor_, + }, + }, + OperationTrait: { + $visitor: 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: OperationSecurityVisitor, + tags: { + $ref: '#/visitors/document/objects/Tags', + }, + externalDocs: ExternalDocumentationOrReferenceVisitor, + bindings: + AsyncApi2_0Specification.visitors.document.objects.OperationTrait.fixedFields + .bindings, + }, + }, + OperationReply: { + $visitor: OperationReplyVisitor, + fixedFields: { + address: OperationReplyAddressVisitor_, + channel: OperationChannelVisitor, + messages: OperationReplyMessagesVisitor, + }, + }, + OperationReplyAddress: { + $visitor: OperationReplyAddressVisitor, + fixedFields: { + description: { $ref: '#/visitors/value' }, + location: { $ref: '#/visitors/value' }, + }, + }, + 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/value' }, + }, + }, + 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, + 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: { + 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', + }, + }, + }, + Message: { + $visitor: MessageVisitor, + fixedFields: { + headers: MessageHeadersVisitor, + payload: MessagePayloadVisitor, + correlationId: MessageCorrelationIdVisitor, + contetType: { $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: ExternalDocumentationOrReferenceVisitor, + bindings: MessageBindingsVisitor_, + examples: MessageExamplesVisitor, + traits: MessageTraitsVisitor, + }, + }, + MessageTrait: { + $visitor: MessageTraitVisitor, + fixedFields: { + messageId: { $ref: '#/visitors/value' }, + 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, + 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', + }, + externalDocs: ExternalDocumentationOrReferenceVisitor, + 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, + }, + }, + Tags: { + $visitor: TagsVisitor, + }, + Tag: { + $visitor: TagVisitor, + fixedFields: { + name: { $ref: '#/visitors/value' }, + description: { $ref: '#/visitors/value' }, + externalDocs: ExternalDocumentationOrReferenceVisitor, + }, + }, + ExternalDocumentation: { + $visitor: ExternalDocumentationVisitor, + fixedFields: { + description: + AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation.fixedFields + .description, + url: AsyncApi2_0Specification.visitors.document.objects.ExternalDocumentation + .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: { + schemas: ComponentsSchemasVisitor, + servers: + AsyncApi2_0Specification.visitors.document.objects.Components.fixedFields.servers, + 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: 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, + }, + }, + MultiFormatSchema: { + $visitor: MultiFormatSchemaVisitor, + fixedFields: { + schemaFormat: { $ref: '#/visitors/value' }, + schema: { $ref: '#/visitors/value' }, + }, + }, + JSONSchema: SchemaSpecification, + 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: { + 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: + 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, + }, + }, + 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, + }, + }, + }, + }, + }, + }, +}; + +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..c45ded0a62 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/toolbox.ts @@ -0,0 +1,13 @@ +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/FallbackVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts new file mode 100644 index 0000000000..1635895097 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/FallbackVisitor.ts @@ -0,0 +1,23 @@ +import { Element, BREAK, cloneDeep } from '@swagger-api/apidom-core'; + +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); + return BREAK; + } +} + +export default FallbackVisitor; 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 new file mode 100644 index 0000000000..ad6c7c2450 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/Visitor.ts @@ -0,0 +1,34 @@ +import { Element, ObjectElement, deepmerge, hasElementSourceMap } from '@swagger-api/apidom-core'; + +/** + * @public + */ +export interface VisitorOptions {} + +/** + * @public + */ +class Visitor { + public element!: Element; + + constructor(options: VisitorOptions) { + Object.assign(this, options); + } + + /* 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/DefaultContentTypeVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/DefaultContentTypeVisitor.ts new file mode 100644 index 0000000000..f0f8182e96 --- /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; 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/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..c2cb405e15 --- /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; 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..0bf4dbaaac --- /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 '@swagger-api/apidom-ns-asyncapi-2'; + +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.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-address-expressions/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expressions/index.ts new file mode 100644 index 0000000000..9bb10728f8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel-address-expressions/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 '../../../predicates.ts'; + +/** + * @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/channel/BindingsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/BindingsVisitor.ts new file mode 100644 index 0000000000..849275dda2 --- /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 { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement } from '../../../predicates.ts'; + +/** + * @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/ServersVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts new file mode 100644 index 0000000000..3793e6c4e5 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/ServersVisitor.ts @@ -0,0 +1,45 @@ +import { Mixin } from 'ts-mixer'; +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'; + +/** + * @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): void => { + const specPath = ['document', 'objects', 'Reference']; + const element = this.toRefractedElement(specPath, item); + + if (isReferenceElement(element)) { + element.setMetaProperty('referenced-element', 'channel-servers'); + } + + 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..6f5f000627 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channel/index.ts @@ -0,0 +1,29 @@ +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'; + +/** + * @public + */ +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; 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..d0ea5e7ef0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/channels/index.ts @@ -0,0 +1,49 @@ +import { Mixin } from 'ts-mixer'; +import { ObjectElement } from '@swagger-api/apidom-core'; + +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import ChannelsElement from '../../../../elements/Channels.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; +import { isReferenceLikeElement } from '../../../predicates.ts'; + +/** + * @public + */ +export interface ChannelsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class ChannelsVisitor extends Mixin(MapVisitor, 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.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Channel']; + this.canSupportSpecificationExtensions = false; + } + + 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; 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..2ed57337e7 --- /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; 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..8f7a7a757e --- /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; 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..2640a2b54e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/OperationsVisitor.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 ComponentsOperationsElement from '../../../../elements/nces/ComponentsOperations.ts'; +import MapVisitor, { MapVisitorOptions, SpecPath } from '../../generics/MapVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface OperationsVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +class OperationsVisitor extends Mixin(MapVisitor, FallbackVisitor) { + declare public readonly element: ComponentsOperationsElement; + + declare protected readonly specPath: SpecPath< + ['document', 'objects', 'Reference'] | ['document', 'objects', 'Operation'] + >; + + constructor(options: OperationsVisitorOptions) { + super(options); + this.element = new ComponentsOperationsElement(); + this.specPath = (element: unknown) => + isReferenceLikeElement(element) + ? ['document', 'objects', 'Reference'] + : ['document', 'objects', 'Operation']; + } + + 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'); + }); + + return result; + } +} + +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 new file mode 100644 index 0000000000..2161e983ca --- /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; 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..866d9671eb --- /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; 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..3525263ca2 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/SchemasVisitor.ts @@ -0,0 +1,60 @@ +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 { isMultiFormatSchemaElement, isReferenceElement } from '../../../../predicates.ts'; +import { isMultiFormatSchemaLikeElement } 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'] + : isMultiFormatSchemaLikeElement(element) + ? ['document', 'objects', 'MultiFormatSchema'] + : ['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'); + }); + + this.element + .filter(isMultiFormatSchemaElement) + // @ts-ignore + .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/TagsVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/TagsVisitor.ts new file mode 100644 index 0000000000..97872a55af --- /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; 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..59363259df --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/components/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class ComponentsVisitor extends BaseComponentsVisitor { + declare public readonly element: ComponentsElement; + + constructor(options: ComponentsVisitorOptions) { + super(options); + this.element = new ComponentsElement(); + } +} + +export default ComponentsVisitor; 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/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..9355dcdd19 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/correlation-id/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class CorrelationIDVisitor extends BaseCorrelationIDVisitor { + declare public readonly element: CorrelationIDElement; + + constructor(options: CorrelationIDVisitorOptions) { + super(options); + this.element = new CorrelationIDElement(); + } +} + +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 new file mode 100644 index 0000000000..9571ed5c54 --- /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; 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..63c8d26fd0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/external-documentation-object/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class ExternalDocumentationVisitor extends BaseExternalDocumentationVisitor { + declare public readonly element: ExternalDocumentationElement; + + constructor(options: ExternalDocumentationVisitorOptions) { + super(options); + this.element = new ExternalDocumentationElement(); + } +} + +export default ExternalDocumentationVisitor; 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/info.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts new file mode 100644 index 0000000000..120b86558f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/info/info.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class InfoVisitor extends BaseInfoVisitor { + declare public readonly element: InfoElement; + + constructor(options: InfoVisitorOptions) { + super(options); + this.element = new InfoElement(); + } +} + +export default InfoVisitor; 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; 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..a186ba4759 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-bindings/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class MessageBindingsVisitor extends BaseMessageBindingsVisitor { + declare public readonly element: MessageBindingsElement; + + constructor(options: MessageBindingsVisitorOptions) { + super(options); + this.element = new MessageBindingsElement(); + } +} + +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 new file mode 100644 index 0000000000..1023c8f65c --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-example/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class MessageExampleVisitor extends BaseMessageExampleVisitor { + declare public readonly element: MessageExampleElement; + + constructor(options: MessageExampleVisitorOptions) { + super(options); + this.element = new MessageExampleElement(); + } +} + +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 new file mode 100644 index 0000000000..b3726803ec --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/HeadersVisitor.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 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: 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-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 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 new file mode 100644 index 0000000000..39dc3bb5d8 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message-trait/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class MessageTraitVisitor extends BaseMessageTraitVisitor { + declare public readonly element: MessageTraitElement; + + constructor(options: MessageTraitVisitorOptions) { + super(options); + this.element = new MessageTraitElement(); + } +} + +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 new file mode 100644 index 0000000000..f2a753474f --- /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 { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement } from '../../../predicates.ts'; + +/** + * @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..43d3265065 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/CorrelationIdVisitor.ts @@ -0,0 +1,42 @@ +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 { isReferenceLikeElement } from '../../../predicates.ts'; + +/** + * @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..b3726803ec --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/HeadersVisitor.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 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: 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-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 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 new file mode 100644 index 0000000000..d2fffc6000 --- /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; 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..6d3393dff3 --- /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 '../../../predicates.ts'; + +/** + * @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..659f1648b0 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/message/index.ts @@ -0,0 +1,34 @@ +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import MessageElement from '../../../../elements/Message.ts'; +import FixedFieldsVisitor, { + FixedFieldsVisitorOptions, + SpecPath, +} from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @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; + } +} + +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..b050803ba9 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/messages/index.ts @@ -0,0 +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 PatternedFieldsVisitor, { + PatternedFieldsVisitorOptions, + SpecPath, +} from '../../generics/PatternedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import MessagesElement from '../../../../elements/Messages.ts'; +import ReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; + +/** + * @public + */ +export interface MessagesVisitorOptions + extends PatternedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class MessagesVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { + declare public readonly element: MessagesElement; + + 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.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; + } +} + +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 new file mode 100644 index 0000000000..ebefd3234e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/multiFormatSchema/index.ts @@ -0,0 +1,64 @@ +import { Mixin } from 'ts-mixer'; +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, { + FixedFieldsVisitorOptions, + SpecPath, +} 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 {} + +/** + * @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.element = new MultiFormatSchemaElement(); + this.specPath = always(['document', 'objects', 'MultiFormatSchema']); + this.canSupportSpecificationExtensions = true; + } + + ObjectElement(objectElement: ObjectElement) { + const result = FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement); + const schema = this.element.get('schema'); + const schemaFormat = defaultTo(mediaTypes.latest(), toValue(objectElement.get('schemaFormat'))); + + 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; 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..0b4d8acd6c --- /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..0d757620c0 --- /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-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..e20bb8f723 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-bindings/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class OperationBindingsVisitor extends BaseOperationBindingsVisitor { + declare public readonly element: OperationBindingsElement; + + constructor(options: OperationBindingsVisitorOptions) { + super(options); + this.element = new OperationBindingsElement(); + } +} + +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 new file mode 100644 index 0000000000..8a340aade1 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply-address/index.ts @@ -0,0 +1,23 @@ +// filepath: packages/apidom-ns-asyncapi-3/src/refractor/visitors/operation/OperationReplyAddressVisitor.ts +import { Mixin } from 'ts-mixer'; +import { always } from 'ramda'; + +import OperationReplyAddressElement from '../../../../elements/OperationReplyAddress.ts'; +import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor.ts'; +import FallbackVisitor from '../../FallbackVisitor.ts'; + +/** + * @public + */ +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; 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..05f3ad8b86 --- /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 { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement } from '../../../predicates.ts'; + +/** + * @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..3965c93b81 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/MessagesVisitor.ts @@ -0,0 +1,45 @@ +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/OperationReplyMessages.ts'; +import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; + +/** + * @public + */ +export interface MessagesVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +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-message'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +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 new file mode 100644 index 0000000000..dac8e3a09f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-reply/index.ts @@ -0,0 +1,30 @@ +// 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'; + +/** + * @public + */ +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; 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..19be0ba27a --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation-trait/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class OperationTraitVisitor extends BaseOperationTraitVisitor { + declare public readonly element: OperationTraitElement; + + constructor(options: OperationTraitVisitorOptions) { + super(options); + this.element = new OperationTraitElement(); + } +} + +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 new file mode 100644 index 0000000000..3b3a3a597b --- /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 { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement } from '../../../predicates.ts'; + +/** + * @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/ChannelVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/ChannelVisitor.ts new file mode 100644 index 0000000000..3957536b36 --- /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; 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..8fc1b6995e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/MessagesVisitor.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 OperationMessagesElement from '../../../../elements/nces/OperationMessages.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; + +/** + * @public + */ +export interface OperationMessagesVisitorOptions + 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: OperationMessagesVisitorOptions) { + 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-message'); + } + + this.element.push(element); + }); + + this.copyMetaAndAttributes(arrayElement, this.element); + + return BREAK; + } +} + +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 new file mode 100644 index 0000000000..d9eda39add --- /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 { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import AlternatingVisitor, { + AlternatingVisitorOptions, +} from '../../generics/AlternatingVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import { isReferenceLikeElement } from '../../../predicates.ts'; + +/** + * @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..02bf57f169 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/SecurityVisitor.ts @@ -0,0 +1,47 @@ +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 '../../../predicates.ts'; + +/** + * @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..f022649898 --- /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 '../../../predicates.ts'; + +/** + * @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/operation/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts new file mode 100644 index 0000000000..e9b39f3fda --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operation/index.ts @@ -0,0 +1,41 @@ +import { Mixin } from 'ts-mixer'; +import { isStringElement, ObjectElement } from '@swagger-api/apidom-core'; +import { always } from 'ramda'; + +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; + + 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); + + const action = objectElement.get('action'); + + if (isStringElement(action)) { + const actionValue = action.toValue(); + if (actionValue === 'send' || actionValue === 'receive') { + this.element.setMetaProperty('operation-action', actionValue); + } + } + + return result; + } +} + +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 new file mode 100644 index 0000000000..af619f741e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/operations/index.ts @@ -0,0 +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 PatternedFieldsVisitor, { + PatternedFieldsVisitorOptions, + SpecPath, +} from '../../generics/PatternedFieldsVisitor.ts'; +import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts'; +import OperationsElement from '../../../../elements/Operations.ts'; +import ReferenceElement from '../../../../elements/Reference.ts'; +import { isReferenceElement } from '../../../../predicates.ts'; + +/** + * @public + */ +export interface OperationsVisitorOptions + extends PatternedFieldsVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +class OperationsVisitor extends Mixin(PatternedFieldsVisitor, FallbackVisitor) { + declare public readonly element: OperationsElement; + + 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.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; 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..7627e9f322 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/parameters/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +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/reference/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/reference/index.ts new file mode 100644 index 0000000000..64caddb30a --- /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/SchemaOrReferenceVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts new file mode 100644 index 0000000000..73b3f4696f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/SchemaOrReferenceVisitor.ts @@ -0,0 +1,38 @@ +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 { isReferenceElement } from '@swagger-api/apidom-ns-asyncapi-2'; + +import SchemaElement from '../../../../elements/Schema.ts'; +import JSONReferenceElement from '../../../../elements/Reference.ts'; + +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/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts new file mode 100644 index 0000000000..5fc3765526 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/schema/index.ts @@ -0,0 +1,34 @@ +import { ObjectElement } from '@swagger-api/apidom-core'; +import { + specificationObj as AsyncApi2Specification, + SchemaVisitorOptions, + SchemaVisitor as SchemaVisitorType, +} 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; + +export type { SchemaVisitorOptions }; + +/** + * @public + */ +class SchemaVisitor extends BaseSchemaVisitor { + 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; 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..a693b4c8f8 --- /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; 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..fc4485a66f --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/ScopesVisitor.ts @@ -0,0 +1,41 @@ +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/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..9d12933ab3 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/security-scheme/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class SecuritySchemeVisitor extends BaseSecuritySchemeVisitor { + declare public readonly element: SecuritySchemeElement; + + constructor(options: SecuritySchemeVisitorOptions) { + super(options); + this.element = new SecuritySchemeElement(); + } +} + +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 new file mode 100644 index 0000000000..97e5d3ec4e --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-bindings/index.ts @@ -0,0 +1,26 @@ +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 }; + +/** + * @public + */ +class ServerBindingsVisitor extends BaseServerBindingsVisitor { + declare public readonly element: ServerBindingsElement; + + constructor(options: ServerBindingsVisitorOptions) { + super(options); + this.element = new ServerBindingsElement(); + } +} + +export default ServerBindingsVisitor; diff --git a/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-variable/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-variable/index.ts new file mode 100644 index 0000000000..5c0fb2302d --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server-variable/index.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/SecurityVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/server/SecurityVisitor.ts new file mode 100644 index 0000000000..5c0a803560 --- /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; 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/servers/index.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts new file mode 100644 index 0000000000..7541776627 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/servers/index.ts @@ -0,0 +1,30 @@ +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(); + this.element.classes.push('servers'); + } +} + +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 new file mode 100644 index 0000000000..7277e7b3d7 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tag/index.ts @@ -0,0 +1,34 @@ +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'; + +/** + * @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; 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..1474f95e58 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/async-api-3/tags/index.ts @@ -0,0 +1,45 @@ +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 interface TagsVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {} + +/** + * @public + */ +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; 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/ExternalDocumentationVisitor.ts b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts new file mode 100644 index 0000000000..2249dc6994 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/refractor/visitors/generics/ExternalDocumentationVisitor.ts @@ -0,0 +1,38 @@ +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 AlternatingVisitor from './AlternatingVisitor.ts'; +import { isReferenceLikeElement } from '../../predicates.ts'; + +export interface ExternalDocumentationVisitorOptions + extends SpecificationVisitorOptions, + FallbackVisitorOptions {} + +/** + * @public + */ +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; 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/src/traversal/visitor.ts b/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts new file mode 100644 index 0000000000..ba5e6af1bc --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/src/traversal/visitor.ts @@ -0,0 +1,156 @@ +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 = { + /** + * `AsyncApi 3.0.0` specification elements. + */ + AsyncApi3Element: ['content'], + AsyncApiVersionElement: [], + ChannelBindingsElement: ['content'], + ChannelElement: ['content'], + ChannelsElement: ['content'], + ComponentsElement: ['content'], + ContactElement: ['content'], + CorrelationIDElement: ['content'], + DefaultContentTypeElement: [], + ExternalDocumentationElement: ['content'], + InfoElement: ['content'], + LicenseElement: ['content'], + MessagesElement: ['content'], + MessageElement: ['content'], + 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'], + SecuritySchemeElement: ['content'], + ServerElement: ['content'], + ServerBindingsElement: ['content'], + ServersElement: ['content'], + ServerVariableElement: ['content'], + TagElement: ['content'], + TagsElement: ['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, +}; 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/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": [ + "." + ] +} 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 new file mode 100644 index 0000000000..5cc50cd885 --- /dev/null +++ b/packages/apidom-ns-asyncapi-3/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../tsconfig.json", + "include": [ + "src/**/*" + ] +}