From 26f9c71831b92f6f547d4a5a8808ec48dc7f0f07 Mon Sep 17 00:00:00 2001 From: Matatjahu Date: Wed, 27 Apr 2022 13:50:59 +0200 Subject: [PATCH] feat: support 2.4.0 AsyncAPI --- openapi.yaml | 2 ++ package.json | 14 +++++++------- src/controllers/tests/convert.controller.test.ts | 12 ++++++------ src/services/tests/convert.service.test.ts | 16 ++++++++-------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 162f73fe..0c9097cb 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -279,6 +279,7 @@ components: - $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.1.0.json - $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.2.0.json - $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.3.0.json + - $ref: https://raw.githubusercontent.com/asyncapi/spec-json-schemas/master/schemas/2.4.0.json AsyncAPIDocuments: type: array description: AsyncAPI documents in JSON or YAML. @@ -298,6 +299,7 @@ components: - '2.1.0' - '2.2.0' - '2.3.0' + - '2.4.0' - 'latest' ValidateRequest: diff --git a/package.json b/package.json index 010795a8..2f94a890 100644 --- a/package.json +++ b/package.json @@ -43,23 +43,23 @@ "@apidevtools/json-schema-ref-parser": "^9.0.9", "@asyncapi/avro-schema-parser": "^1.0.1", "@asyncapi/bundler": "^0.1.0", - "@asyncapi/converter": "^0.10.0", + "@asyncapi/converter": "^0.11.0", "@asyncapi/diff": "^0.3.0", "@asyncapi/dotnet-nats-template": "^0.4.7", - "@asyncapi/generator": "^1.9.2", - "@asyncapi/go-watermill-template": "^0.1.38", - "@asyncapi/html-template": "^0.24.8", + "@asyncapi/generator": "^1.10.0", + "@asyncapi/go-watermill-template": "^0.2.0", + "@asyncapi/html-template": "^0.24.9", "@asyncapi/java-spring-cloud-stream-template": "^0.12.1", "@asyncapi/java-spring-template": "^0.25.1", "@asyncapi/java-template": "^0.1.0", - "@asyncapi/markdown-template": "^1.0.1", + "@asyncapi/markdown-template": "^1.1.0", "@asyncapi/nodejs-template": "^0.11.4", "@asyncapi/nodejs-ws-template": "^0.9.21", "@asyncapi/openapi-schema-parser": "^2.0.1", - "@asyncapi/parser": "^1.14.1", + "@asyncapi/parser": "^1.15.0", "@asyncapi/python-paho-template": "^0.2.12", "@asyncapi/raml-dt-schema-parser": "^2.0.1", - "@asyncapi/specs": "^2.13.1", + "@asyncapi/specs": "^2.14.0", "@asyncapi/ts-nats-template": "^0.5.15", "ajv": "^8.8.2", "ajv-formats": "^2.1.1", diff --git a/src/controllers/tests/convert.controller.test.ts b/src/controllers/tests/convert.controller.test.ts index 255af131..08d6eee2 100644 --- a/src/controllers/tests/convert.controller.test.ts +++ b/src/controllers/tests/convert.controller.test.ts @@ -16,7 +16,7 @@ const validJsonAsyncAPI2_0_0 = { }; const validYamlAsyncAPI2_3_0 = ` -asyncapi: 2.3.0 +asyncapi: 2.4.0 info: title: Super test version: 1.0.0 @@ -78,7 +78,7 @@ describe('ConvertController', () => { }); }); - it('should pass when converting to 2.3.0 version', async () => { + it('should pass when converting to 2.4.0 version', async () => { const app = new App([new ConvertController()]); await app.init(); @@ -86,11 +86,11 @@ describe('ConvertController', () => { .post('/v1/convert') .send({ asyncapi: validJsonAsyncAPI2_0_0, - version: '2.3.0' + version: '2.4.0' }) .expect(200, { converted: { - asyncapi: '2.3.0', + asyncapi: '2.4.0', info: { title: 'Super test', version: '1.0.0' @@ -111,7 +111,7 @@ describe('ConvertController', () => { }) .expect(200, { converted: { - asyncapi: '2.3.0', + asyncapi: '2.4.0', info: { title: 'Super test', version: '1.0.0' @@ -129,7 +129,7 @@ describe('ConvertController', () => { .post('/v1/convert') .send({ asyncapi: validJsonAsyncAPI2_0_0, - version: '2.3.0', + version: '2.4.0', language: 'yaml' }) .expect(200, { diff --git a/src/services/tests/convert.service.test.ts b/src/services/tests/convert.service.test.ts index d466a4c0..aa9af994 100644 --- a/src/services/tests/convert.service.test.ts +++ b/src/services/tests/convert.service.test.ts @@ -10,8 +10,8 @@ const validJsonAsyncAPI2_0_0 = { channels: {} }; -const validYamlAsyncAPI2_3_0 = ` -asyncapi: 2.3.0 +const validYamlAsyncAPI2_4_0 = ` +asyncapi: 2.4.0 info: title: Super test version: 1.0.0 @@ -38,11 +38,11 @@ describe('ConvertService', () => { })); }); - it('should pass when converting to 2.3.0 version', async () => { - const converted = await convertService.convert(validJsonAsyncAPI2_0_0, '2.3.0'); + it('should pass when converting to 2.4.0 version', async () => { + const converted = await convertService.convert(validJsonAsyncAPI2_0_0, '2.4.0'); expect(converted).toEqual({ - asyncapi: '2.3.0', + asyncapi: '2.4.0', info: { title: 'Super test', version: '1.0.0' @@ -55,7 +55,7 @@ describe('ConvertService', () => { const converted = await convertService.convert(validJsonAsyncAPI2_0_0); expect(converted).toEqual({ - asyncapi: '2.3.0', + asyncapi: '2.4.0', info: { title: 'Super test', version: '1.0.0' @@ -65,9 +65,9 @@ describe('ConvertService', () => { }); it('should correctly convert JSON to YAML', async () => { - const converted = await convertService.convert(validJsonAsyncAPI2_0_0, '2.3.0', 'yaml'); + const converted = await convertService.convert(validJsonAsyncAPI2_0_0, '2.4.0', 'yaml'); - expect(converted).toEqual(validYamlAsyncAPI2_3_0.trimStart()); + expect(converted).toEqual(validYamlAsyncAPI2_4_0.trimStart()); }); }); });