diff --git a/package-lock.json b/package-lock.json index 3b41200cfc..0d24ada02a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,8 @@ "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.1.0", "@apidevtools/swagger-parser": "^10.0.3", - "@asyncapi/parser": "3.0.0-next-major-spec.8", - "@smoya/multi-parser": "^4.0.0", + "@asyncapi/parser": "^3.0.5", + "@smoya/multi-parser": "^5.0.1", "@swc/core": "^1.3.5", "@swc/jest": "^0.2.23", "@types/node": "^20.3.3", @@ -252,16 +252,20 @@ "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==" }, "node_modules/@asyncapi/parser": { - "version": "3.0.0-next-major-spec.8", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.0-next-major-spec.8.tgz", - "integrity": "sha512-d8ebYM08BCsx3Q4AeLke6naU/NrcAXFEVpS6b3EWcKRdUDce+v0X5k9aDH+YXWCaQApEF28UzcxhlSOJvhIFgQ==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.5.tgz", + "integrity": "sha512-Kc/hwCyb2/YzcIfQlY9lwjUDV/9cXMjVewQz9WvPVAaFlOr83bdHpccfnl2sQNXDcC+zCcpEDBjs41ATowPE3Q==", "dependencies": { - "@asyncapi/specs": "^6.0.0-next-major-spec.9", + "@asyncapi/specs": "^6.4.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@stoplight/json": "^3.20.2", + "@stoplight/json-ref-readers": "^1.2.2", "@stoplight/json-ref-resolver": "^3.1.5", "@stoplight/spectral-core": "^1.16.1", "@stoplight/spectral-functions": "^1.7.2", "@stoplight/spectral-parsers": "^1.0.2", + "@stoplight/spectral-ref-resolver": "^1.0.3", + "@stoplight/types": "^13.12.0", "@types/json-schema": "^7.0.11", "@types/urijs": "^1.19.19", "ajv": "^8.11.0", @@ -270,19 +274,38 @@ "avsc": "^5.7.5", "js-yaml": "^4.1.0", "jsonpath-plus": "^7.2.0", - "node-fetch": "2.6.7", - "ramldt2jsonschema": "^1.2.3", - "webapi-parser": "^0.5.0" + "node-fetch": "2.6.7" } }, "node_modules/@asyncapi/parser/node_modules/@asyncapi/specs": { - "version": "6.0.0-next-major-spec.11", - "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.0.0-next-major-spec.11.tgz", - "integrity": "sha512-TR92zUaGQ5lZfc+f9L8yRCVqP7AVFvrMl2Ebr36ZGGC6cQwv80DZL/sbbgAWXzThAcTDXL1xsHUc0BpecHXoHw==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.4.0.tgz", + "integrity": "sha512-hTw0xF09i+eoSGP8LKo6aM+XOkvWsgV7kYpFHXd45VX9RcVZl5cADFIYDnPZkd52WaDJ4S+8Nrwkt/1vDb6SrQ==", "dependencies": { "@types/json-schema": "^7.0.11" } }, + "node_modules/@asyncapi/parser/node_modules/@stoplight/json": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/@stoplight/json/-/json-3.21.0.tgz", + "integrity": "sha512-5O0apqJ/t4sIevXCO3SBN9AHCEKKR/Zb4gaj7wYe5863jme9g02Q0n/GhM7ZCALkL+vGPTe4ZzTETP8TFtsw3g==", + "dependencies": { + "@stoplight/ordered-object-literal": "^1.0.3", + "@stoplight/path": "^1.3.2", + "@stoplight/types": "^13.6.0", + "jsonc-parser": "~2.2.1", + "lodash": "^4.17.21", + "safe-stable-stringify": "^1.1" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/@asyncapi/parser/node_modules/safe-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz", + "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==" + }, "node_modules/@asyncapi/parserV1": { "name": "@asyncapi/parser", "version": "1.18.1", @@ -2081,16 +2104,17 @@ } }, "node_modules/@smoya/multi-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@smoya/multi-parser/-/multi-parser-4.1.0.tgz", - "integrity": "sha512-0q4805I7ZdkKNEbNrbxmBNAdYEAH9aBYCuXiIXCbu8WC0sdRqLWmTsvg/DaNO8ZnsrGhVzy5VITf+8CKlVnGoQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@smoya/multi-parser/-/multi-parser-5.0.1.tgz", + "integrity": "sha512-MT3683glXqnsJ5vOKDCMiS/MNwt+LXyuL844LOvl4YbtR9PEe2zyECTmHLw/hbUpXFFmQXlzGs/sLSXdUh+Org==", "dependencies": { "@asyncapi/avro-schema-parser": "^3.0.3", "@asyncapi/openapi-schema-parser": "^3.0.4", "@asyncapi/protobuf-schema-parser": "^3.0.0", "@asyncapi/raml-dt-schema-parser": "^4.0.4", - "parserv2": "npm:@asyncapi/parser@^2.1.0", - "parserv3": "npm:@asyncapi/parser@^3.0.0-next-major-spec.3" + "parserapiv1": "npm:@asyncapi/parser@^2.1.0", + "parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8", + "parserapiv3": "npm:@asyncapi/parser@^3.0.1" } }, "node_modules/@stoplight/better-ajv-errors": { @@ -9770,11 +9794,11 @@ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", "dev": true }, - "node_modules/parserv2": { + "node_modules/parserapiv1": { "name": "@asyncapi/parser", - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.1.tgz", - "integrity": "sha512-FnJ5Du9iMu9MEb5mF90gF7z1ZkdnazisBsm3GHVFr7VaiF8luAoB+bklGYFwoMb+9QWKWr1099orY5VyXULAcQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.2.tgz", + "integrity": "sha512-2pHKnr2P8EujcrvZo4x4zNwsEIAg5vb1ZEhl2+OH0YBg8EYH/Xx73XZ+bbwLaYIg1gvFjm29jNB9UL3CMeDU5w==", "dependencies": { "@asyncapi/specs": "^5.1.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", @@ -9794,12 +9818,10 @@ "avsc": "^5.7.5", "js-yaml": "^4.1.0", "jsonpath-plus": "^7.2.0", - "node-fetch": "2.6.7", - "ramldt2jsonschema": "^1.2.3", - "webapi-parser": "^0.5.0" + "node-fetch": "2.6.7" } }, - "node_modules/parserv2/node_modules/@asyncapi/specs": { + "node_modules/parserapiv1/node_modules/@asyncapi/specs": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-5.1.0.tgz", "integrity": "sha512-yffhETqehkim43luMnPKOwzY0D0YtU4bKpORIXIaid6p5Y5kDLrMGJaEPkNieQp03HMjhjFrnUPtT8kvqe0+aQ==", @@ -9807,7 +9829,7 @@ "@types/json-schema": "^7.0.11" } }, - "node_modules/parserv2/node_modules/@stoplight/json": { + "node_modules/parserapiv1/node_modules/@stoplight/json": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@stoplight/json/-/json-3.21.0.tgz", "integrity": "sha512-5O0apqJ/t4sIevXCO3SBN9AHCEKKR/Zb4gaj7wYe5863jme9g02Q0n/GhM7ZCALkL+vGPTe4ZzTETP8TFtsw3g==", @@ -9823,16 +9845,16 @@ "node": ">=8.3.0" } }, - "node_modules/parserv2/node_modules/safe-stable-stringify": { + "node_modules/parserapiv1/node_modules/safe-stable-stringify": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz", "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==" }, - "node_modules/parserv3": { + "node_modules/parserapiv2": { "name": "@asyncapi/parser", - "version": "3.0.0-next-major-spec.7", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.0-next-major-spec.7.tgz", - "integrity": "sha512-iCVCd66h6NXrIVu7aK5RwGuJ4g1j+qD88xxejUwczbpGbhJkuZUzF5jReWNNAizETJttnAwW0rBKjZF4HVqOiQ==", + "version": "3.0.0-next-major-spec.8", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.0-next-major-spec.8.tgz", + "integrity": "sha512-d8ebYM08BCsx3Q4AeLke6naU/NrcAXFEVpS6b3EWcKRdUDce+v0X5k9aDH+YXWCaQApEF28UzcxhlSOJvhIFgQ==", "dependencies": { "@asyncapi/specs": "^6.0.0-next-major-spec.9", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", @@ -9853,14 +9875,70 @@ "webapi-parser": "^0.5.0" } }, - "node_modules/parserv3/node_modules/@asyncapi/specs": { - "version": "6.0.0-next-major-spec.10", - "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.0.0-next-major-spec.10.tgz", - "integrity": "sha512-flxUofPHdLDfbnfkLzqMPjbCj4EJTxg8q9Xxkt9hsO7BDRUDQk5C7RRBfe+HxAstl0LghX1DAQcof3+GPEXuFA==", + "node_modules/parserapiv2/node_modules/@asyncapi/specs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.4.0.tgz", + "integrity": "sha512-hTw0xF09i+eoSGP8LKo6aM+XOkvWsgV7kYpFHXd45VX9RcVZl5cADFIYDnPZkd52WaDJ4S+8Nrwkt/1vDb6SrQ==", + "dependencies": { + "@types/json-schema": "^7.0.11" + } + }, + "node_modules/parserapiv3": { + "name": "@asyncapi/parser", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.5.tgz", + "integrity": "sha512-Kc/hwCyb2/YzcIfQlY9lwjUDV/9cXMjVewQz9WvPVAaFlOr83bdHpccfnl2sQNXDcC+zCcpEDBjs41ATowPE3Q==", + "dependencies": { + "@asyncapi/specs": "^6.4.0", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@stoplight/json": "^3.20.2", + "@stoplight/json-ref-readers": "^1.2.2", + "@stoplight/json-ref-resolver": "^3.1.5", + "@stoplight/spectral-core": "^1.16.1", + "@stoplight/spectral-functions": "^1.7.2", + "@stoplight/spectral-parsers": "^1.0.2", + "@stoplight/spectral-ref-resolver": "^1.0.3", + "@stoplight/types": "^13.12.0", + "@types/json-schema": "^7.0.11", + "@types/urijs": "^1.19.19", + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1", + "avsc": "^5.7.5", + "js-yaml": "^4.1.0", + "jsonpath-plus": "^7.2.0", + "node-fetch": "2.6.7" + } + }, + "node_modules/parserapiv3/node_modules/@asyncapi/specs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.4.0.tgz", + "integrity": "sha512-hTw0xF09i+eoSGP8LKo6aM+XOkvWsgV7kYpFHXd45VX9RcVZl5cADFIYDnPZkd52WaDJ4S+8Nrwkt/1vDb6SrQ==", "dependencies": { "@types/json-schema": "^7.0.11" } }, + "node_modules/parserapiv3/node_modules/@stoplight/json": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/@stoplight/json/-/json-3.21.0.tgz", + "integrity": "sha512-5O0apqJ/t4sIevXCO3SBN9AHCEKKR/Zb4gaj7wYe5863jme9g02Q0n/GhM7ZCALkL+vGPTe4ZzTETP8TFtsw3g==", + "dependencies": { + "@stoplight/ordered-object-literal": "^1.0.3", + "@stoplight/path": "^1.3.2", + "@stoplight/types": "^13.6.0", + "jsonc-parser": "~2.2.1", + "lodash": "^4.17.21", + "safe-stable-stringify": "^1.1" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/parserapiv3/node_modules/safe-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz", + "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==" + }, "node_modules/pascal-case": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", diff --git a/package.json b/package.json index 5808944ad8..84af677b0b 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,8 @@ "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.1.0", "@apidevtools/swagger-parser": "^10.0.3", - "@asyncapi/parser": "3.0.0-next-major-spec.8", - "@smoya/multi-parser": "^4.0.0", + "@asyncapi/parser": "^3.0.5", + "@smoya/multi-parser": "^5.0.1", "@swc/core": "^1.3.5", "@swc/jest": "^0.2.23", "@types/node": "^20.3.3", diff --git a/src/processors/AsyncAPIInputProcessor.ts b/src/processors/AsyncAPIInputProcessor.ts index 54c7dd69d5..1529e284c8 100644 --- a/src/processors/AsyncAPIInputProcessor.ts +++ b/src/processors/AsyncAPIInputProcessor.ts @@ -1,6 +1,6 @@ /* eslint-disable no-undef */ /* eslint-disable @typescript-eslint/no-var-requires */ -import Parser, { +import { isAsyncAPIDocument, isOldAsyncAPIDocument, AsyncAPIDocumentInterface, @@ -18,7 +18,10 @@ import { AsyncapiV2Schema } from '../models/AsyncapiV2Schema'; import { convertToMetaModel } from '../helpers'; import fs from 'fs'; import { fileURLToPath } from 'url'; -import { NewParser } from '@smoya/multi-parser'; +import { + ConvertDocumentParserAPIVersion, + NewParser +} from '@smoya/multi-parser'; import { createDetailedAsyncAPI } from '@asyncapi/parser/cjs/utils'; /** @@ -46,10 +49,8 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { input?: any, options?: ProcessorOptions ): Promise { - let rawInput = input; - if (this.isFileInput(input)) { - rawInput = await this.getParsedFileInput(input); - } + const rawInput = input; + let doc: AsyncAPIDocumentInterface | undefined; if (!this.shouldProcess(rawInput)) { throw new Error( @@ -58,23 +59,33 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { } Logger.debug('Processing input as an AsyncAPI document'); - let doc: AsyncAPIDocumentInterface | undefined; const inputModel = new InputMetaModel(); if (isOldAsyncAPIDocument(rawInput)) { // Is from old parser const parsedJSON = rawInput.json(); const detailed = createDetailedAsyncAPI(parsedJSON, parsedJSON); doc = createAsyncAPIDocument(detailed); + } else if (AsyncAPIInputProcessor.isFromNewParser(rawInput)) { + doc = ConvertDocumentParserAPIVersion(rawInput, 2) as any; } else { const parserOptions = options?.asyncapi || {}; const parser = NewParser(2, { parserOptions, includeSchemaParsers: true }); - const { document, diagnostics } = await parser.parse( - rawInput, - parserOptions - ); + + let parserResult; + if (this.isFileInput(input)) { + const filePath = fileURLToPath(input); + /* eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe as it just checks file existance */ + if (!fs.existsSync(filePath)) { + throw new Error('File does not exists.'); + } + parserResult = await fromFile(parser as any, filePath).parse(); + } else { + parserResult = await parser.parse(rawInput, parserOptions); + } + const { document, diagnostics } = parserResult; if (document) { doc = document as unknown as AsyncAPIDocumentInterface; } else { @@ -419,22 +430,4 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor { // prettier-ignore return typeof input === 'string' && (/^file:\/\//g).test(input); } - - async getParsedFileInput(input: string): Promise { - const filePath = fileURLToPath(input); - /* eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe as it just checks file existance */ - if (!fs.existsSync(filePath)) { - throw new Error('File does not exists.'); - } - const parser = new Parser(); - const { document, diagnostics } = await fromFile(parser, filePath).parse(); - if (!document) { - const err = new Error( - 'Input is not an correct AsyncAPI document so it cannot be processed.' - ); - (err as any).diagnostics = diagnostics; - throw err; - } - return document; - } } diff --git a/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap b/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap index 2b7fab40bb..d054123762 100644 --- a/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap +++ b/test/processors/__snapshots__/AsyncAPIInputProcessor.spec.ts.snap @@ -1607,111 +1607,117 @@ InputMetaModel { "title": "CloudEvent example", "version": "1.0.0", }, - "x-parser-api-version": 2, + "x-parser-api-version": 3, "x-parser-spec-parsed": true, }, "_meta": Object { "asyncapi": Object { - "input": "{ - \\"asyncapi\\": \\"2.5.0\\", - \\"defaultContentType\\": \\"application/json\\", - \\"info\\": { - \\"title\\": \\"CloudEvent example\\", - \\"version\\": \\"1.0.0\\" - }, - \\"channels\\": { - \\"pet\\": { - \\"publish\\": { - \\"message\\": { - \\"oneOf\\": [ - { - \\"$ref\\": \\"#/components/messages/Dog\\" + "input": Object { + "asyncapi": "2.5.0", + "channels": Object { + "pet": Object { + "publish": Object { + "message": Object { + "oneOf": Array [ + Object { + "$ref": "#/components/messages/Dog", + }, + Object { + "$ref": "#/components/messages/Cat", + }, + ], + }, + }, }, - { - \\"$ref\\": \\"#/components/messages/Cat\\" - } - ] - } - } - } - }, - \\"components\\": { - \\"messages\\": { - \\"Dog\\": { - \\"payload\\": { - \\"title\\": \\"Dog\\", - \\"allOf\\": [ - { - \\"$ref\\": \\"#/components/schemas/CloudEvent\\" + }, + "components": Object { + "messages": Object { + "Cat": Object { + "payload": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/CloudEvent", + }, + Object { + "properties": Object { + "type": Object { + "const": "Cat", + "title": "CatType", + }, + }, + "type": "object", + }, + ], + "title": "Cat", + }, + }, + "Dog": Object { + "payload": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/CloudEvent", + }, + Object { + "properties": Object { + "type": Object { + "const": "Dog", + "title": "DogType", + }, + }, + "type": "object", + }, + ], + "title": "Dog", + }, + }, }, - { - \\"type\\": \\"object\\", - \\"properties\\": { - \\"type\\": { - \\"title\\": \\"DogType\\", - \\"const\\": \\"Dog\\" - } - } - } - ] - } - }, - \\"Cat\\": { - \\"payload\\": { - \\"title\\": \\"Cat\\", - \\"allOf\\": [ - { - \\"$ref\\": \\"#/components/schemas/CloudEvent\\" + "schemas": Object { + "CloudEvent": Object { + "discriminator": "type", + "properties": Object { + "dataschema": Object { + "format": "uri", + "type": "string", + }, + "id": Object { + "type": "string", + }, + "source": Object { + "format": "uri-reference", + "type": "string", + }, + "specversion": Object { + "default": "1.0", + "examples": Array [ + "1.0", + ], + "type": "string", + }, + "time": Object { + "format": "date-time", + "type": "string", + }, + "type": Object { + "type": "string", + }, + }, + "required": Array [ + "id", + "source", + "specversion", + "type", + ], + "title": "CloudEvent", + "type": "object", + }, }, - { - \\"type\\": \\"object\\", - \\"properties\\": { - \\"type\\": { - \\"title\\": \\"CatType\\", - \\"const\\": \\"Cat\\" - } - } - } - ] - } - } - }, - \\"schemas\\": { - \\"CloudEvent\\": { - \\"title\\": \\"CloudEvent\\", - \\"type\\": \\"object\\", - \\"discriminator\\": \\"type\\", - \\"properties\\": { - \\"id\\": { - \\"type\\": \\"string\\" - }, - \\"source\\": { - \\"type\\": \\"string\\", - \\"format\\": \\"uri-reference\\" }, - \\"specversion\\": { - \\"type\\": \\"string\\", - \\"default\\": \\"1.0\\", - \\"examples\\": [\\"1.0\\"] - }, - \\"type\\": { - \\"type\\": \\"string\\" - }, - \\"dataschema\\": { - \\"type\\": \\"string\\", - \\"format\\": \\"uri\\" + "defaultContentType": "application/json", + "info": Object { + "title": "CloudEvent example", + "version": "1.0.0", }, - \\"time\\": { - \\"type\\": \\"string\\", - \\"format\\": \\"date-time\\" - } }, - \\"required\\": [\\"id\\", \\"source\\", \\"specversion\\", \\"type\\"] - } - } - } -} -", "parsed": Object { "asyncapi": "2.5.0", "channels": Object { @@ -2040,7 +2046,7 @@ InputMetaModel { "title": "CloudEvent example", "version": "1.0.0", }, - "x-parser-api-version": 2, + "x-parser-api-version": 3, "x-parser-spec-parsed": true, }, "semver": Object { @@ -3573,110 +3579,116 @@ InputMetaModel { "title": "CloudEvent example", "version": "1.0.0", }, - "x-parser-api-version": 2, + "x-parser-api-version": 3, "x-parser-spec-parsed": true, }, "_meta": Object { "asyncapi": Object { - "input": "{ - \\"asyncapi\\": \\"2.5.0\\", - \\"defaultContentType\\": \\"application/json\\", - \\"info\\": { - \\"title\\": \\"CloudEvent example\\", - \\"version\\": \\"1.0.0\\" - }, - \\"channels\\": { - \\"pet\\": { - \\"publish\\": { - \\"message\\": { - \\"oneOf\\": [ - { - \\"$ref\\": \\"#/components/messages/Dog\\" + "input": Object { + "asyncapi": "2.5.0", + "channels": Object { + "pet": Object { + "publish": Object { + "message": Object { + "oneOf": Array [ + Object { + "$ref": "#/components/messages/Dog", + }, + Object { + "$ref": "#/components/messages/Cat", + }, + ], + }, + }, }, - { - \\"$ref\\": \\"#/components/messages/Cat\\" - } - ] - } - } - } - }, - \\"components\\": { - \\"messages\\": { - \\"Dog\\": { - \\"payload\\": { - \\"title\\": \\"Dog\\", - \\"allOf\\": [ - { - \\"$ref\\": \\"#/components/schemas/CloudEvent\\" + }, + "components": Object { + "messages": Object { + "Cat": Object { + "payload": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/CloudEvent", + }, + Object { + "properties": Object { + "type": Object { + "const": "Cat", + }, + }, + "type": "object", + }, + ], + "title": "Cat", + }, + }, + "Dog": Object { + "payload": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/CloudEvent", + }, + Object { + "properties": Object { + "type": Object { + "const": "Dog", + }, + }, + "type": "object", + }, + ], + "title": "Dog", + }, + }, }, - { - \\"type\\": \\"object\\", - \\"properties\\": { - \\"type\\": { - \\"const\\": \\"Dog\\" - } - } - } - ] - } - }, - \\"Cat\\": { - \\"payload\\": { - \\"title\\": \\"Cat\\", - \\"allOf\\": [ - { - \\"$ref\\": \\"#/components/schemas/CloudEvent\\" + "schemas": Object { + "CloudEvent": Object { + "discriminator": "type", + "properties": Object { + "dataschema": Object { + "format": "uri", + "type": "string", + }, + "id": Object { + "type": "string", + }, + "source": Object { + "format": "uri-reference", + "type": "string", + }, + "specversion": Object { + "default": "1.0", + "examples": Array [ + "1.0", + ], + "type": "string", + }, + "time": Object { + "format": "date-time", + "type": "string", + }, + "type": Object { + "title": "CloudEventType", + "type": "string", + }, + }, + "required": Array [ + "id", + "source", + "specversion", + "type", + ], + "title": "CloudEvent", + "type": "object", + }, }, - { - \\"type\\": \\"object\\", - \\"properties\\": { - \\"type\\": { - \\"const\\": \\"Cat\\" - } - } - } - ] - } - } - }, - \\"schemas\\": { - \\"CloudEvent\\": { - \\"title\\": \\"CloudEvent\\", - \\"type\\": \\"object\\", - \\"discriminator\\": \\"type\\", - \\"properties\\": { - \\"id\\": { - \\"type\\": \\"string\\" - }, - \\"source\\": { - \\"type\\": \\"string\\", - \\"format\\": \\"uri-reference\\" }, - \\"specversion\\": { - \\"type\\": \\"string\\", - \\"default\\": \\"1.0\\", - \\"examples\\": [\\"1.0\\"] - }, - \\"type\\": { - \\"title\\": \\"CloudEventType\\", - \\"type\\": \\"string\\" - }, - \\"dataschema\\": { - \\"type\\": \\"string\\", - \\"format\\": \\"uri\\" + "defaultContentType": "application/json", + "info": Object { + "title": "CloudEvent example", + "version": "1.0.0", }, - \\"time\\": { - \\"type\\": \\"string\\", - \\"format\\": \\"date-time\\" - } }, - \\"required\\": [\\"id\\", \\"source\\", \\"specversion\\", \\"type\\"] - } - } - } -} -", "parsed": Object { "asyncapi": "2.5.0", "channels": Object { @@ -4006,7 +4018,7 @@ InputMetaModel { "title": "CloudEvent example", "version": "1.0.0", }, - "x-parser-api-version": 2, + "x-parser-api-version": 3, "x-parser-spec-parsed": true, }, "semver": Object { @@ -4124,36 +4136,36 @@ InputMetaModel { "title": "Signup service example (internal)", "version": "0.1.0", }, - "x-parser-api-version": 2, + "x-parser-api-version": 3, "x-parser-spec-parsed": true, }, "_meta": Object { "asyncapi": Object { - "input": "{ - \\"asyncapi\\": \\"2.0.0\\", - \\"defaultContentType\\": \\"application/json\\", - \\"info\\": { - \\"title\\": \\"Signup service example (internal)\\", - \\"version\\": \\"0.1.0\\" - }, - \\"channels\\": { - \\"/user/signedup\\": { - \\"subscribe\\": { - \\"message\\": { - \\"payload\\": { - \\"type\\": \\"object\\", - \\"properties\\": { - \\"email\\": { - \\"type\\": \\"string\\", - \\"format\\": \\"email\\" - } - } - } - } - } - } - } -}", + "input": Object { + "asyncapi": "2.0.0", + "channels": Object { + "/user/signedup": Object { + "subscribe": Object { + "message": Object { + "payload": Object { + "properties": Object { + "email": Object { + "format": "email", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + }, + "defaultContentType": "application/json", + "info": Object { + "title": "Signup service example (internal)", + "version": "0.1.0", + }, + }, "parsed": Object { "asyncapi": "2.0.0", "channels": Object { @@ -4181,7 +4193,7 @@ InputMetaModel { "title": "Signup service example (internal)", "version": "0.1.0", }, - "x-parser-api-version": 2, + "x-parser-api-version": 3, "x-parser-spec-parsed": true, }, "semver": Object {