mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +03:00
fix: make oneOf not skip fields defined alongside
This commit is contained in:
parent
bdf60794f3
commit
334a0a07da
|
@ -147,8 +147,15 @@ export class SchemaModel {
|
||||||
private initOneOf(oneOf: OpenAPISchema[], parser: OpenAPIParser) {
|
private initOneOf(oneOf: OpenAPISchema[], parser: OpenAPIParser) {
|
||||||
this.oneOf = oneOf!.map(
|
this.oneOf = oneOf!.map(
|
||||||
(variant, idx) =>
|
(variant, idx) =>
|
||||||
// TODO: merge base schema into each oneOf
|
new SchemaModel(
|
||||||
new SchemaModel(parser, variant, this._$ref + '/oneOf/' + idx, this.options),
|
parser,
|
||||||
|
{
|
||||||
|
// merge base schema into each of oneOf's subschemas
|
||||||
|
allOf: [variant, { ...this.schema, oneOf: undefined, anyOf: undefined }],
|
||||||
|
} as OpenAPISchema,
|
||||||
|
this._$ref + '/oneOf/' + idx,
|
||||||
|
this.options,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
this.displayType = this.oneOf.map(schema => schema.displayType).join(' or ');
|
this.displayType = this.oneOf.map(schema => schema.displayType).join(' or ');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user