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) {
|
if (this.schema && this.schema.oneOf) {
|
||||||
this.examples = {};
|
this.examples = {};
|
||||||
for (const subSchema of this.schema.oneOf) {
|
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] = {
|
this.examples[subSchema.title] = {
|
||||||
value: Sampler.sample(
|
value: sample,
|
||||||
subSchema.rawSchema,
|
|
||||||
{ skipReadOnly: this.isRequestType, skipWriteOnly: !this.isRequestType },
|
|
||||||
parser.spec,
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user