Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support 2.4.0 AsyncAPI #93

Merged
merged 2 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -298,6 +299,7 @@ components:
- '2.1.0'
- '2.2.0'
- '2.3.0'
- '2.4.0'
- 'latest'

ValidateRequest:
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions src/controllers/tests/convert.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -78,19 +78,19 @@ 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();

return request(app.getServer())
.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'
Expand All @@ -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'
Expand All @@ -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, {
Expand Down
16 changes: 8 additions & 8 deletions src/services/tests/convert.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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());
});
});
});