You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
file_name is marked Optional, so it seems like the user could omit it. But if they do to a multipart/form endpoint, backends such as DjangoRestFramework will return:
Status Code: 400 (Bad Request)
Content : {"file":["The submitted data was not a file. Check the encoding type on the form."]}
This means that users will not get a type checking error if they forget to include a file_name in this scenario.
It seems like perhaps a MultipartFile type is needed to be used to correctly model this?
@defineclassMultipartFile:
"""Contains information for multipart file uploads"""payload: BinaryIOfile_name: strmime_type: Optional[str] =None
...
Describe the bug
In
types.py
:openapi-python-client/openapi_python_client/templates/types.py.jinja
Line 24 in 0399271
file_name
is markedOptional
, so it seems like the user could omit it. But if they do to amultipart/form
endpoint, backends such as DjangoRestFramework will return:This means that users will not get a type checking error if they forget to include a
file_name
in this scenario.It seems like perhaps a
MultipartFile
type is needed to be used to correctly model this?OpenAPI Spec File
Desktop (please complete the following information):
Additional context
The generated Swagger UI page for this endpoint looks like:
Backend versions:
The text was updated successfully, but these errors were encountered: