-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bundle references into components (#46)
- Loading branch information
Showing
17 changed files
with
470 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
asyncapi: 2.2.0 | ||
info: | ||
title: Account Service | ||
version: 1.0.0 | ||
description: This service is in charge of processing user signups | ||
channels: | ||
user/signup: | ||
subscribe: | ||
message: | ||
$ref: '#/components/messages/UserSignedUp' | ||
test: | ||
subscribe: | ||
message: | ||
$ref: '#/components/messages/TestMessage' | ||
components: | ||
messages: | ||
TestMessage: | ||
payload: | ||
type: string | ||
UserSignedUp: | ||
payload: | ||
type: object | ||
properties: | ||
displayName: | ||
type: string | ||
description: Name of the user | ||
email: | ||
type: string | ||
format: email | ||
description: Email of the user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const bundle = require('@asyncapi/bundler'); | ||
const fs = require('fs'); | ||
|
||
async function main() { | ||
const document = await bundle([fs.readFileSync('./main.yaml', 'utf-8')], { | ||
referenceIntoComponents: true | ||
}); | ||
fs.writeFileSync('asyncapi.yaml', document.yml()); | ||
} | ||
|
||
main().catch(e => console.error(e)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
asyncapi: '2.2.0' | ||
info: | ||
title: Account Service | ||
version: 1.0.0 | ||
description: This service is in charge of processing user signups | ||
channels: | ||
user/signup: | ||
subscribe: | ||
message: | ||
$ref: './messages.yaml#/messages/UserSignedUp' | ||
test: | ||
subscribe: | ||
message: | ||
$ref: '#/components/messages/TestMessage' | ||
components: | ||
messages: | ||
TestMessage: | ||
payload: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
messages: | ||
UserSignedUp: | ||
payload: | ||
type: object | ||
properties: | ||
displayName: | ||
type: string | ||
description: Name of the user | ||
email: | ||
type: string | ||
format: email | ||
description: Email of the user | ||
UserLoggedIn: | ||
payload: | ||
type: object | ||
properties: | ||
id: string |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.