diff --git a/src/models/asyncapi.ts b/src/models/asyncapi.ts index 1c2944484..fa813bc54 100644 --- a/src/models/asyncapi.ts +++ b/src/models/asyncapi.ts @@ -1,5 +1,4 @@ import { AsyncAPIDocumentV2 } from "./v2"; -import { AsyncAPIDocumentV3 } from "./v3"; import type { InfoInterface } from "./info"; import type { BaseModel } from "./base"; @@ -17,8 +16,8 @@ export function newAsyncAPIDocument(asyncapi: DetailedAsyncAPI): AsyncAPIDocumen switch (asyncapi.semver.major) { case 2: return new AsyncAPIDocumentV2(asyncapi.parsed, { asyncapi, pointer: '/' }); - case 3: - return new AsyncAPIDocumentV3(asyncapi.parsed, { asyncapi, pointer: '/' }); + // case 3: + // return new AsyncAPIDocumentV3(asyncapi.parsed, { asyncapi, pointer: '/' }) as any; default: throw new Error(`Unsupported AsyncAPI version: ${asyncapi.semver.version}`); } diff --git a/src/models/v3/asyncapi.ts b/src/models/v3/asyncapi.ts index 65d35296b..5b423e425 100644 --- a/src/models/v3/asyncapi.ts +++ b/src/models/v3/asyncapi.ts @@ -1,31 +1,7 @@ import { BaseModel } from "../base"; -import { Info } from "./info"; -import { Servers } from "./servers"; -import { Server } from "./server"; - -import { Mixin } from '../utils'; -import { ExtensionsMixin } from './mixins/extensions'; - -import type { AsyncAPIDocumentInterface, InfoInterface } from "../../models"; -import type { ServersInterface } from "models/servers"; - -export class AsyncAPIDocument - extends Mixin(BaseModel, ExtensionsMixin) - implements AsyncAPIDocumentInterface { +export class AsyncAPIDocument extends BaseModel { version(): string { return this._json.asyncapi; } - - info(): InfoInterface { - return this.createModel(Info, this._json.info, { pointer: '/info' }); - } - - servers(): ServersInterface { - return new Servers( - Object.entries(this._json.servers).map(([serverName, server]) => - this.createModel(Server, server, { id: serverName, pointer: `/servers/${serverName}` }) - ) - ); - } } diff --git a/src/models/v3/contact.ts b/src/models/v3/contact.ts deleted file mode 100644 index c7ecb5122..000000000 --- a/src/models/v3/contact.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { BaseModel } from "../base"; - -import { Mixin } from '../utils'; -import { ExtensionsMixin } from './mixins/extensions'; - -import type { ContactInterface } from "../../models/contact"; - -export class Contact extends Mixin(BaseModel, ExtensionsMixin) implements ContactInterface { - hasName(): boolean { - return !!this._json.name; - } - - name(): string | undefined { - return this._json.name; - } - - hasUrl(): boolean { - return !!this._json.url; - } - - url(): string | undefined { - return this._json.url; - } - - hasEmail(): boolean { - return !!this._json.email; - } - - email(): string | undefined { - return this._json.email; - } -} \ No newline at end of file diff --git a/src/models/v3/index.ts b/src/models/v3/index.ts index 053a83fa4..05cd9ec64 100644 --- a/src/models/v3/index.ts +++ b/src/models/v3/index.ts @@ -1,16 +1 @@ -export { AsyncAPIDocument as AsyncAPIDocumentV3 } from './asyncapi'; -export { Contact as ContactV3 } from './contact'; -export { Info as InfoV3 } from './info'; -export { License as LicenseV3 } from './license'; -export { Bindings as BindingsV3, Binding as BindingV3 } from './mixins/bindings'; -export { Extensions as ExtensionsV3, Extension as ExtensionV3 } from './mixins/extensions'; -export { ExternalDocumentation as ExternalDocumentationV3 } from './mixins/external-docs'; -export { Tags as TagsV3, Tag as TagV3 } from './mixins/tags'; -export { Server as ServerV3 } from './server'; -export { Servers as ServersV3 } from './servers'; -export { SecurityScheme as SecuritySchemeV3 } from './security-scheme'; -export { SecuritySchemes as SecuritySchemesV3 } from './security-schemes'; -export { ServerVariable as ServerVariableV3 } from './server-variable'; -export { ServerVariables as ServerVariablesV3 } from './server-variables'; -export {OAuthFlow as OAuthFlowV3} from './oauth-flow'; -export {OAuthFlows as OAuthFlowsV3} from './oauth-flows'; +export { AsyncAPIDocument as AsyncAPIDocumentV3 } from './asyncapi'; \ No newline at end of file diff --git a/src/models/v3/info.ts b/src/models/v3/info.ts deleted file mode 100644 index 6e5cfc62e..000000000 --- a/src/models/v3/info.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { BaseModel } from "../base"; -import { Contact } from "./contact"; -import { License } from "./license"; - -import { Mixin } from '../utils'; -import { DescriptionMixin } from './mixins/description'; -import { ExtensionsMixin } from './mixins/extensions'; -import { ExternalDocumentation } from './mixins/external-docs'; -import { Tags, Tag } from './mixins/tags'; - -import type { InfoInterface } from "../../models/info"; -import type { ExternalDocumentationInterface } from "../../models/external-docs"; -import type { TagsInterface } from "../../models/tags"; - -export class Info - extends Mixin(BaseModel, DescriptionMixin, ExtensionsMixin) - implements InfoInterface { - - title(): string { - return this._json.title; - } - - version(): string { - return this._json.version; - } - - id(): string | undefined { - return this._meta.asyncapi.parsed.id as string; - } - - hasId(): boolean { - return !!this._meta.asyncapi.parsed.id; - } - - hasTermsOfService(): boolean { - return !!this._json.termsOfService; - } - - termsOfService(): string | undefined { - return this._json.termsOfService; - } - - hasContact(): boolean { - return Object.keys(this._json.contact || {}).length > 0; - } - - contact(): Contact | undefined { - const contact = this._json.contact; - return contact && this.createModel(Contact, contact, { pointer: '/info/contact' }); - } - - hasLicense(): boolean { - return Object.keys(this._json.license || {}).length > 0; - } - - license(): License | undefined { - const license = this._json.license; - return license && this.createModel(License, license, { pointer: `/info/license` }); - } - - hasExternalDocs(): boolean { - return Object.keys(this._meta.asyncapi.parsed.externalDocs || {}).length > 0; - }; - - externalDocs(): ExternalDocumentationInterface | undefined { - if (this.hasExternalDocs()) { - return this.createModel(ExternalDocumentation, this._meta.asyncapi.parsed.externalDocs, { pointer: `/externalDocs` }); - } - return; - }; - - tags(): TagsInterface { - const tags = this._json.tags || []; - return new Tags(tags.map((tag: any, idx: number) => this.createModel(Tag, tag, { pointer: `/tags/${idx}` }))); - } -} diff --git a/src/models/v3/license.ts b/src/models/v3/license.ts deleted file mode 100644 index 834f43b29..000000000 --- a/src/models/v3/license.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BaseModel } from "../base"; - -import { Mixin } from '../utils'; -import { ExtensionsMixin } from './mixins/extensions'; - -import type { LicenseInterface } from "../../models/license"; - -export class License extends Mixin(BaseModel, ExtensionsMixin) implements LicenseInterface { - name(): string { - return this._json.name; - } - - hasUrl(): boolean { - return !!this._json.url; - } - - url(): string | undefined { - return this._json.url; - } -} \ No newline at end of file diff --git a/src/models/v3/mixins/bindings.ts b/src/models/v3/mixins/bindings.ts deleted file mode 100644 index ae646e166..000000000 --- a/src/models/v3/mixins/bindings.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { BaseModel } from "../../base"; -import { Collection } from '../../collection'; - -import { Mixin } from '../../utils'; -import { ExtensionsMixin } from './extensions'; - -import type { ModelMetadata } from "../../base"; -import type { BindingsMixinInterface } from "../../mixins"; -import type { BindingsInterface } from "../../bindings"; -import type { BindingInterface } from "../../binding"; - -export class Binding extends Mixin(BaseModel, ExtensionsMixin) implements BindingInterface { - constructor( - private readonly _protocol: string, - _json: Record, - _meta: ModelMetadata, - ) { - super(_json, _meta); - } - - protocol(): string { - return this._protocol; - } - - version(): string { - return this._json.bindingVersion; - } - - value(): any { - const value = { ...this._json }; - delete value.bindingVersion; - return value; - } -} - -export class Bindings extends Collection implements BindingsInterface { - override get(name: string): BindingInterface | undefined { - return this.collections.find(binding => binding.protocol() === name); - }; - - override has(name: string): boolean { - return this.collections.some(binding => binding.protocol() === name); - }; -} - -export abstract class BindingsMixin extends BaseModel implements BindingsMixinInterface { - bindings(): BindingsInterface { - const bindings: Record = this._json.bindings || {}; - return new Bindings( - Object.entries(bindings).map(([protocol, binding]) => - this.createModel(Binding, binding, { id: protocol, pointer: `${this._meta.pointer}/bindings/${protocol}` }) - ) - ); - } -} diff --git a/src/models/v3/mixins/description.ts b/src/models/v3/mixins/description.ts deleted file mode 100644 index c60f5c8e7..000000000 --- a/src/models/v3/mixins/description.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BaseModel } from "../../base"; - -import type { DescriptionMixinInterface } from "../../mixins"; - -export abstract class DescriptionMixin extends BaseModel implements DescriptionMixinInterface { - hasDescription() { - return Boolean(this._json.description); - }; - - description(): string | undefined { - return this._json.description; - } -} \ No newline at end of file diff --git a/src/models/v3/mixins/extensions.ts b/src/models/v3/mixins/extensions.ts deleted file mode 100644 index df5032f5b..000000000 --- a/src/models/v3/mixins/extensions.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Collection } from '../../collection'; -import { BaseModel } from "../../base"; - -import type { ModelMetadata } from "../../base"; -import type { ExtensionsMixinInterface } from "../../mixins"; -import type { ExtensionsInterface } from "../../extensions"; -import type { ExtensionInterface } from "../../extension"; - -import { EXTENSION_REGEX } from '../../../constants'; - -export class Extension extends BaseModel implements ExtensionInterface { - constructor( - private readonly _id: string, - _json: Record, - _meta: ModelMetadata, - ) { - super(_json, _meta); - } - - name(): string { - return this._id; - } - - version(): string { - return 'to implement'; - } - - value(): any { - return this._json; - } -} - -export class Extensions extends Collection implements ExtensionsInterface { - override get(name: string): ExtensionInterface | undefined { - return this.collections.find(ext => ext.name() === name); - }; - - override has(name: string): boolean { - return this.collections.some(ext => ext.name() === name); - }; -} - -export abstract class ExtensionsMixin extends BaseModel implements ExtensionsMixinInterface { - extensions(): ExtensionsInterface { - const extensions: Extension[] = []; - Object.entries(this._json).forEach(([key, value]) => { - if (EXTENSION_REGEX.test(key)) { - extensions.push( - this.createModel(Extension, value, { id: key, pointer: `${this._meta.pointer}/${key}` }) - ); - } - }); - return new Extensions(extensions); - }; -} diff --git a/src/models/v3/mixins/external-docs.ts b/src/models/v3/mixins/external-docs.ts deleted file mode 100644 index d400201ca..000000000 --- a/src/models/v3/mixins/external-docs.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { BaseModel } from "../../base"; - -import { Mixin } from '../../utils'; -import { DescriptionMixin } from './description'; -import { ExtensionsMixin } from './extensions'; - -import type { ExternalDocumentationInterface } from '../../external-docs'; -import type { ExternalDocumentationMixinInterface } from "../../mixins"; - -export class ExternalDocumentation - extends Mixin(BaseModel, DescriptionMixin, ExtensionsMixin) - implements ExternalDocumentationInterface { - - url(): string { - return this._json.url; - } -} - -export abstract class ExternalDocumentationMixin extends BaseModel implements ExternalDocumentationMixinInterface { - hasExternalDocs(): boolean { - return Object.keys(this._json.externalDocs || {}).length > 0; - }; - - externalDocs(): ExternalDocumentationInterface | undefined { - if (this.hasExternalDocs()) { - return new ExternalDocumentation(this._json.externalDocs); - } - return; - }; -} \ No newline at end of file diff --git a/src/models/v3/mixins/tags.ts b/src/models/v3/mixins/tags.ts deleted file mode 100644 index e490069e9..000000000 --- a/src/models/v3/mixins/tags.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { BaseModel } from "../../base"; -import { Collection } from "../../collection"; - -import { Mixin } from '../../utils'; -import { DescriptionMixin } from './description'; -import { ExtensionsMixin } from './extensions'; -import { ExternalDocumentationMixin } from './external-docs'; - -import type { TagsMixinInterface } from "../../mixins"; -import type { TagsInterface } from "../../tags"; -import type { TagInterface } from "../../tag"; - -export class Tag - extends Mixin(BaseModel, DescriptionMixin, ExtensionsMixin, ExternalDocumentationMixin) - implements TagInterface { - - name(): string { - return this._json.name; - } -} - -export class Tags extends Collection implements TagsInterface { - override get(name: string): TagInterface | undefined { - return this.collections.find(tag => tag.name() === name); - }; - - override has(name: string): boolean { - return this.collections.some(tag => tag.name() === name); - }; -} - -export abstract class TagsMixin extends BaseModel implements TagsMixinInterface { - tags(): TagsInterface { - const tags = this._json.tags || []; - return new Tags(tags.map((tag: any, idx: number) => this.createModel(Tag, tag, { pointer: `${this._meta.pointer}/tags/${idx}` }))); - } -} diff --git a/src/models/v3/oauth-flow.ts b/src/models/v3/oauth-flow.ts deleted file mode 100644 index 70cb6846f..000000000 --- a/src/models/v3/oauth-flow.ts +++ /dev/null @@ -1,24 +0,0 @@ - -import { OAuthFlowInterface } from '../oauth-flow'; -import { BaseModel } from '../base'; -import { Mixin } from '../utils'; -import { ExtensionsMixin } from './mixins/extensions'; - -export class OAuthFlow extends Mixin(BaseModel, ExtensionsMixin) implements OAuthFlowInterface { - authorizationUrl(): string | undefined { - return this._json.authorizationUrl; - } - hasRefreshUrl(): boolean { - return !!this._json.refreshUrl; - } - refreshUrl(): string | undefined { - return this._json.refreshUrl; - } - scopes(): Record | undefined { - return this._json.scopes; - } - tokenUrl(): string | undefined { - return this._json.tokenUrl; - } - -} \ No newline at end of file diff --git a/src/models/v3/oauth-flows.ts b/src/models/v3/oauth-flows.ts deleted file mode 100644 index 6abab0eb8..000000000 --- a/src/models/v3/oauth-flows.ts +++ /dev/null @@ -1,40 +0,0 @@ - -import { OAuthFlowsInterface } from '../oauth-flows'; -import { BaseModel } from '../base'; -import { Mixin } from '../utils'; -import { ExtensionsMixin } from './mixins/extensions'; -import { OAuthFlowInterface } from '../oauth-flow'; -import { OAuthFlow } from './oauth-flow'; - -export class OAuthFlows extends Mixin(BaseModel, ExtensionsMixin) implements OAuthFlowsInterface { - hasAuthorizationCode(): boolean { - return !!this._json.authorizationCode; - } - authorizationCode(): OAuthFlowInterface | undefined { - if (!this._json.authorizationCode) return undefined; - return new OAuthFlow(this._json.authorizationCode); - } - hasClientCredentials(): boolean { - return !!this._json.clientCredentials; - } - clientCredentials(): OAuthFlowInterface | undefined { - if (!this._json.clientCredentials) return undefined; - return new OAuthFlow(this._json.clientCredentials); - } - hasImplicit(): boolean { - return !!this._json.implicit; - } - implicit(): OAuthFlowInterface | undefined { - if (!this._json.implicit) return undefined; - return new OAuthFlow(this._json.implicit); - } - hasPassword(): boolean { - return !!this._json.password; - } - password(): OAuthFlowInterface | undefined { - if (!this._json.password) return undefined; - return new OAuthFlow(this._json.password); - } - - -} \ No newline at end of file diff --git a/src/models/v3/security-scheme.ts b/src/models/v3/security-scheme.ts deleted file mode 100644 index eecbaa843..000000000 --- a/src/models/v3/security-scheme.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { BaseModel, ModelMetadata } from '../base'; -import { Mixin } from '../utils'; -import { DescriptionMixin } from './mixins/description'; -import { ExtensionsMixin } from './mixins/extensions'; -import { SecuritySchemaType, SecuritySchemeInterface } from '../security-scheme'; -import { OAuthFlowsInterface } from '../oauth-flows'; -import { OAuthFlows } from './oauth-flows'; - -export class SecurityScheme extends Mixin(BaseModel, DescriptionMixin, ExtensionsMixin) implements SecuritySchemeInterface { - constructor( - private readonly _id: string, - _json: Record, - _meta: ModelMetadata = {} as any - ) { - super(_json, _meta); - } - - id(): string { - return this._id; - } - - hasBearerFormat(): boolean { - return !!this._json.bearerFormat; - } - - bearerFormat(): string | undefined { - return this._json.bearerFormat; - } - - openIdConnectUrl(): string { - return this._json.openIdConnectUrl; - } - - scheme(): string | undefined { - return this._json.scheme - } - - flows(): OAuthFlowsInterface | undefined { - if(!this._json.flows) return undefined; - return new OAuthFlows(this._json.flows); - } - - scopes(): string[] { - return this._json.scopes; - } - - type(): SecuritySchemaType { - return this._json.type; - } - - in(): string | undefined { - return this._json.in; - } - -} \ No newline at end of file diff --git a/src/models/v3/security-schemes.ts b/src/models/v3/security-schemes.ts deleted file mode 100644 index 500ded280..000000000 --- a/src/models/v3/security-schemes.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SecuritySchemesInterface } from '../security-schemes'; -import { Collection } from '../collection'; -import { SecuritySchemeInterface } from '../security-scheme'; - -export class SecuritySchemes extends Collection implements SecuritySchemesInterface { - get(id: string): SecuritySchemeInterface | undefined { - return this.collections.find(securityScheme => securityScheme.id() === id); - } - has(id: string): boolean { - return this.collections.some(securityScheme => securityScheme.id() === id); - } -} \ No newline at end of file diff --git a/src/models/v3/server-variable.ts b/src/models/v3/server-variable.ts deleted file mode 100644 index e471973e7..000000000 --- a/src/models/v3/server-variable.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { BaseModel } from '../base'; - -import { Mixin } from '../utils'; -import { DescriptionMixin } from './mixins/description'; -import { ExtensionsMixin } from './mixins/extensions'; - -import type { ModelMetadata } from '../base'; -import type { ServerVariableInterface } from '../server-variable'; - -export class ServerVariable extends Mixin(BaseModel, DescriptionMixin, ExtensionsMixin) implements ServerVariableInterface { - constructor( - private readonly _id: string, - _json: Record, - _meta: ModelMetadata = {} as any - ) { - super(_json, _meta); - } - - id(): string { - return this._id; - } - - hasDefaultValue(): boolean { - return !!this._json.default - } - - defaultValue(): string | undefined { - return this._json.default; - } - - hasAllowedValues(): boolean { - return !!this._json.enum; - } - - allowedValues(): Array { - return this._json.enum; - } - - examples(): Array { - return this._json.examples - } -} diff --git a/src/models/v3/server-variables.ts b/src/models/v3/server-variables.ts deleted file mode 100644 index 037cf7540..000000000 --- a/src/models/v3/server-variables.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ServerVariablesInterface } from '../server-variables'; -import { Collection } from '../collection'; -import { ServerVariableInterface } from '../server-variable'; - -export class ServerVariables extends Collection implements ServerVariablesInterface { - get(id: string): ServerVariableInterface | undefined { - return this.collections.find(serverVariable => serverVariable.id() === id); - } - - has(id: string): boolean { - return this.collections.some(serverVariable => serverVariable.id() === id); - } - -} \ No newline at end of file diff --git a/src/models/v3/server.ts b/src/models/v3/server.ts deleted file mode 100644 index 19ac7aacc..000000000 --- a/src/models/v3/server.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { BaseModel } from '../base'; -import { SecurityScheme } from './security-scheme'; -import { ServerVariable } from './server-variable'; -import { ServerVariables } from './server-variables'; - -import { Mixin } from '../utils'; -import { BindingsMixin } from './mixins/bindings'; -import { DescriptionMixin } from './mixins/description'; -import { ExtensionsMixin } from './mixins/extensions'; - -import type { ModelMetadata } from "../base"; -import type { ServerInterface } from '../server'; -import type { SecuritySchemeInterface } from '../security-scheme'; - -export class Server extends Mixin(BaseModel, BindingsMixin, DescriptionMixin, ExtensionsMixin) implements ServerInterface { - constructor( - private readonly _id: string, - _json: Record, - _meta: ModelMetadata = {} as any, - ) { - super(_json, _meta); - } - - id(): string { - return this._id; - } - - url(): string { - return this._json.url; - } - - protocol(): string { - return this._json.protocol; - } - - hasProtocolVersion(): boolean { - return !!this._json.protocolVersion; - } - - protocolVersion(): string { - return this._json.protocolVersion; - } - - variables(): ServerVariables { - return new ServerVariables( - Object.entries( - this._json.variables - ).map( - ([serverVariableName, serverVariable]) => this.createModel( - ServerVariable, serverVariable, { - id: serverVariableName, - pointer: `${this._meta.pointer}/variables/${serverVariableName}` - } - ) - )) - } - - security(): Array> { - const securitySchemes = this._meta?.asyncapi?.parsed.components.securitySchemes || {}; - return (this._json.security || []).map((requirement: any) => { - const requirements: Record = {}; - Object.entries(requirement).forEach(([security, scopes]) => { - requirements[security] = { - schema: this.createModel(SecurityScheme, securitySchemes[security], { id: security, pointer: `/components/securitySchemes/${security}` }), - scopes: scopes as Array, - } - }); - return requirements; - }) - } -} diff --git a/src/models/v3/servers.ts b/src/models/v3/servers.ts deleted file mode 100644 index 68da626c9..000000000 --- a/src/models/v3/servers.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Collection } from '../collection'; -import { ServerInterface } from '../server'; -import { ServersInterface } from '../servers'; - -export class Servers extends Collection implements ServersInterface { - override get(id: string): ServerInterface | undefined { - return this.collections.find(server => server.id() === id); - } - - override has(id: string): boolean { - return this.collections.some(server => server.id() === id); - } -} diff --git a/test/models/v2/asyncapi.spec.ts b/test/models/v2/asyncapi.spec.ts index fab5cd43f..37d1e1601 100644 --- a/test/models/v2/asyncapi.spec.ts +++ b/test/models/v2/asyncapi.spec.ts @@ -3,7 +3,6 @@ import { AsyncAPIDocumentV2, InfoV2, ServersV2, - AsyncAPIDocumentV3 } from '../../../src/models'; import { createDetailedAsyncAPI } from '../../../src/utils'; @@ -14,7 +13,7 @@ import { describe('AsyncAPIDocument model', function() { describe('.version()', function() { it('should return the value', function() { - const doc = { asyncapi: "3.0.0" }; + const doc = { asyncapi: "2.0.0" }; const d = new AsyncAPIDocumentV2(doc); expect(d.version()).toEqual(doc.asyncapi); }); @@ -56,14 +55,6 @@ describe('AsyncAPIDocument factory', function() { expect(d).toBeInstanceOf(AsyncAPIDocumentV2); }); - it('should create a valid document from v3.0.0', function() { - const doc = { asyncapi: "3.0.0" }; - const detailed = createDetailedAsyncAPI(doc, doc); - const d = newAsyncAPIDocument(detailed) - expect(d.version()).toEqual(doc.asyncapi); - expect(d).toBeInstanceOf(AsyncAPIDocumentV3); - }); - it('should fail trying to create a document from a non supported spec version', function() { const doc = { asyncapi: "99.99.99" }; const detailed = createDetailedAsyncAPI(doc, doc);