Skip to content

Commit

Permalink
Add more test cases for oneOf schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
hss-mateus committed Feb 8, 2024
1 parent 854f102 commit 67ab5cf
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 21 deletions.
42 changes: 30 additions & 12 deletions spec/rails/doc/smart/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,22 @@ paths:
discriminator:
propertyName: name
oneOf:
- type: array
items:
type: object
properties:
name:
type: string
host:
type: string
port:
type: integer
user:
type: string
schema:
type: string
- type: object
properties:
id:
type: integer
name:
type: string
required:
- id
- name
- type: object
properties:
name:
type: string
host:
type: string
port:
Expand All @@ -138,6 +141,19 @@ paths:
type: string
schema:
type: string
required:
- host
- port
- schema
- type: object
properties:
id:
type: integer
name:
type: string
required:
- id
- name
null_sample:
nullable: true
storage_size:
Expand Down Expand Up @@ -176,7 +192,9 @@ paths:
content:
application/json:
schema:
"$ref": "#/components/schemas/PostUsersRequest"
oneOf:
- "$ref": "#/components/schemas/PostUsersRequest"
- type: string
example:
name: alice
avatar_url: "https://example.com/avatar.png"
Expand Down
30 changes: 21 additions & 9 deletions spec/rails/doc/smart/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,22 @@ paths:
discriminator:
propertyName: name
oneOf:
- type: array
items:
type: object
properties:
name:
type: string
host:
type: string
port:
type: integer
user:
type: string
schema:
type: string
- type: object
properties:
id:
type: integer
name:
type: string
- type: object
properties:
name:
type: string
host:
type: string
port:
Expand All @@ -195,6 +201,10 @@ paths:
type: string
schema:
type: string
required:
- host
- port
- schema
null_sample:
nullable: true
storage_size:
Expand Down Expand Up @@ -227,7 +237,9 @@ paths:
content:
application/json:
schema:
"$ref": "#/components/schemas/PostUsersRequest"
oneOf:
- "$ref": "#/components/schemas/PostUsersRequest"
- type: string
responses:
'201':
description: returns a user
Expand Down

0 comments on commit 67ab5cf

Please sign in to comment.