Skip to content

Instantly share code, notes, and snippets.

@kroo
Created December 4, 2017 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kroo/9a003d92762d2740bca56b52f2d4956c to your computer and use it in GitHub Desktop.
Save kroo/9a003d92762d2740bca56b52f2d4956c to your computer and use it in GitHub Desktop.
Fix for infinite recursion in ReDoc 2.0.0-alpha.4
diff --git a/src/services/models/Schema.ts b/src/services/models/Schema.ts
index c53219e..20cbabf 100644
--- a/src/services/models/Schema.ts
+++ b/src/services/models/Schema.ts
@@ -67,11 +67,13 @@ export class SchemaModel {
this.schema = parser.mergeAllOf(this.rawSchema, this._$ref, isChild);
this.init(parser, isChild);
- parser.exitRef(schemaOrRef);
+ if (!this.isCircular) {
+ parser.exitRef(schemaOrRef);
- for (let $ref of this.schema.namedParents || []) {
- // exit all the refs visited during allOf traverse
- parser.exitRef({ $ref });
+ for (let $ref of this.schema.namedParents || []) {
+ // exit all the refs visited during allOf traverse
+ parser.exitRef({ $ref });
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment