Skip to content

Commit

Permalink
fix(JSON Schema): Only add definitions if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Jan 31, 2020
1 parent f03d04c commit dfa59cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ts/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,11 @@ const processSchema = (schemas: Map<string, Schema>, schema: Schema): void => {

// Extend `definitions` (these may be required for inline $refs
// in inherited properties to work)
schema.definitions = {
...cloneDeep(parent.definitions),
...(schema.definitions ?? {})
if (parent.definitions !== undefined) {
schema.definitions = {
...cloneDeep(parent.definitions),
...(schema.definitions ?? {})
}
}

// Flag inherited, but newly required properties, as overrides
Expand Down

0 comments on commit dfa59cb

Please sign in to comment.