in generator/generate.ts [296:309]
export async function saveAutoGeneratedSchemaRefs(schemaConfigs: SchemaConfiguration[], isGenerateAll: boolean) {
for (const [scopeType, rootSchemaConfig] of RootSchemaConfigs) {
const refs = flatten(schemaConfigs
.map(c => c.references
.filter(x => x.scope & scopeType)
.map(x => `${constants.schemasBaseUri}/${c.relativePath}#/${x.reference}`)));
const currentRefs = !isGenerateAll ? await getCurrentTemplateRefs(scopeType, rootSchemaConfig): [];
const newRefs = uniq(concat(currentRefs, refs)).sort(schemaRefComparer);
const template = await readJsonFile(rootSchemaConfig.file);
set(template, rootSchemaConfig.jsonPath, newRefs.map(ref => ({ '$ref': ref })));
await writeJsonFile(rootSchemaConfig.file, template);
}
}