Skip to content

Commit

Permalink
feat: enable html and markdown template for AsyncAPI v3 (#819)
Browse files Browse the repository at this point in the history
Co-authored-by: souvik <[email protected]>
  • Loading branch information
jonaslagoni and Souvikns authored Oct 26, 2023
1 parent 2cdff35 commit b0dd5f8
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 11 deletions.
62 changes: 62 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/commands/generate/fromTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ interface ParsedFlags {

const templatesNotSupportingV3: Record<string, string> = {
'@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',
'@asyncapi/nodejs-ws-template': 'https://github.com/asyncapi/nodejs-ws-template/issues/294',
'@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'
Expand Down
11 changes: 5 additions & 6 deletions test/fixtures/specification-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ servers:
scopes:
- 'write:pets'
- type: openIdConnect
openIdConnectUrl: openIdConnectUrl
openIdConnectUrl: https://example.com/api
scopes:
- 'some:scope:1'
- 'some:scope:2'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions test/integration/generate/fromTemplate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand All @@ -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(() => {
Expand Down

0 comments on commit b0dd5f8

Please sign in to comment.