-
Notifications
You must be signed in to change notification settings - Fork 85
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
Support anyOf, oneOf, and not in ExampleBuilder in 3.0 #215
Labels
Comments
Assuming ExampleBuilder is supposed to return the first subschema from given this spec openapi: 3.0.0
info:
version: 0.0.0
title: test
paths:
/oneOf:
get:
responses:
'200':
description: A book or movie object
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Book'
- $ref: '#/components/schemas/Movie'
/anyOf:
get:
responses:
'200':
description: A book or movie object
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/Movie'
- $ref: '#/components/schemas/Book'
/mixed-array:
get:
responses:
'200':
description: An array containing strings and/or integers
content:
application/json:
schema:
type: array
items:
oneOf:
- type: string
- type: integer
components:
schemas:
Book:
type: object
properties:
title:
type: string
authors:
type: array
items:
type: string
isbn:
type: string
required:
- title
example:
title: The Hitchhiker's Guide to the Galaxy
authors:
- Douglas Adams
isbn: 0-330-25864-8
Movie:
type: object
properties:
title:
type: string
directors:
type: array
items:
type: string
year:
type: integer
required:
- title
example:
title: Blade Runner
directors:
- Ridley Scott
year: 1982
{
"title": "The Hitchhiker's Guide to the Galaxy",
"authors": [
"Douglas Adams"
],
"isbn": "0-330-25864-8"
}
{
"title": "Blade Runner",
"directors": [
"Ridley Scott"
],
"year": 1982
} and [
"string"
] |
@hkosova Thanks Helen, do you have a spec with |
openapi: 3.0.0
info:
version: 0.0.0
title: not models
paths:
/NotString:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
$ref: '#/components/schemas/NotString'
/NotStringInlineSchema:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
not:
type: string
/NotNumber:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
$ref: '#/components/schemas/NotNumber'
/NotNumberInlineSchema:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
not:
anyOf:
- type: number
- type: integer
/ArrayOfNotString:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
$ref: '#/components/schemas/ArrayOfNotString'
/ArrayOfNotStringInlineSchema:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
type: array
items:
not:
type: string
/NotUserObject:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
$ref: '#/components/schemas/NotUser'
/NotUserObjectInline:
get:
responses:
'200':
description: OK
content:
application/yaml:
schema:
not:
$ref: '#/components/schemas/User'
components:
schemas:
NotString:
not:
type: string
NotNumber:
not:
anyOf:
- type: number
- type: integer
NotUser:
not:
$ref: '#/components/schemas/User'
ArrayOfNotString:
type: array
items:
not:
type: string
User:
type: object
properties:
id:
type: integer
readOnly: true
name:
type: string
required: [id, name] |
the inflector currently supports anyOf and OneOf, the not is not supported yet. |
gracekarina
added a commit
that referenced
this issue
Dec 30, 2017
gracekarina
added a commit
that referenced
this issue
Dec 30, 2017
support of not, done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support anyOf, oneOf, and not in ExampleBuilder in 3.0
Right now inflector only supports allOf.
The text was updated successfully, but these errors were encountered: