forked from OAI/OpenAPI-Specification
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce duplication within each test, separate test for src
- Loading branch information
Showing
23 changed files
with
352 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
openapi: 3.1.1 | ||
|
||
# this example shows invalid types for the schemaObject | ||
|
||
info: | ||
title: API | ||
version: 1.0.0 | ||
components: | ||
schemas: | ||
invalid_null: null | ||
invalid_number: 0 | ||
invalid_array: [] | ||
|
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,7 @@ | ||
openapi: 3.1.0 | ||
|
||
# this example should fail as there are no paths, components or webhooks containers (at least one of which must be present) | ||
|
||
info: | ||
title: API | ||
version: 1.0.0 |
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,14 @@ | ||
openapi: 3.1.0 | ||
|
||
# this example should fail as the server variable enum is empty, and so does not contain the default value | ||
|
||
info: | ||
title: API | ||
version: 1.0.0 | ||
servers: | ||
- url: https://example.com/{var} | ||
variables: | ||
var: | ||
enum: [] | ||
default: a | ||
components: {} |
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,11 @@ | ||
openapi: 3.1.0 | ||
|
||
# this example should fail, as servers must be an array, not an object | ||
|
||
info: | ||
title: API | ||
version: 1.0.0 | ||
paths: {} | ||
servers: | ||
url: /v1 | ||
description: Run locally. |
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,8 @@ | ||
openapi: 3.1.0 | ||
|
||
# this example should fail as overlays is not a valid top-level object/keyword | ||
|
||
info: | ||
title: API | ||
version: 1.0.0 | ||
overlays: {} |
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,6 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
components: | ||
pathItems: {} |
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,6 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
summary: My lovely API | ||
version: 1.0.0 | ||
components: {} |
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,9 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
summary: My lovely API | ||
version: 1.0.0 | ||
license: | ||
name: Apache | ||
identifier: Apache-2.0 | ||
components: {} |
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,49 @@ | ||
openapi: 3.1.0 | ||
info: | ||
summary: My API's summary | ||
title: My API | ||
version: 1.0.0 | ||
license: | ||
name: Apache 2.0 | ||
identifier: Apache-2.0 | ||
jsonSchemaDialect: https://spec.openapis.org/oas/3.1/dialect/base | ||
paths: | ||
/: | ||
get: | ||
parameters: [] | ||
/{pathTest}: {} | ||
webhooks: | ||
myWebhook: | ||
$ref: '#/components/pathItems/myPathItem' | ||
description: Overriding description | ||
components: | ||
securitySchemes: | ||
mtls: | ||
type: mutualTLS | ||
pathItems: | ||
myPathItem: | ||
post: | ||
requestBody: | ||
required: true | ||
content: | ||
'application/json': | ||
schema: | ||
type: object | ||
properties: | ||
type: | ||
type: string | ||
int: | ||
type: integer | ||
exclusiveMaximum: 100 | ||
exclusiveMinimum: 0 | ||
none: | ||
type: 'null' | ||
arr: | ||
type: array | ||
$comment: Array without items keyword | ||
either: | ||
type: ['string','null'] | ||
discriminator: | ||
propertyName: type | ||
x-extension: true | ||
myArbitraryKeyword: true |
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,5 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
components: {} |
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,5 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
webhooks: {} |
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,5 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
paths: {} |
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,19 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: Non-oAuth Scopes example | ||
version: 1.0.0 | ||
paths: | ||
/users: | ||
get: | ||
security: | ||
- bearerAuth: | ||
- 'read:users' | ||
- 'public' | ||
components: | ||
securitySchemes: | ||
bearerAuth: | ||
type: http | ||
scheme: bearer | ||
bearerFormat: jwt | ||
description: 'note: non-oauth scopes are not defined at the securityScheme level' | ||
|
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,7 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
paths: | ||
/: | ||
get: {} |
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,6 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
paths: | ||
/{var}: {} |
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,55 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
paths: {} | ||
components: | ||
schemas: | ||
model: | ||
type: object | ||
properties: | ||
one: | ||
description: type array | ||
type: | ||
- integer | ||
- string | ||
two: | ||
description: type 'null' | ||
type: "null" | ||
three: | ||
description: type array including 'null' | ||
type: | ||
- string | ||
- "null" | ||
four: | ||
description: array with no items | ||
type: array | ||
five: | ||
description: singular example | ||
type: string | ||
examples: | ||
- exampleValue | ||
six: | ||
description: exclusiveMinimum true | ||
exclusiveMinimum: 10 | ||
seven: | ||
description: exclusiveMinimum false | ||
minimum: 10 | ||
eight: | ||
description: exclusiveMaximum true | ||
exclusiveMaximum: 20 | ||
nine: | ||
description: exclusiveMaximum false | ||
maximum: 20 | ||
ten: | ||
description: nullable string | ||
type: | ||
- string | ||
- "null" | ||
eleven: | ||
description: x-nullable string | ||
type: | ||
- string | ||
- "null" | ||
twelve: | ||
description: file/binary |
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,10 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: API | ||
version: 1.0.0 | ||
paths: {} | ||
servers: | ||
- url: /v1 | ||
description: Run locally. | ||
- url: https://production.com/v1 | ||
description: Run on production server. |
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,14 @@ | ||
openapi: 3.1.1 | ||
|
||
# this example shows that top-level schemaObjects MAY be booleans | ||
|
||
info: | ||
title: API | ||
version: 1.0.0 | ||
components: | ||
schemas: | ||
anything_boolean: true | ||
nothing_boolean: false | ||
anything_object: {} | ||
nothing_object: { not: {} } | ||
|
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,35 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: Webhook Example | ||
version: 1.0.0 | ||
# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components | ||
webhooks: | ||
# Each webhook needs a name | ||
newPet: | ||
# This is a Path Item Object, the only difference is that the request is initiated by the API provider | ||
post: | ||
requestBody: | ||
description: Information about a new pet in the system | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Pet" | ||
responses: | ||
"200": | ||
description: Return a 200 status to indicate that the data was received successfully | ||
|
||
components: | ||
schemas: | ||
Pet: | ||
required: | ||
- id | ||
- name | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
name: | ||
type: string | ||
tag: | ||
type: string | ||
|
Oops, something went wrong.