mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-09 22:54:51 +03:00
Add field caching to avoid out of memory exception.
This commit is contained in:
parent
c05db38576
commit
02c1f4d72a
|
@ -275,12 +275,17 @@ export class SchemaModel {
|
|||
}
|
||||
}
|
||||
|
||||
const fieldCache: { [index: string]: FieldModel[] } = {};
|
||||
|
||||
function buildFields(
|
||||
parser: OpenAPIParser,
|
||||
schema: OpenAPISchema,
|
||||
$ref: string,
|
||||
options: RedocNormalizedOptions,
|
||||
): FieldModel[] {
|
||||
if (fieldCache[$ref]) {
|
||||
return fieldCache[$ref];
|
||||
}
|
||||
const props = schema.properties || {};
|
||||
const additionalProps = schema.additionalProperties;
|
||||
const defaults = schema.default || {};
|
||||
|
@ -339,6 +344,8 @@ function buildFields(
|
|||
);
|
||||
}
|
||||
|
||||
fieldCache[$ref] = fields;
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user