From 9a2b646d23cec2b7434f9bc05ae1ec6be59afc63 Mon Sep 17 00:00:00 2001 From: Mahtis Michel Date: Thu, 18 Mar 2021 22:37:02 +0100 Subject: [PATCH] fix: response examples fallback (#7065) --- src/core/components/response.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/components/response.jsx b/src/core/components/response.jsx index c1082650..48804920 100644 --- a/src/core/components/response.jsx +++ b/src/core/components/response.jsx @@ -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) {