-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to provide examples for in multipart/form-data? #967
Comments
Hi, it does not show up because the example is on the view level and the default value for drf-spectacular/drf_spectacular/utils.py Line 142 in 3dd27b0
We are actually introducing
I don't think this is legal OpenApi 3.0.3. Afaik |
I didn't quite get it. Can you elaborate? Thanks! |
OpenApiExample(
"Example",
summary="Example",
description="Example",
value={
"project_id": "5",
},
request_only=True,
media_type="multipart/form-data" # <<<<<<<
), is the solution right now. When we merge #966, you don't need to specify @extend_schema(
request={
"multipart/form-data": OpenApiRequest(
{...your raw schema},
examples=[OpenApiExample(...)]
)
}
) |
closing this issue for now. feel free to comment if anything is missing or not working and we will follow-up. |
I have this, when I try to make the form type to
application/json
the example works but it's not working when I change it back tomultipart/form-data
.The text was updated successfully, but these errors were encountered: