From 6e558490be286bddf6b09d6ff2bc093769123aef Mon Sep 17 00:00:00 2001 From: "Marc L." Date: Fri, 8 Nov 2024 10:56:01 -0800 Subject: [PATCH] Support schemas with array of types (#1017) * Add support for array of types * Add example for multiple types --- demo/examples/petstore-1.0.0.yaml | 8 ++++++-- .../src/theme/SchemaItem/index.tsx | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/demo/examples/petstore-1.0.0.yaml b/demo/examples/petstore-1.0.0.yaml index 7fde9ea1d..3c5e1c0d2 100644 --- a/demo/examples/petstore-1.0.0.yaml +++ b/demo/examples/petstore-1.0.0.yaml @@ -242,10 +242,14 @@ paths: properties: name: description: Updated name of the pet - type: string + type: + - string + - "null" status: description: Updated status of the pet - type: string + type: + - string + - "null" delete: tags: - pet diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/SchemaItem/index.tsx b/packages/docusaurus-theme-openapi-docs/src/theme/SchemaItem/index.tsx index ead487674..48ab32d80 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/SchemaItem/index.tsx +++ b/packages/docusaurus-theme-openapi-docs/src/theme/SchemaItem/index.tsx @@ -195,7 +195,9 @@ export default function SchemaItem(props: Props) { > {name} - {schemaName} + + {Array.isArray(schemaName) ? schemaName.join(" | ") : schemaName} + {(nullable || required || deprecated) && ( )}