Skip to content

Commit

Permalink
fix: preprocessor fails if it cannot dereference a path. skip it.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdimascio committed Jan 2, 2021
1 parent 61b698a commit 57324ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/middlewares/parsers/schema.preprocessor.ts
Expand Up @@ -171,6 +171,12 @@ export class SchemaPreprocessor {
const recurse = (parent, node, opts: TraversalStates) => {
const schema = this.resolveSchema<SchemaObject>(node.schema);

if (!schema) {
// if we can't resolve the schema, skip it
// TODO fix me - must resolve $refs like, etc
// #/paths/~1subscription/get/requestBody/content/application~1json/schema/properties/subscription
return;
}
// Save the original schema so we can check if it was a $ref
(<any>opts).req.originalSchema = node.schema;
(<any>opts).res.originalSchema = node.schema;
Expand Down

0 comments on commit 57324ee

Please sign in to comment.