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

Apply style and explode values from encoding for form-encoded request body parameters #12162

Merged
merged 1 commit into from
May 19, 2022

Conversation

harmony7
Copy link
Contributor

@harmony7 harmony7 commented Apr 18, 2022

This PR adds support for the style and explode values on the encoding object onto request body parameters that are submitted as application/x-www-form-urlencoded or multipart.

The Encoding Object allows the specification of style and explode similar to how they can be applied to operation parameters.

There has already existed code that would apply contentType from this Encoding Object, but this was the only value that was being applied. This PR renames that function from setParameterContentType to setParameterEncodingValues, and now also applies style and explode as appropriate.

I've added tests to DefaultCodegenTest.testRequestBodyContent() against some new definitions in resources/3_0/content-data.yaml to show that these work.

This should fix issues such as #3781 and #11256.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.

@harmony7 harmony7 force-pushed the form-parameters-collections branch from 26869ca to e932429 Compare April 18, 2022 08:53
@harmony7 harmony7 force-pushed the form-parameters-collections branch from e932429 to 4416b22 Compare April 18, 2022 09:01
@harmony7 harmony7 marked this pull request as ready for review April 18, 2022 09:02
@harmony7
Copy link
Contributor Author

@wing328 Are you able to look at this for me when you have a minute, or give it to the right person? This would help us. I'd like to avoid maintaining my own fork if possible. Thanks!

@rulrok
Copy link

rulrok commented Apr 28, 2022

Looking forward for this feature!

@wing328
Copy link
Member

wing328 commented May 13, 2022

Thanks for the PR. I'll try to review over the weekend.

cc @OpenAPITools/generator-core-team

Have a nice weekend.

@wing328
Copy link
Member

wing328 commented May 19, 2022

LGTM but I've not tested it locally.

@wing328 wing328 merged commit c3976a4 into OpenAPITools:master May 19, 2022
@wing328
Copy link
Member

wing328 commented May 19, 2022

Katsuyuki-san, thanks for the PR, which has been merged into master.

When you've time tomorrow or next week, can you please PM me via Slack? https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g

samuelo added a commit to Capitolis/openapi-generator that referenced this pull request May 22, 2022
* master:
  update gson to newer version in kotlin templates (OpenAPITools#12425)
  update gson to 2.8.9 in android httpclient (OpenAPITools#12423)
  update android dependencies to newer versions (OpenAPITools#12421)
  [Java] Update rest-assured dependencies (OpenAPITools#12420)
  update cwiki samples
  Add - Status colors in Wiki, Example per parameter (OpenAPITools#12394)
  Better support for inline schemas in parameters (OpenAPITools#12369)
  Upgrade Spring Boot to 2.5.14 / 2.7.0 (OpenAPITools#12408)
  update java samples
  Remove javadoc comment for unthrown IOException (OpenAPITools#12401)
  remove errorObjectSubtype from java client genreator (OpenAPITools#12405)
  [java][Micronaut] generator fixes (OpenAPITools#11803)
  Apply style and explode values from encoding for form-encoded request body parameters (OpenAPITools#12162)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants