mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 13:30:33 +03:00
parent
133f9f0d12
commit
5dae267a54
|
@ -42,12 +42,18 @@ export class MediaTypeModel {
|
|||
if (this.schema && this.schema.oneOf) {
|
||||
this.examples = {};
|
||||
for (const subSchema of this.schema.oneOf) {
|
||||
const sample = Sampler.sample(
|
||||
subSchema.rawSchema,
|
||||
{ skipReadOnly: this.isRequestType, skipWriteOnly: !this.isRequestType },
|
||||
parser.spec,
|
||||
);
|
||||
|
||||
if (this.schema.discriminatorProp && typeof sample === 'object' && sample) {
|
||||
sample[this.schema.discriminatorProp] = subSchema.title;
|
||||
}
|
||||
|
||||
this.examples[subSchema.title] = {
|
||||
value: Sampler.sample(
|
||||
subSchema.rawSchema,
|
||||
{ skipReadOnly: this.isRequestType, skipWriteOnly: !this.isRequestType },
|
||||
parser.spec,
|
||||
),
|
||||
value: sample,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user