Skip to content
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

Additional responses can be status groups or "default" #435

Merged
merged 3 commits into from
Aug 30, 2019
Merged

Additional responses can be status groups or "default" #435

merged 3 commits into from
Aug 30, 2019

Conversation

divums
Copy link
Contributor

@divums divums commented Aug 13, 2019

Catching exception when generating OpenAPI specification. Added status groups and "default" as possible key for the additional responses.

If merged, this issue fixes #428

@codecov
Copy link

codecov bot commented Aug 13, 2019

Codecov Report

Merging #435 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #435   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         240    244    +4     
  Lines        5626   5707   +81     
=====================================
+ Hits         5626   5707   +81
Impacted Files Coverage Δ
fastapi/openapi/utils.py 100% <100%> (ø) ⬆️
tests/test_additional_responses_bad.py 100% <100%> (ø)
tests/test_additional_responses_router.py 100% <100%> (ø) ⬆️
fastapi/dependencies/utils.py 100% <0%> (ø) ⬆️
fastapi/routing.py 100% <0%> (ø) ⬆️
tests/test_repeated_dependency_schema.py 100% <0%> (ø)
tests/test_empty_router.py 100% <0%> (ø)
tests/test_skip_defaults.py 100% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 033bc2a...e673787. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 13, 2019

Codecov Report

Merging #435 into master will decrease coverage by 0.01%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #435      +/-   ##
==========================================
- Coverage     100%   99.98%   -0.02%     
==========================================
  Files         240      240              
  Lines        5626     5632       +6     
==========================================
+ Hits         5626     5631       +5     
- Misses          0        1       +1
Impacted Files Coverage Δ
tests/test_additional_responses_router.py 100% <100%> (ø) ⬆️
fastapi/openapi/utils.py 99.38% <87.5%> (-0.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 033bc2a...7f915cc. Read the comment docs.

fastapi/openapi/utils.py Outdated Show resolved Hide resolved
Pipfile Outdated Show resolved Hide resolved
@tiangolo tiangolo merged commit 73dbbea into fastapi:master Aug 30, 2019
@tiangolo
Copy link
Member

Awesome, thanks @divums ! Good job! 🚀 🍰

I updated it a bit, to use uppercase instead of lowercase, to conform with the spec: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#patterned-fields-1

And I augmented the tests to include some more of these cases.

And thanks a lot @dmontagu for the code review and help here! 👏 💪 🍰

@tiangolo
Copy link
Member

I realized I introduced a bug making it "DEFAULT" instead of "default", while making the status code ranges uppercase.

But I just fixed it in #489 🐛

I also added extra tests there to include "default" and other status codes at the same time and discovered another bug in the models. But it's fixed now. 😅 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAPI: response keys are limited to be status codes
3 participants