Created
March 10, 2022 07:25
-
-
Save Souvikns/973603a64aab2213743ca3cb13d62b85 to your computer and use it in GitHub Desktop.
POC for JSON schema integration of AsyncAPI internal tools
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
// bundler integration function | |
const bundle = require('@asyncapi/bundler'); | |
async function bundler(inputs,options, output) { | |
const files = inputs.files; | |
const base = options.base; | |
const format = output.format; | |
const document = await bundle(files, { | |
base: base | |
}) | |
if(format === 'json') { | |
return document.json() | |
} | |
if(format === 'yaml') { | |
return document.yml() | |
} | |
if(format == 'string') { | |
return document.string(); | |
} | |
return format.json(); | |
} | |
module.exports = bundler; |
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
type: object | |
properties: | |
name: | |
type: 'string' | |
inputs: | |
type: object | |
properties: | |
files: | |
type: array | |
items: | |
type: string | |
options: | |
type: object | |
properties: | |
base: | |
type: string | |
output: | |
type: object | |
properties: | |
format: | |
enum: | |
- json | |
- yaml | |
required: ['name', 'inputs', 'files'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment