Skip to content

Commit

Permalink
fix: do preprocessing upon construction of generator
Browse files Browse the repository at this point in the history
fix #491
  • Loading branch information
bdm-k committed Nov 28, 2023
1 parent c05108d commit ee62a62
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/codegen/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ export default class ApiGenerator {
public readonly opts: Opts = {},
/** Indicates if the document was converted from an older version of the OpenAPI specification. */
public readonly isConverted = false,
) {}
) {
if (this.spec.components?.schemas) {
this.preprocessComponents(this.spec.components.schemas);
}
}

// see `preprocessComponents` for the definition of a discriminating schema
discriminatingSchemas: Set<string> = new Set();
Expand Down Expand Up @@ -1092,10 +1096,6 @@ export default class ApiGenerator {
// Keep track of names to detect duplicates
const names: Record<string, number> = {};

if (this.spec.components?.schemas) {
this.preprocessComponents(this.spec.components.schemas);
}

Object.keys(this.spec.paths).forEach((path) => {
const item = this.spec.paths[path];

Expand Down

0 comments on commit ee62a62

Please sign in to comment.