-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow "anyOf" in param["schema"]["type"] in openapi31 (#143)
- Loading branch information
1 parent
1118513
commit 803da3f
Showing
6 changed files
with
165 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/renderers/httpdomain/rendered/v3.1/issue-112.yaml.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.. http:get:: /users | ||
**Get all users.** | ||
|
||
:queryparam role: | ||
:resjsonarr id: | ||
The user ID. | ||
:resjsonarrtype id: integer | ||
:resjsonarr username: | ||
The user name. | ||
:resjsonarrtype username: string | ||
:resjsonarr deleted: | ||
Whether the user account has been deleted. | ||
:resjsonarrtype deleted: boolean | ||
|
||
:statuscode 200: | ||
A list of all users. | ||
|
||
|
||
.. http:get:: /users/{userID} | ||
**Get a user by ID.** | ||
|
||
:param userID: | ||
:paramtype userID: string | ||
:resjson id: | ||
The user ID. | ||
:resjsonobj id: integer | ||
:resjson username: | ||
The user name. | ||
:resjsonobj username: string | ||
:resjson bio: | ||
A brief bio about the user. | ||
:resjsonobj bio: string, null | ||
:resjson deleted: | ||
Whether the user account has been deleted. | ||
:resjsonobj deleted: boolean | ||
:resjson created_at: | ||
The date the user account was created. | ||
:resjsonobj created_at: string:date | ||
:resjson deleted_at: | ||
The date the user account was deleted. | ||
:resjsonobj deleted_at: string:date | ||
|
||
:statuscode 200: | ||
The expected information about a user. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
openapi: "3.1.0" | ||
info: | ||
title: "Reproducer for issue #112" | ||
version: 2.0.0 | ||
paths: | ||
/users: | ||
get: | ||
summary: Get all users. | ||
parameters: | ||
- in: query | ||
name: role | ||
required: false | ||
schema: | ||
# this is one way to represent nullable types in OpenAPI | ||
oneOf: | ||
- type: "string" | ||
enum: ["admin", "member", "reader"] | ||
- type: "null" | ||
responses: | ||
"200": | ||
description: A list of all users. | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
type: object | ||
properties: | ||
id: | ||
description: The user ID. | ||
type: integer | ||
username: | ||
description: The user name. | ||
type: string | ||
deleted: | ||
description: Whether the user account has been deleted. | ||
type: boolean | ||
default: false | ||
/users/{userID}: | ||
get: | ||
summary: Get a user by ID. | ||
parameters: | ||
- in: path | ||
name: userID | ||
schema: | ||
type: "string" | ||
responses: | ||
"200": | ||
description: The expected information about a user. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
description: The user ID. | ||
type: integer | ||
username: | ||
description: The user name. | ||
type: string | ||
bio: | ||
description: A brief bio about the user. | ||
# this is another way to represent nullable types in OpenAPI that also demonstrates that assertions are | ||
# ignored for different primitive types | ||
# https://github.com/OAI/OpenAPI-Specification/issues/3148 | ||
type: ["string", "null"] | ||
maxLength: 255 | ||
deleted: | ||
description: Whether the user account has been deleted. | ||
type: boolean | ||
default: false | ||
created_at: | ||
description: The date the user account was created. | ||
type: string | ||
format: date | ||
deleted_at: | ||
description: The date the user account was deleted. | ||
# this is yet another slightly different way | ||
anyOf: | ||
- type: string | ||
format: date | ||
- type: null |