-
-
Notifications
You must be signed in to change notification settings - Fork 565
fix: set responses without content schemas to never
or unknown
, depending on status code
#334
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
Conversation
…depending on status code
…epending on status code
…nown`, depending on status code
Codecov Report
@@ Coverage Diff @@
## master #334 +/- ##
==========================================
+ Coverage 86.40% 90.35% +3.95%
==========================================
Files 5 5
Lines 250 228 -22
Branches 88 79 -9
==========================================
- Hits 216 206 -10
+ Misses 22 15 -7
+ Partials 12 7 -5
Continue to review full report at Codecov.
|
@@ -32,7 +32,7 @@ export interface OpenAPI3Parameter { | |||
|
|||
export interface OpenAPI3ResponseObject { | |||
description?: string; | |||
content: { | |||
content?: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
/** | ||
* User not found | ||
*/ | ||
'404': any | ||
'404': unknown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 I’m OK with this change. Really, any undeclared type should be “dangerous” and I do like that this will surface more errors than any
@@ -630,4 +630,78 @@ describe("OpenAPI3 features", () => { | |||
}`) | |||
); | |||
}); | |||
|
|||
it("empty responses (#333)", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice unit test!
Currently the strategy has been to rely on unit tests as the real core of testing, but the full-schema “snapshots” are just ensuring that this actually works on real-world schemas. Glad you were able to figure it out!
The unit tests themselves could probably be better-organized; I’m not that picky. Open to feedback there. As long as they’re there (like the great ones you added), I’m happy!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thank you
@all-contributors please add @gr2m for code, test |
I've put up a pull request to add @gr2m! 🎉 |
fixes #333