Skip to content

Commit

Permalink
Fix ajv logging warnings when discriminators are combined with 's (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
alonsohki authored Sep 12, 2021
1 parent fc603f7 commit 522c3ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/middlewares/parsers/schema.preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,15 @@ export class SchemaPreprocessor {

if (options.length > 0) {
const newSchema = JSON.parse(JSON.stringify(schemaObj));
newSchema.properties = {

const newProperties = {
...(o.properties ?? {}),
...(newSchema.properties ?? {}),
};
if(Object.keys(newProperties).length > 0) {
newSchema.properties = newProperties;
}

newSchema.required = o.required;
if (newSchema.required.length === 0) {
delete newSchema.required;
Expand Down

0 comments on commit 522c3ec

Please sign in to comment.