✨ Allow hiding from OpenAPI (and Swagger UI) Query, Cookie, Header, and Path parameters#3144
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3144 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 504 509 +5
Lines 12707 12807 +100
==========================================
+ Hits 12707 12807 +100
Continue to review full report at Codecov.
|
|
📝 Docs preview for commit 685532c at: https://608d27c8521eb7158616ef14--fastapi.netlify.app |
…meters-in-openapi-spec
|
@jordantshaw no idea but I have updated the request with a code sample from the original issue. Hope that will speed up the review. |
|
This is a useful PR for me, too. |
|
Very useful for me too to remove all |
|
Please merge this!! This is a super useful feature! 😊😊 |
|
hello, any updates on this? this will be a really helpful additiona feature 👍 |
|
@tiangolo Any updates on when this will merged? Looks like a lot of people would find this very helpful. |
|
@tiangolo Ping? I would also be very delighted to see this feature :3 |
|
@tiangolo Any update for this, really helpful |
|
Joining the gang, I would find this very useful too |
Query, Cookie, Header, and Path parameters
|
📝 Docs preview for commit 8b60572 at: https://61ed7670c8634ec6d8ce1542--fastapi.netlify.app |
|
📝 Docs preview for commit c49e01c at: https://61ed78f66a86fc22f4026592--fastapi.netlify.app |
|
📝 Docs preview for commit fcf3c1c at: https://61ed79c4bc1bd1bb22e41376--fastapi.netlify.app |
|
Awesome, thank you @astraldawn! ☕ Thanks everyone for the discussion! 🍰 I updated a bit the tests and added source examples (and tests) for Python 3.10. I was thinking that maybe it could make sense to support also body/form-data, but the implementation would be non-trivial, or it would have to be a per-route This is available in FastAPI version |
…er`, and `Path` parameters (fastapi#3144) Co-authored-by: Sebastián Ramírez <[email protected]>
|
This is a fantastic feature addition—thank you for this! 🎉 I wanted to share an alternative approach I’ve used in a similar context where I needed to exclude certain fields from the OpenAPI schema for a cleaner API documentation. My use case involved building an OAuth2-like authentication schema where fields like Here’s the implementation I used, leveraging In this approach, I’m curious about how this compares to the Thank you again for this valuable addition—it’s going to make handling such use cases a lot more intuitive! 😊 |
Add parameter
include_in_schemato partially address #1708 for subclasses ofParam:Cookie,Header,PathandQueryImplements the
Paramportion of #1708 (comment), relevant parts of code sample reproduced below: