Rename 'additionalProp1' in docs to a more descriptive one
See original GitHub issueFirst 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
from fastapi import FastAPI
from pydantic import BaseModel, Field, parse_obj_as
app = FastAPI()
City = str # a type alias
class Misc(BaseModel):
content: dict = Field(description="All other data here.")
class CompanyDataOut(BaseModel):
__root__: dict[City, Misc]
@app.post("/", response_model=CompanyDataOut)
async def test():
m = Misc(content={})
return {"New York": m}
Description
Open the docs.
It shows response example as:
{
"additionalProp1": {
"content": {}
},
"additionalProp2": {
"content": {}
},
"additionalProp3": {
"content": {}
}
}
Instead of ‘additionalProp1,2,3’ I would like to see ‘city1,2,3’, to let the user know that the key is a city, like below :
{
"city1": {
"content": {}
},
"city2": {
"content": {}
},
"city3": {
"content": {}
}
}
Operating System
Windows
Operating System Details
No response
FastAPI Version
0.70.0
Python Version
3.10
Additional Context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Add a title, heading, or table of contents in a document
Make a title or heading · On your computer, open a document in Google Docs. · Select the text you want to change....
Read more >Adding Examples - Swagger
Swagger allows examples on the response level, each example corresponding to a specific MIME type returned by the operation. Such as one example...
Read more >Creating Accessible Google Drive Documents
one simple trick is to imagine describing the image to someone over the phone. The more important an image's content is, the more...
Read more >How can I change the request body in Swagger 1.5 to an ...
Even by using @RequestBody we need to add additional annotation within TaskConfig class. We are using Swagger 2.0.x.
Read more >How to Change Margins in Google Docs - Wordable
Resizing & compressing images one-by-one before uploading back into your content,; ❌ Optimizing images with descriptive file names & alt text ...
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
You can add a custom example:
Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs.