Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional oneOf test cases #924

Merged
merged 1 commit into from
Aug 21, 2024
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
264 changes: 264 additions & 0 deletions demo/examples/tests/oneOf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
openapi: 3.0.1
info:
title: OneOf Variations API
description: Demonstrates various oneOf schema combinations.
version: 1.0.0
tags:
- name: oneOf
description: oneOf tests
paths:
/oneof-primitive-types:
get:
tags:
- oneOf
summary: oneOf with Primitive Types
description: |
Schema:
```yaml
type: object
properties:
oneOfProperty:
oneOf:
- type: string
- type: number
- type: boolean
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
oneOfProperty:
oneOf:
- type: string
- type: number
- type: boolean

/oneof-complex-types:
get:
tags:
- oneOf
summary: oneOf with Complex Types
description: |
Schema:
```yaml
type: object
properties:
oneOfProperty:
oneOf:
- type: object
properties:
objectProp:
type: string
- type: array
items:
type: number
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
oneOfProperty:
oneOf:
- type: object
properties:
objectProp:
type: string
- type: array
items:
type: number

/oneof-nested:
get:
tags:
- oneOf
summary: oneOf with Nested oneOf
description: |
Schema:
```yaml
type: object
properties:
oneOfProperty:
oneOf:
- type: object
properties:
nestedOneOfProp:
oneOf:
- type: string
- type: number
- type: boolean
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
oneOfProperty:
oneOf:
- type: object
properties:
nestedOneOfProp:
oneOf:
- type: string
- type: number
- type: boolean

# /oneof-discriminator:
# get:
# tags:
# - oneOf
# summary: oneOf with Discriminator
# description: |
# Schema:
# ```yaml
# type: object
# discriminator:
# propertyName: type
# properties:
# type:
# type: string
# oneOf:
# - type: object
# properties:
# type:
# type: string
# enum: ["typeA"]
# propA:
# type: string
# required: ["type"]
# - type: object
# properties:
# type:
# type: string
# enum: ["typeB"]
# propB:
# type: number
# required: ["type"]
# ```
# responses:
# '200':
# description: Successful response
# content:
# application/json:
# schema:
# type: object
# discriminator:
# propertyName: type
# properties:
# type:
# type: string
# oneOf:
# - type: object
# properties:
# type:
# type: string
# enum: ["typeA"]
# propA:
# type: string
# required: ["type"]
# - type: object
# properties:
# type:
# type: string
# enum: ["typeB"]
# propB:
# type: number
# required: ["type"]

/oneof-shared-properties:
get:
tags:
- oneOf
summary: oneOf with Shared Properties
description: |
Schema:
```yaml
type: object
properties:
sharedProp:
type: string
oneOfProperty:
oneOf:
- type: object
properties:
specificPropA:
type: string
- type: object
properties:
specificPropB:
type: number
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
sharedProp:
type: string
oneOfProperty:
oneOf:
- type: object
properties:
specificPropA:
type: string
- type: object
properties:
specificPropB:
type: number

/oneof-required-properties:
get:
tags:
- oneOf
summary: oneOf with Required Properties
description: |
Schema:
```yaml
type: object
properties:
oneOfProperty:
oneOf:
- type: object
properties:
requiredPropA:
type: string
required: ["requiredPropA"]
- type: object
properties:
requiredPropB:
type: number
required: ["requiredPropB"]
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
type: object
properties:
oneOfProperty:
oneOf:
- type: object
properties:
requiredPropA:
type: string
required: ["requiredPropA"]
- type: object
properties:
requiredPropB:
type: number
required: ["requiredPropB"]
Loading
Loading