mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-09 14:44:51 +03:00
Sandbox refs inside of allOf schemas
This commit is contained in:
parent
afc7e36cf8
commit
561f146803
|
@ -198,18 +198,19 @@ export class OpenAPIParser {
|
||||||
receiver.items = { ...receiver.items };
|
receiver.items = { ...receiver.items };
|
||||||
}
|
}
|
||||||
|
|
||||||
const allOfSchemas = schema.allOf.map(subSchema => {
|
const originalRefCounts = { ...this._refCounter._counter };
|
||||||
const resolved = this.deref(subSchema, forceCircular);
|
const originalRefCounter = this._refCounter;
|
||||||
const subRef = subSchema.$ref || undefined;
|
|
||||||
const subMerged = this.mergeAllOf(resolved, subRef, forceCircular);
|
for (const rawSubSchema of schema.allOf) {
|
||||||
receiver.parentRefs!.push(...(subMerged.parentRefs || []));
|
const resolved = this.deref(rawSubSchema, forceCircular);
|
||||||
return {
|
|
||||||
$ref: subRef,
|
this._refCounter = new RefCounter();
|
||||||
schema: subMerged,
|
this._refCounter._counter = { ...originalRefCounts };
|
||||||
};
|
|
||||||
});
|
const subSchemaRef = rawSubSchema.$ref || undefined;
|
||||||
|
const subSchema = this.mergeAllOf(resolved, subSchemaRef, forceCircular);
|
||||||
|
receiver.parentRefs!.push(...(subSchema.parentRefs || []));
|
||||||
|
|
||||||
for (const { $ref: subSchemaRef, schema: subSchema } of allOfSchemas) {
|
|
||||||
if (
|
if (
|
||||||
receiver.type !== subSchema.type &&
|
receiver.type !== subSchema.type &&
|
||||||
receiver.type !== undefined &&
|
receiver.type !== undefined &&
|
||||||
|
@ -262,6 +263,8 @@ export class OpenAPIParser {
|
||||||
// receiver.title = JsonPointer.baseName(subSchemaRef);
|
// receiver.title = JsonPointer.baseName(subSchemaRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._refCounter = originalRefCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return receiver;
|
return receiver;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user