-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
Description
Hello, my question is, can I declare examplesI want to appear in the documentation when I'm not using a pydantic model?
For example, when using pydantic, the docs syas we can do it with
class Config:
schema_extra = {
"example": {
"name": "Foo",
"description": "A very nice Item",
"price": 35.4,
"tax": 3.2,
}
}Problem is: I have an endpoint that looks something like this:
@app.post("", response_model=Dict[str. Any], status_code=200)
async def evaluate(parameters: Dict[str, Any]) -> Dict[str, Any]:
...Even though I'll except every json as valid, I still want to include some examples.
Is there any way I can accomplish this?
- [ ✔️ ] I added a very descriptive title to this issue.
- [:heavy_check_mark: ] I used the GitHub search to find a similar issue and didn't find it.
- [:heavy_check_mark: ] 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.
- [:heavy_check_mark: ] I already checked if it is not related to FastAPI but to Swagger UI.
- [:heavy_check_mark: ] I already checked if it is not related to FastAPI but to ReDoc.
- [ ✔️] After submitting this, I commit to one of:
- Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
- I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
- Implement a Pull Request for a confirmed bug.
Reactions are currently unavailable