turner-townsend / flask-pydantic-spec

An Flask OpenAPI library using Pydantic
Apache License 2.0
98 stars 17 forks source link

Fix - Allow user to add extra parameters to multipart/form-data requests #25

Closed cgearing closed 2 years ago

cgearing commented 2 years ago

This PR fixes the multipart/form-data functionality in flask_pydantic_spec to allow us to extend the body with extra parameters.

In OpenAPI, it is not possible to provide a spec that allows the user to choose the key that the file data lives under. As such, the file name will be static.

This PR fixes the validation to allow us to successfully instantiate a pydantic object from the form data if provided, validating it as per usual.

I would suggest this should be a major version jump as I renamed the file_name attribute on MultipartFormRequest as it's currently unclear the purpose of the attribute.