Created by: ka-zo
This pull request fixes the issue #7867 (closed). The problem, this pull request addresses, is that the generated Dart client code included enum parameter names that were automatically generated based on enum values (see line 528 in modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java in tag v5.0.0-beta3) The problematic method can be found here: https://github.com/OpenAPITools/openapi-generator/blob/2715f1371a1bd438159e4aa79bd8f1fe172b03d9/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java#L528
However, the corresponding java code of OpenAPI Generator, mentioned above, was not ready to handle cases, where the enum value was a special character, like a % character. In such cases, the enum parameter name was a single '_' character. This pull request fixes this by converting special characters to alphanumeric strings using HTML escaping. I have checked multiple Java packages that can handle HTML escaping, and the most versatile and the most configurable one, that included the most HTML entities was the unbescape java package. Even though it was modified last time in 2018, it has too many advantages just to ignore it.
I have checked if the code is working by running mvnw clean install
in the root of the openapi-generator repository and then generating Dart client code using the generated openapi-generator-cli.jar file in the way mentioned in issue #7867 (closed).
The branch for this fix is checked out from tag v5.0.0-beta3, in line with How can I submit a PR for a branch (e.g. 4.2.x)?.
If I did not follow the pull request procedure appropriately, please forgive me, I am ready to improve if you give me directions.
Dart technical committee: @ircecho @swipesight @jaumard @amondnet
A couple of other contributors to Dart, who might have some influence on this PR: @wing328 @agilob
Closes #7867 (closed)
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.sh
to 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.