Skip to content

Commit

Permalink
fix: response examples fallback (#7065)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis-m committed Mar 18, 2021
1 parent 56168eb commit 9a2b646
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/components/response.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ export default class Response extends React.Component {
sampleSchema = activeMediaType.get("schema", Map({})).toJS()
if(examplesForMediaType) {
const targetExamplesKey = this.getTargetExamplesKey()
mediaTypeExample = examplesForMediaType
const targetExample = examplesForMediaType
.get(targetExamplesKey, Map({}))
.get("value")
const getMediaTypeExample = (targetExample) =>
targetExample.get("value")
mediaTypeExample = getMediaTypeExample(targetExample)
if(mediaTypeExample === undefined) {
mediaTypeExample = examplesForMediaType.values().next().value
mediaTypeExample = getMediaTypeExample(examplesForMediaType.values().next().value)
}
shouldOverrideSchemaExample = true
} else if(activeMediaType.get("example") !== undefined) {
Expand Down

0 comments on commit 9a2b646

Please sign in to comment.