diff --git a/src/middlewares/parsers/schema.preprocessor.ts b/src/middlewares/parsers/schema.preprocessor.ts index ab557617..ba8cd9e3 100644 --- a/src/middlewares/parsers/schema.preprocessor.ts +++ b/src/middlewares/parsers/schema.preprocessor.ts @@ -249,9 +249,11 @@ export class SchemaPreprocessor { const options = opts[kind]; options.path = node.path; - this.handleSerDes(pschema, nschema, options); - this.handleReadonly(pschema, nschema, options); - this.processDiscriminator(pschema, nschema, options); + if (nschema) { + this.handleSerDes(pschema, nschema, options); + this.handleReadonly(pschema, nschema, options); + this.processDiscriminator(pschema, nschema, options); + } } }