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

Fix incorrect enum values for typescript clients #7370

Closed
wants to merge 7 commits into from
Closed

Fix incorrect enum values for typescript clients #7370

wants to merge 7 commits into from

Conversation

epidemia
Copy link
Contributor

@epidemia epidemia commented Sep 8, 2020

fixes #7369
Enum values are generated incorrectly for PascalCase enum property naming type when the source enum values are in uppercase with underscores.

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 and others added 3 commits September 8, 2020 18:25
* Properly decode $ref
fixes #5720

* Specify decoding encoding

* Nicer syntax

* UTF-8 typo

* Unescape special characters

* Change order of unescaping to prevent escaped sequences by accident

* Comment for special decoding

Co-authored-by: Jim Schubert <[email protected]>

* Add unit test for simple ref decoding

Co-authored-by: Jim Schubert <[email protected]>
Copy link
Member

@macjohnny macjohnny left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -690,9 +690,9 @@ private String getNameUsingEnumPropertyNaming(String name) {
case original:
return name;
case camelCase:
return camelize(name, true);
return camelize(StringUtils.lowerCase(name), true);
Copy link
Member

Choose a reason for hiding this comment

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

I think this breaks the behavior if e.g. name is someEnumValue, which would incorrectly result in someenumvalue, as opposed to someEnumValue

case PascalCase:
return camelize(name);
return camelize(StringUtils.lowerCase(name));
Copy link
Member

Choose a reason for hiding this comment

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

I think this breaks the behavior if e.g. name is someEnumValue, which would incorrectly result in someenumvalue, as opposed to SomeEnumValue

@macjohnny
Copy link
Member

this is a breaking change, but the fallback is to use enumPropertyNaming=original

aomochalov added 3 commits September 9, 2020 11:19
# Conflicts:
#	modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java
#	modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/TypeScriptAxiosClientCodegenTest.java
@epidemia epidemia closed this Sep 9, 2020
@epidemia epidemia deleted the issue_7369 branch September 9, 2020 08:29
@macjohnny
Copy link
Member

replaced by #7378

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.

[BUG] Incorrect enum values for typescript clients
5 participants