Skip to content

Commit 81b372f

Browse files
authored
Fix response example when response example is a string (#2377)
1 parent 966e520 commit 81b372f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-openapi/src/OpenAPIResponseExample.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ export function OpenAPIResponseExample(props: {
6262

6363
return (
6464
<InteractiveSection header="Response" className="openapi-response-example">
65-
<context.CodeBlock code={JSON.stringify(example, null, 2)} syntax="json" />
65+
<context.CodeBlock
66+
code={typeof example === 'string' ? example : JSON.stringify(example, null, 2)}
67+
syntax="json"
68+
/>
6669
</InteractiveSection>
6770
);
6871
}

0 commit comments

Comments
 (0)