[BUG] Header duplicate on subdependency
See original GitHub issueDescribe the bug Getting duplicate headers on API methods with subdependencies requiring the same dependency with a Header argument.
To Reproduce I’ve created an example repo to reproduce https://github.com/henriklindgren/fastapi-header-bug Steps to reproduce the behavior:
- Create an API-method which uses the same dependency, with a Header argument, in each of 2 paths of the dependency tree. Like this https://github.com/henriklindgren/fastapi-header-bug/blob/master/app/main.py
- Visit generated OpenApi json and see duplicate header requirements for the method.
"parameters": [
{
"required": true,
"schema": {
"title": "Someheader",
"type": "string"
},
"name": "someheader",
"in": "header"
},
{
"required": true,
"schema": {
"title": "Someheader",
"type": "string"
},
"name": "someheader",
"in": "header"
}
]
Expected behavior A single header requirement shown in the OpenApi definition.
Environment:
- OS: Linux
- FastAPI Version: 0.33.0
- Python Version: 3.7.3
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Avoiding Circular Dependencies of header files - Stack Overflow
Some best practices I follow to avoid circular dependencies are,. Stick to OOAD principles. Don't include a header file, unless the class included...
Read more >Top 10 C++ header file mistakes and how to fix them
Recommendation: Check your header filies by compiling them in isolation via a testMain.cpp that includes nothing but the header file under test.
Read more >How to "state of the art" integrate multiple sub-modules with ...
If the logger library is header-only, the definitions will be implicitly inline (opt-out from ODR) and the linker will discard duplicates. – ...
Read more >Consolidate Duplicate URLs with Canonical Tags
When a site has duplicate content, Google chooses the canonical URL. Learn more about canonical URLs and how to consolidate duplicate URLs.
Read more >"should set Forwarded headers appropriately" router test fails o...
Bug 1802311 - Conformance: "should set Forwarded headers appropriately" ... Sub Component: ... Bug 1811862 has been marked as a duplicate of this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tiangolo could you please have a look at this?
I think the fix would be: