Stringify default value (#3003)

This commit is contained in:
Nolann B.
2025-03-19 21:28:40 +01:00
committed by GitHub
parent bcf877841b
commit 70be2c6b2b
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@gitbook/react-openapi': patch
---
Stringify default value
@@ -1,5 +1,6 @@
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
import type React from 'react';
import { stringifyOpenAPI } from './stringifyOpenAPI';
interface OpenAPISchemaNameProps {
schema?: OpenAPIV3.SchemaObject;
@@ -50,7 +51,7 @@ function getAdditionalItems(schema: OpenAPIV3.SchemaObject): string {
// If the schema has a default value, we display it
if (typeof schema.default !== 'undefined') {
additionalItems += ` · default: ${schema.default}`;
additionalItems += ` · default: ${stringifyOpenAPI(schema.default)}`;
}
if (schema.nullable) {