Skip to content

Commit 6e55849

Browse files
authored
Support schemas with array of types (#1017)
* Add support for array of types * Add example for multiple types
1 parent 875f84c commit 6e55849

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

demo/examples/petstore-1.0.0.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,14 @@ paths:
242242
properties:
243243
name:
244244
description: Updated name of the pet
245-
type: string
245+
type:
246+
- string
247+
- "null"
246248
status:
247249
description: Updated status of the pet
248-
type: string
250+
type:
251+
- string
252+
- "null"
249253
delete:
250254
tags:
251255
- pet

packages/docusaurus-theme-openapi-docs/src/theme/SchemaItem/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ export default function SchemaItem(props: Props) {
195195
>
196196
{name}
197197
</strong>
198-
<span className="openapi-schema__name"> {schemaName}</span>
198+
<span className="openapi-schema__name">
199+
{Array.isArray(schemaName) ? schemaName.join(" | ") : schemaName}
200+
</span>
199201
{(nullable || required || deprecated) && (
200202
<span className="openapi-schema__divider"></span>
201203
)}

0 commit comments

Comments
 (0)