Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Specifying parameters in openapi_extras overrides query parameters, rather than appending them #4268

@orilevari

Description

@orilevari

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google "How to X in FastAPI" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

See the PR I opened with a fix: #4267 It includes a test case that describes the use case.

Description

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

I have created a PR already which has a fix and adds a test case: #4267
These updates change the behavior to merge parameters together rather than overwriting.

If y'all agree that this seems like a bug, I'd appreciate a review on the PR. Thanks in advance! 😄

Operating System

macOS

Operating System Details

No response

FastAPI Version

0.70.0

Python Version

Python 3.9.7

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions