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

Update response model information for routes #846

Merged

Conversation

CasperWA
Copy link
Member

@CasperWA CasperWA commented Jun 9, 2021

Use a single pydantic model for all routes' response_model and add a
dictionary of erroneous status codes with the ErrorResponse model to
all routes' responses property, updating the OpenAPI schemas with the
correct mapping of response models to status codes.

Fixes #763

@CasperWA CasperWA requested review from ml-evs and JPBergsma June 9, 2021 13:58
@CasperWA
Copy link
Member Author

CasperWA commented Jun 9, 2021

This could be improved further, I think, where the specific errors (e.g., 553 Version Not Supported) is explicitly named as such with a title or description in the OpenAPI schema?

@codecov
Copy link

codecov bot commented Jun 9, 2021

Codecov Report

Merging #846 (9054d09) into master (c6f9977) will decrease coverage by 0.05%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #846      +/-   ##
==========================================
- Coverage   92.70%   92.64%   -0.06%     
==========================================
  Files          67       67              
  Lines        3699     3724      +25     
==========================================
+ Hits         3429     3450      +21     
- Misses        270      274       +4     
Flag Coverage Δ
project 92.64% <91.66%> (-0.06%) ⬇️
validator 92.64% <91.66%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
optimade/server/exceptions.py 90.24% <86.66%> (-9.76%) ⬇️
optimade/server/routers/index_info.py 100.00% <100.00%> (ø)
optimade/server/routers/info.py 95.45% <100.00%> (-0.20%) ⬇️
optimade/server/routers/links.py 100.00% <100.00%> (ø)
optimade/server/routers/references.py 100.00% <100.00%> (ø)
optimade/server/routers/structures.py 100.00% <100.00%> (ø)
optimade/server/routers/versions.py 100.00% <100.00%> (ø)
optimade/server/schemas.py 100.00% <100.00%> (ø)

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 c6f9977...9054d09. Read the comment docs.

@CasperWA
Copy link
Member Author

CasperWA commented Jun 9, 2021

This could be improved further, I think, where the specific errors (e.g., 553 Version Not Supported) is explicitly named as such with a title or description in the OpenAPI schema?

Hereby done.
I also removed these extra responses for /versions as I don't believe they apply here?

ml-evs
ml-evs previously approved these changes Jun 10, 2021
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @CasperWA for your hard work

CasperWA and others added 2 commits June 10, 2021 12:03
Use a single pydantic model for all routes' `response_model` and add a
dictionary of erroneous status codes with the `ErrorResponse` model to
all routes' `responses` property, updating the OpenAPI schemas with the
correct mapping of response models to status codes.
@CasperWA
Copy link
Member Author

Thank you @CasperWA for your hard work

Woot woot.

Thank you!

Rebased this, keeping a commit for each of us and then force merging it, since the content didn't change since your approval.

@CasperWA CasperWA merged commit 9054d09 into Materials-Consortia:master Jun 10, 2021
@CasperWA CasperWA deleted the fix_763_response-codes-schema branch June 10, 2021 10:22
@CasperWA CasperWA temporarily deployed to optimade June 10, 2021 10:29 Inactive
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.

Missing HTTP response codes in OpenAPI schema
2 participants