Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

🐛 Fix support for extendingopenapi_extras with parameter lists#4267

Merged
tiangolo merged 3 commits intofastapi:masterfrom
orilevari:openapi_extras_parameters
Aug 26, 2022
Merged

🐛 Fix support for extendingopenapi_extras with parameter lists#4267
tiangolo merged 3 commits intofastapi:masterfrom
orilevari:openapi_extras_parameters

Conversation

@orilevari
Copy link

@orilevariorilevari commentedDec 11, 2021
edited
Loading

Issue

When specifying parameters in openapi_extras for an endpoint, they will overwrite the existing query parameters with the extra parameters. This is due to deep_dict_update in utils.py overwriting list types rather than merging them together.

PR Content

This PR updates deep_dict_update to merge arrays instead of overwriting. I have also added a test case that demonstrates and verifies the desired behavior.

Testing

Ran bash scripts/test-cov-html.sh with 100% test pass including new test case

cole-floodbase and patrick-braun reacted with thumbs up emojicole-floodbase reacted with heart emojicole-floodbase reacted with rocket emoji
…llows query parameters to be specified in openapi_extras not be appended to the spec, not overwrite.
@tiangolotiangolo changed the titleModify deep_dict_update to stop openapi_extras from overwriting query parameters🐛 Fix support for extendingopenapi_extras with parameter listsAug 26, 2022
@tiangolo
Copy link
Member

Awesome, thanks for the contribution@orilevari! 🚀 🎉

orilevari reacted with heart emoji

@codecov
Copy link

codecovbot commentedAug 26, 2022
edited
Loading

Codecov Report

Merging#4267 (7c8e75a) intomaster (92181ef) willnot change coverage.
The diff coverage is100.00%.

@@            Coverage Diff            @@##            master     #4267   +/-   ##=========================================  Coverage   100.00%   100.00%           =========================================  Files          534       535    +1       Lines        13811     13830   +19     =========================================+ Hits         13811     13830   +19
Impacted FilesCoverage Δ
fastapi/utils.py100.00% <100.00%> (ø)
tests/test_openapi_query_parameter_extension.py100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell ushow you rate us. Have a feature suggestion?Share it here.

@tiangolotiangoloenabled auto-merge (squash)August 26, 2022 09:24
@tiangolotiangolo merged commit880c8b3 intofastapi:masterAug 26, 2022
@Darep
Copy link

Is there a way to fall back to the old functionality somehow? 🤔 We haveQuery(default=datetime.utcnow()) and we are trying to override it likeopenapi_extra={"parameters": [{"schema": {"default": "Current timestamp in UTC"}}]} 😄 And this change now simply appends a new parameter in the list.

We might doinclude_in_schema=False and write it completely if there isn't, so no worries... 😊 (Other solutions for changing the default in the OpenAPI-schema also welcome!)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@orilevari@tiangolo@Darep

[8]ページ先頭

©2009-2026 Movatter.jp