Skip to content

Commit 70be2c6

Browse files
authored
Stringify default value (#3003)
1 parent bcf8778 commit 70be2c6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/polite-nails-listen.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/react-openapi': patch
3+
---
4+
5+
Stringify default value

packages/react-openapi/src/OpenAPISchemaName.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
22
import type React from 'react';
3+
import { stringifyOpenAPI } from './stringifyOpenAPI';
34

45
interface OpenAPISchemaNameProps {
56
schema?: OpenAPIV3.SchemaObject;
@@ -50,7 +51,7 @@ function getAdditionalItems(schema: OpenAPIV3.SchemaObject): string {
5051

5152
// If the schema has a default value, we display it
5253
if (typeof schema.default !== 'undefined') {
53-
additionalItems += ` · default: ${schema.default}`;
54+
additionalItems += ` · default: ${stringifyOpenAPI(schema.default)}`;
5455
}
5556

5657
if (schema.nullable) {

0 commit comments

Comments
 (0)