diff --git a/package-lock.json b/package-lock.json index aa06613de3f..c3725b319bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -754,6 +754,19 @@ "semver": "bin/semver" } }, + "node_modules/@asyncapi/generator/node_modules/@smoya/multi-parser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smoya/multi-parser/-/multi-parser-4.0.0.tgz", + "integrity": "sha512-NgPxSaB3YqwrIVe7AtQ/wh9I2J0BHR4lP0PdqirYYrc0XXRwdDjIRrywEc2jjECWsL7tuGU/QtGMGIVaJe6ZYA==", + "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" + } + }, "node_modules/@asyncapi/generator/node_modules/argparse": { "version": "1.0.10", "license": "MIT", @@ -804,6 +817,55 @@ } } }, + "node_modules/@asyncapi/generator/node_modules/parserv3": { + "name": "@asyncapi/parser", + "version": "3.0.0-next-major-spec.5", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.0-next-major-spec.5.tgz", + "integrity": "sha512-+Da9ZPToTcEVIYtR2wlgeQOkd3+iwMf0Ah+uKA1rDyLj7UZ9UtEANnD1tmi4ONymqGwhneVOwBAu6K/dO36Vmw==", + "dependencies": { + "@asyncapi/specs": "^6.0.0-next-major-spec.6", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@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", + "@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", + "ramldt2jsonschema": "^1.2.3", + "webapi-parser": "^0.5.0" + } + }, + "node_modules/@asyncapi/generator/node_modules/parserv3/node_modules/@asyncapi/specs": { + "version": "6.0.0-next-major-spec.9", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.0.0-next-major-spec.9.tgz", + "integrity": "sha512-fmOITQoYMw3I2Vai7u/vT0q4yHMBkeXTPByHhrqCaxnwX59Yb2vsMmukHjq478qqCP/U/TmzVvGpEy0JBMaelw==", + "dependencies": { + "@types/json-schema": "^7.0.11" + } + }, + "node_modules/@asyncapi/generator/node_modules/parserv3/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/@asyncapi/generator/node_modules/parserv3/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@asyncapi/generator/node_modules/react": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", diff --git a/src/commands/generate/fromTemplate.ts b/src/commands/generate/fromTemplate.ts index 81624dc5cb3..e53ea665cb2 100644 --- a/src/commands/generate/fromTemplate.ts +++ b/src/commands/generate/fromTemplate.ts @@ -32,7 +32,6 @@ interface ParsedFlags { const templatesNotSupportingV3: Record = { '@asyncapi/minimaltemplate': 'some link', // For testing purpose - '@asyncapi/html-template': 'https://github.com/asyncapi/html-template/issues/430', '@asyncapi/dotnet-nats-template': 'https://github.com/asyncapi/dotnet-nats-template/issues/384', '@asyncapi/ts-nats-template': 'https://github.com/asyncapi/ts-nats-template/issues/545', '@asyncapi/python-paho-template': 'https://github.com/asyncapi/python-paho-template/issues/189', @@ -40,7 +39,6 @@ const templatesNotSupportingV3: Record = { '@asyncapi/java-spring-cloud-stream-template': 'https://github.com/asyncapi/java-spring-cloud-stream-template/issues/336', '@asyncapi/go-watermill-template': 'https://github.com/asyncapi/go-watermill-template/issues/243', '@asyncapi/java-spring-template': 'https://github.com/asyncapi/java-spring-template/issues/308', - '@asyncapi/markdown-template': 'https://github.com/asyncapi/markdown-template/issues/341', '@asyncapi/nodejs-template': 'https://github.com/asyncapi/nodejs-template/issues/215', '@asyncapi/java-template': 'https://github.com/asyncapi/java-template/issues/118', '@asyncapi/php-template': 'https://github.com/asyncapi/php-template/issues/191' diff --git a/test/fixtures/specification-v3.yml b/test/fixtures/specification-v3.yml index 93cdabbb181..05cc8a0d556 100644 --- a/test/fixtures/specification-v3.yml +++ b/test/fixtures/specification-v3.yml @@ -44,7 +44,7 @@ servers: scopes: - 'write:pets' - type: openIdConnect - openIdConnectUrl: openIdConnectUrl + openIdConnectUrl: https://example.com/api scopes: - 'some:scope:1' - 'some:scope:2' @@ -102,8 +102,6 @@ channels: subscribe.message.2: payload: type: object - subscribe.message.3: - $ref: 'https://example.com/message' servers: - $ref: '#/servers/default' - $ref: '#/servers/production' @@ -154,7 +152,6 @@ operations: #/channels/smartylighting~1streetlights~11~10~1action~1{streetlightId}~1turn~1on/messages/customMessageId - $ref: >- #/channels/smartylighting~1streetlights~11~10~1action~1{streetlightId}~1turn~1on/messages/subscribe.message.2 - - $ref: 'https://example.com/message' turnOnOff: action: send channel: @@ -243,8 +240,10 @@ components: 'write:pets': modify pets in your account 'read:pets': read your pets openIdConnect: - type: openIdConnect - openIdConnectUrl: openIdConnectUrl + openIdConnectUrl: https://example.com/api + scopes: + - 'some:scope:1' + - 'some:scope:2' unusedFlows: type: oauth2 flows: diff --git a/test/integration/generate/fromTemplate.test.ts b/test/integration/generate/fromTemplate.test.ts index c4265d201bb..742aaa32b76 100644 --- a/test/integration/generate/fromTemplate.test.ts +++ b/test/integration/generate/fromTemplate.test.ts @@ -23,7 +23,7 @@ describe('template', () => { test .stdout() .command([...generalOptions, '--output=./test/docs/1', '--force-write']) - .it('should generate minimal tempalte', (ctx, done) => { + .it('should generate minimal template', (ctx, done) => { expect(ctx.stdout).to.contain( 'Check out your shiny new generated files at ./test/docs/1.\n\n' ); @@ -39,12 +39,13 @@ describe('template', () => { 'generate:fromTemplate', asyncapiv3, '@asyncapi/minimaltemplate']) - .it('give error', (ctx, done) => { + .it('give error on disabled template', (ctx, done) => { expect(ctx.stderr).to.equal('Error: @asyncapi/minimaltemplate template does not support AsyncAPI v3 documents, please checkout some link\n'); expect(ctx.stdout).to.equal(''); done(); }); - }); + }).timeout(200000); + describe('git clash', () => { const pathToOutput = './test/docs/2'; before(() => {