Hi there,
I have an OpenApi specification which serves as the source of truth of what the bruno collection shall be.
I use a custom JS script in Github CI to convert the OAS to bruno by calling openapiToBruno.
How can I update the existing collection (bruno.json + collection.bru) using the generated bruno-collection.json file?
In other words - how can I ensure that the bruno collection is up to date with an OpenApi spec?
My general use case is like this:
- Api design happens in repository A which contains OAS (+ app code)
- after merge to main branch: copy OAS to repository B (our store for bruno) (via GH workflows)
- repository B workflow trigger on push branch 'main' calls custom JS to read new OAS
Example code below.
async function main() {
const oas = await readFile('openapi.yaml');
const bruno = openApiToBruno(oas);
await saveFile('bruno-collection.json', JSON.stringify(bruno, null, 2));
}
main();