Skip to content

Commit c56cc6c

Browse files
committed
Indent JSON python code sample
1 parent 19c20c0 commit c56cc6c

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

.changeset/rotten-seals-rush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/react-openapi': patch
3+
---
4+
5+
Indent JSON python code sample

packages/react-openapi/src/code-samples.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -356,18 +356,22 @@ const BodyGenerators = {
356356
// Convert JSON to XML if needed
357357
body = JSON.stringify(convertBodyToXML(body));
358358
} else {
359-
body = stringifyOpenAPI(body, (_key, value) => {
360-
switch (value) {
361-
case true:
362-
return '$$__TRUE__$$';
363-
case false:
364-
return '$$__FALSE__$$';
365-
case null:
366-
return '$$__NULL__$$';
367-
default:
368-
return value;
369-
}
370-
})
359+
body = stringifyOpenAPI(
360+
body,
361+
(_key, value) => {
362+
switch (value) {
363+
case true:
364+
return '$$__TRUE__$$';
365+
case false:
366+
return '$$__FALSE__$$';
367+
case null:
368+
return '$$__NULL__$$';
369+
default:
370+
return value;
371+
}
372+
},
373+
2
374+
)
371375
.replaceAll('"$$__TRUE__$$"', 'True')
372376
.replaceAll('"$$__FALSE__$$"', 'False')
373377
.replaceAll('"$$__NULL__$$"', 'None');

0 commit comments

Comments
 (0)