-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added one more rule for response validation in model validation. (#436)
* Added one more rule for reponse validation. Fail the validation when there's schema defined for response body in spec but the example response doesn't provide the body in response. * Fix the exmaples for unit tests. * Added two more unit tests. Coverage for the new added rules about body/schema validation in response. * Apply snapshot patch. * Bump package version and update changeLog file. * Apply snapshot patch. * Update version number in changeLog. * Apply snapshots patch again. * Update per the review comment. * Update test snapshot.
- Loading branch information
1 parent
0223567
commit 6b4c9a8
Showing
12 changed files
with
10,820 additions
and
5,337 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
16,013 changes: 10,684 additions & 5,329 deletions
16,013
regression/__snapshots__/validateExamplesRegression_latestOnly.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
8 changes: 6 additions & 2 deletions
8
test/modelValidation/swaggers/specification/defaultIsErrorOnly/examples/fail.json
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 |
---|---|---|
@@ -1,7 +1,11 @@ | ||
{ | ||
"parameters":{}, | ||
"responses":{ | ||
"200": {}, | ||
"203": {} | ||
"200": { | ||
"body": {} | ||
}, | ||
"203": { | ||
"body": {} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
test/modelValidation/swaggers/specification/extraBodyInResponse/examples/fail.json
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 @@ | ||
{ | ||
"parameters": {}, | ||
"responses": { | ||
"200": { | ||
"body": {} | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
test/modelValidation/swaggers/specification/extraBodyInResponse/test.json
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,30 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "sometitle", | ||
"version": "2018-01-01" | ||
}, | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"paths": { | ||
"/somepath": { | ||
"get": { | ||
"operationId": "op", | ||
"responses": { | ||
"200": { | ||
"description": "somedescription" | ||
} | ||
}, | ||
"x-ms-examples": { | ||
"Fail": { | ||
"$ref": "./examples/fail.json" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
test/modelValidation/swaggers/specification/noBodyInResponse/examples/fail.json
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 @@ | ||
{ | ||
"parameters": {}, | ||
"responses": { | ||
"200": {} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
test/modelValidation/swaggers/specification/noBodyInResponse/test.json
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,31 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "sometitle", | ||
"version": "2018-01-01" | ||
}, | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"paths": { | ||
"/somepath": { | ||
"get": { | ||
"operationId": "op", | ||
"responses": { | ||
"200": { | ||
"description": "somedescription", | ||
"schema": {} | ||
} | ||
}, | ||
"x-ms-examples": { | ||
"Fail": { | ||
"$ref": "./examples/fail.json" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
test/modelValidation/swaggers/specification/noDefault/examples/fail.json
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