-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #768 from postmanlabs/feature/multi-example-support
Added support for multiple examples to be generated as request examples.
- Loading branch information
Showing
8 changed files
with
814 additions
and
134 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
69 changes: 69 additions & 0 deletions
69
test/data/valid_openapi/multiExampleMatchingRequestResponse.yaml
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,69 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: None | ||
version: 1.0.0 | ||
description: None | ||
paths: | ||
/v1: | ||
post: | ||
requestBody: | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: "#/components/schemas/World" | ||
examples: | ||
valid-request: | ||
value: | ||
includedFields: | ||
- user | ||
- height | ||
- weight | ||
missing-required-parameter: | ||
value: | ||
includedFields: | ||
- user | ||
responses: | ||
200: | ||
description: None | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: "#/components/schemas/Request" | ||
examples: | ||
valid-request: | ||
summary: Complete request | ||
value: | ||
{ | ||
"user": 1, | ||
"height": 168, | ||
"weight": 44 | ||
} | ||
missing-required-parameter: | ||
summary: Request with only required params | ||
value: | ||
{ | ||
"user": 1 | ||
} | ||
components: | ||
schemas: | ||
World: | ||
type: object | ||
properties: | ||
includedFields: | ||
type: array | ||
Request: | ||
type: object | ||
required: | ||
- user | ||
- height | ||
- weight | ||
properties: | ||
user: | ||
type: integer | ||
description: None | ||
height: | ||
type: integer | ||
description: None | ||
weight: | ||
type: integer | ||
description: None |
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,50 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: None | ||
version: 1.0.0 | ||
description: None | ||
paths: | ||
/v1/: | ||
post: | ||
requestBody: | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: "#/components/schemas/Request" | ||
examples: | ||
valid-request: | ||
value: | ||
{ | ||
"user": 1, | ||
"height": 168, | ||
"weight": 44 | ||
} | ||
missing-required-parameter: | ||
value: | ||
{ | ||
"user": 1 | ||
} | ||
responses: | ||
200: | ||
description: None | ||
content: | ||
'application/json': | ||
example: { hello: 'world' } | ||
components: | ||
schemas: | ||
Request: | ||
type: object | ||
required: | ||
- user | ||
- height | ||
- weight | ||
properties: | ||
user: | ||
type: integer | ||
description: None | ||
height: | ||
type: integer | ||
description: None | ||
weight: | ||
type: integer | ||
description: None |
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,70 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: None | ||
version: 1.0.0 | ||
description: None | ||
paths: | ||
/v1: | ||
post: | ||
requestBody: | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: "#/components/schemas/World" | ||
examples: | ||
valid-request: | ||
value: | ||
includedFields: | ||
- user | ||
- height | ||
- weight | ||
missing-required-parameter: | ||
value: | ||
includedFields: | ||
- user | ||
responses: | ||
200: | ||
description: None | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: "#/components/schemas/Request" | ||
examples: | ||
not-matching-key: | ||
summary: Request with only required params | ||
value: | ||
{ | ||
"user": 1 | ||
} | ||
not-matching-key-2: | ||
summary: Complete request | ||
value: | ||
{ | ||
"user": 1, | ||
"height": 168, | ||
"weight": 44 | ||
} | ||
|
||
components: | ||
schemas: | ||
World: | ||
type: object | ||
properties: | ||
includedFields: | ||
type: array | ||
Request: | ||
type: object | ||
required: | ||
- user | ||
- height | ||
- weight | ||
properties: | ||
user: | ||
type: integer | ||
description: None | ||
height: | ||
type: integer | ||
description: None | ||
weight: | ||
type: integer | ||
description: None |
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,60 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: None | ||
version: 1.0.0 | ||
description: None | ||
paths: | ||
/v1: | ||
post: | ||
requestBody: | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: "#/components/schemas/World" | ||
examples: | ||
hello-world: | ||
value: | ||
hello: world | ||
responses: | ||
200: | ||
description: None | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: "#/components/schemas/Request" | ||
examples: | ||
valid-request: | ||
value: | ||
{ | ||
"user": 1, | ||
"height": 168, | ||
"weight": 44 | ||
} | ||
missing-required-parameter: | ||
value: | ||
{ | ||
"user": 1 | ||
} | ||
components: | ||
schemas: | ||
World: | ||
type: object | ||
properties: | ||
hello: | ||
type: string | ||
Request: | ||
type: object | ||
required: | ||
- user | ||
- height | ||
- weight | ||
properties: | ||
user: | ||
type: integer | ||
description: None | ||
height: | ||
type: integer | ||
description: None | ||
weight: | ||
type: integer | ||
description: None |
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
Oops, something went wrong.