Skip to content

Instantly share code, notes, and snippets.

@Souvikns
Created March 10, 2022 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Souvikns/973603a64aab2213743ca3cb13d62b85 to your computer and use it in GitHub Desktop.
Save Souvikns/973603a64aab2213743ca3cb13d62b85 to your computer and use it in GitHub Desktop.
POC for JSON schema integration of AsyncAPI internal tools
// 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;
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