Skip to content

Commit 9a2b646

Browse files
authored
fix: response examples fallback (#7065)
1 parent 56168eb commit 9a2b646

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/core/components/response.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@ export default class Response extends React.Component {
133133
sampleSchema = activeMediaType.get("schema", Map({})).toJS()
134134
if(examplesForMediaType) {
135135
const targetExamplesKey = this.getTargetExamplesKey()
136-
mediaTypeExample = examplesForMediaType
136+
const targetExample = examplesForMediaType
137137
.get(targetExamplesKey, Map({}))
138-
.get("value")
138+
const getMediaTypeExample = (targetExample) =>
139+
targetExample.get("value")
140+
mediaTypeExample = getMediaTypeExample(targetExample)
139141
if(mediaTypeExample === undefined) {
140-
mediaTypeExample = examplesForMediaType.values().next().value
142+
mediaTypeExample = getMediaTypeExample(examplesForMediaType.values().next().value)
141143
}
142144
shouldOverrideSchemaExample = true
143145
} else if(activeMediaType.get("example") !== undefined) {

0 commit comments

Comments
 (0)