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

[cpp-ue4] add support for Content-Type containing charset #7379

Merged
merged 1 commit into from Sep 12, 2020
Merged

[cpp-ue4] add support for Content-Type containing charset #7379

merged 1 commit into from Sep 12, 2020

Conversation

Falanwe
Copy link
Contributor

@Falanwe Falanwe commented Sep 9, 2020

Change to the api template for cpp-ue4 to handle a composite Content-Type (for instance application/json; charset=utf-8) by comparing the start of the string instead of looking for a perfect match.

Sadly, there are no test config for cpp-ue4 (yet?). I tested the change directly inside the UE4 project we have in which we are using openapi-generator (as it's a proprietary game I cannot share it obviously, but the resulting code did compile well).

@ravinikam @etherealjoy @MartinDelille @muttleyxd @Kahncode

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.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. 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.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@wing328
Copy link
Member

wing328 commented Sep 10, 2020

@Falanwe thanks for the PR.

Later we may want to use a regular expression to handle more edge cases, e.g.

var jsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");

We can go with your suggested fix for the time being.

@Falanwe
Copy link
Contributor Author

Falanwe commented Sep 10, 2020

I'm not really familiar with using regexes in UE4 (I'm more of a C# programmer usually, but I think it would be a good idea to use them indeed). I'll probably create a new pull request with that when I have a little time, getting inspiration from C#'s regex (hopefully the regex syntax is the same between the two, at least for this specific regex).

@wing328 wing328 merged commit 634e3eb into OpenAPITools:master Sep 12, 2020
@wing328 wing328 added this to the 5.0.0 milestone Oct 26, 2020
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.

None yet

2 participants