Skip to content

Fix: Handle code generation for all multipart content-types #1385

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

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

ShouheiNishi
Copy link
Contributor

@ShouheiNishi ShouheiNishi commented Dec 13, 2023

In the current code, functions http.Request.MultipartReader() and multipart.Writer.FormDataContentType() are used for the processing of the mutlipart message, but this function is only supported when contentType is "multipart/form-data".
When contentType is specified in OpenAPI definition other than "multipart/form-data", code that compatible with other contentTypes is generated without using these functions.

This PR fix #1381.

@ShouheiNishi ShouheiNishi marked this pull request as ready for review December 13, 2023 02:22
@jamietanna jamietanna changed the title Fix treatment of Content-Type in multipart codes Fix: Handle code generation for all multipart content-types Dec 13, 2023
Copy link
Member

@jamietanna jamietanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ShouheiNishi 🙌

@jamietanna jamietanna merged commit 039ba0e into oapi-codegen:master Dec 13, 2023
@jamietanna jamietanna added the bug Something isn't working label Dec 13, 2023
ShouheiNishi added a commit to ShouheiNishi/oapi-codegen that referenced this pull request Dec 28, 2023
…i-codegen#1385)

Right now, we're only generating code for multipart requests when the
media type is a `multipart/form-data`, which means that other multipart
types, like `multipart/related` do not correctly generate.

We should amend this, generating code that validates the media type
provided and handling the request.

Closes oapi-codegen#1381.
danicc097 pushed a commit to danicc097/oapi-codegen that referenced this pull request Aug 31, 2024
…i-codegen#1385)

Right now, we're only generating code for multipart requests when the
media type is a `multipart/form-data`, which means that other multipart
types, like `multipart/related` do not correctly generate.

We should amend this, generating code that validates the media type
provided and handling the request.

Closes oapi-codegen#1381.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content-type "multipart/related" is not worked
2 participants