Skip to content
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

Support multipart media type by default for filefield/imagefield #436

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

ychab
Copy link
Contributor

@ychab ychab commented Aug 7, 2019

See issue #386

With that fix, it means that we may always use Multipart media type instead of JSON parser... So not really sure if it is a good idea or not :/

A better alternative would be to have to select the content type in the UI of Swagger or Redoc instead....

@ychab
Copy link
Contributor Author

ychab commented Aug 12, 2019

Oh, I probably know why this is not possible and why it decide to switch on application/json media type by default if we don't have only form media type : this is because multipart/form-data doesn't allow nested parameter... !!
I just refresh the pull request in order to add some comments about this because this is really tricky and it could help to understand why (if this is the good reason anyway)

@axnsan12
Copy link
Owner

Yeah, your comments pretty much hit it on the head. The problem is both that there is no widely accepted standard for nested values in multipart/form-data, and that OpenAPI 2.0 enforces this separation via Parameters for form fields and Schemas for json body.

OpenAPI 3 is a real big step forward in this regard since it allows all request body types to be specified as a Schema, with a lot of knobs for media types. However building a lib to generate that is probably a nightmare.

@axnsan12 axnsan12 merged commit b700191 into axnsan12:master Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants