mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 17:43:24 +00:00
Stringify default value (#3003)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@gitbook/react-openapi': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Stringify default value
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
|
import { stringifyOpenAPI } from './stringifyOpenAPI';
|
||||||
|
|
||||||
interface OpenAPISchemaNameProps {
|
interface OpenAPISchemaNameProps {
|
||||||
schema?: OpenAPIV3.SchemaObject;
|
schema?: OpenAPIV3.SchemaObject;
|
||||||
@@ -50,7 +51,7 @@ function getAdditionalItems(schema: OpenAPIV3.SchemaObject): string {
|
|||||||
|
|
||||||
// If the schema has a default value, we display it
|
// If the schema has a default value, we display it
|
||||||
if (typeof schema.default !== 'undefined') {
|
if (typeof schema.default !== 'undefined') {
|
||||||
additionalItems += ` · default: ${schema.default}`;
|
additionalItems += ` · default: ${stringifyOpenAPI(schema.default)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (schema.nullable) {
|
if (schema.nullable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user