Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions demo/examples/tests/oneOf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,46 @@ paths:
- type: boolean
- type: "null"

/oneof-primitive-formats:
get:
tags:
- oneOf
summary: oneOf with Primitive Format Types
description: |
Primitive types with format should display as `type<format>` (e.g., `string<date-time>`).

Schema:
```yaml
type: object
properties:
oneOfProperty:
oneOf:
- type: string
format: date-time
- type: string
format: email
- type: integer
format: int64
- type: string
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
oneOfProperty:
oneOf:
- type: string
format: date-time
- type: string
format: email
- type: integer
format: int64
- type: string

/oneof-complex-types:
get:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ const AnyOneOf: React.FC<SchemaProps> = ({ schema, schemaType }) => {
</span>
<SchemaTabs groupId={`schema-${uniqueId}`} lazy>
{schema[key]?.map((anyOneSchema: any, index: number) => {
// Use getSchemaName to include format info (e.g., "string<date-time>")
const computedSchemaName = getSchemaName(anyOneSchema);

// Determine label for the tab
// If schema is just oneOf/anyOf without title/type, use a generic label
let label = anyOneSchema.title || anyOneSchema.type;
// Prefer explicit title, then computed schema name, then raw type
let label =
anyOneSchema.title || computedSchemaName || anyOneSchema.type;
if (!label) {
if (anyOneSchema.oneOf) {
label = translate({
Expand Down Expand Up @@ -175,7 +179,7 @@ const AnyOneOf: React.FC<SchemaProps> = ({ schema, schemaType }) => {
<SchemaItem
collapsible={false}
name={undefined}
schemaName={anyOneSchema.type}
schemaName={computedSchemaName}
qualifierMessage={getQualifierMessage(anyOneSchema)}
schema={anyOneSchema}
discriminator={false}
Expand All @@ -192,7 +196,7 @@ const AnyOneOf: React.FC<SchemaProps> = ({ schema, schemaType }) => {
<SchemaItem
collapsible={false}
name={undefined}
schemaName={anyOneSchema.type}
schemaName={computedSchemaName}
qualifierMessage={getQualifierMessage(anyOneSchema)}
schema={anyOneSchema}
discriminator={false}
Expand Down
Loading