in compiler/src/compiler.ts [60:93]
async write (): Promise<void> {
for (const step of this.queue) {
this.model = await step(this.model, this.jsonSpec, this.errors)
}
const customStringify = stringify.configure(
{
deterministic: (a, b) => {
// Make sure the discriminator property is always emitted first
if (a === 'kind') {
return -1
}
if (b === 'kind') {
return 1
}
return a.localeCompare(b)
}
})
await mkdir(join(this.outputFolder, 'schema'), { recursive: true })
await writeFile(
join(this.outputFolder, 'schema', 'schema.json'),
customStringify(this.model, null, 2),
'utf8'
)
this.errors.log()
await writeFile(
join(this.outputFolder, 'schema', 'validation-errors.json'),
stringify(this.errors, null, 2),
'utf8'
)
}