fix: response examples fallback (#7065)
This commit is contained in:
@@ -133,11 +133,13 @@ export default class Response extends React.Component {
|
|||||||
sampleSchema = activeMediaType.get("schema", Map({})).toJS()
|
sampleSchema = activeMediaType.get("schema", Map({})).toJS()
|
||||||
if(examplesForMediaType) {
|
if(examplesForMediaType) {
|
||||||
const targetExamplesKey = this.getTargetExamplesKey()
|
const targetExamplesKey = this.getTargetExamplesKey()
|
||||||
mediaTypeExample = examplesForMediaType
|
const targetExample = examplesForMediaType
|
||||||
.get(targetExamplesKey, Map({}))
|
.get(targetExamplesKey, Map({}))
|
||||||
.get("value")
|
const getMediaTypeExample = (targetExample) =>
|
||||||
|
targetExample.get("value")
|
||||||
|
mediaTypeExample = getMediaTypeExample(targetExample)
|
||||||
if(mediaTypeExample === undefined) {
|
if(mediaTypeExample === undefined) {
|
||||||
mediaTypeExample = examplesForMediaType.values().next().value
|
mediaTypeExample = getMediaTypeExample(examplesForMediaType.values().next().value)
|
||||||
}
|
}
|
||||||
shouldOverrideSchemaExample = true
|
shouldOverrideSchemaExample = true
|
||||||
} else if(activeMediaType.get("example") !== undefined) {
|
} else if(activeMediaType.get("example") !== undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user