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

[Typescript] Enums generation #14579

Closed
wants to merge 7 commits into from
Closed

[Typescript] Enums generation #14579

wants to merge 7 commits into from

Conversation

ksvirkou-hubspot
Copy link
Contributor

@ksvirkou-hubspot ksvirkou-hubspot commented Feb 1, 2023

#14569

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.
  • In case you are adding a new generator, run the following additional script :
    ./bin/utils/ensure-up-to-date.sh
    
    Commit all changed files.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@ksvirkou-hubspot
Copy link
Contributor Author

Copy link
Contributor

@TiFu TiFu left a comment

Choose a reason for hiding this comment

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

LGTM!

Would this be a breaking change?
Before assignments like let enumVar: Enum = "C" worked. Does this still work now?

If it doesn't, I would consider this a breaking change which to my understanding should be filed against 7.0.x.

@ts Committee: Any opinions on this?

@akehir
Copy link
Contributor

akehir commented Feb 6, 2023

I'm not sure why we need to cast the enum options to any, ie: {{name}} = <any> {{{value}}}{{^-last}},{{/-last}}

With the any cast in the enum it shouldn't be breaking - but I'm not sure if with or without the breaking change (ie. with or without the any cast) is better.

@ksvirkou-hubspot
Copy link
Contributor Author

ksvirkou-hubspot commented Feb 6, 2023

LGTM!

Would this be a breaking change? Before assignments like let enumVar: Enum = "C" worked. Does this still work now?

If it doesn't, I would consider this a breaking change which to my understanding should be filed against 7.0.x.

@ts Committee: Any opinions on this?

It is a breaking change. I've just checked it.
Снимок экрана 2023-02-06 в 15 26 46

@akehir
Copy link
Contributor

akehir commented Feb 6, 2023

If it's a braking change anyways, then I don't think we need to include the any cast in the generated enum, or why is it there?

@ksvirkou-hubspot
Copy link
Contributor Author

If it's a braking change anyways, then I don't think we need to include the any cast in the generated enum, or why is it there?

I've just removed <any>.

@akehir
Copy link
Contributor

akehir commented Feb 8, 2023

@ksvirkou-hubspot : We should change the target branch to 7.0.

Also, I'm not sure if in certain cases the old handling would be preferred (generating a type instead of an enum) - and if we should have a setting to allow for the (old) handling as well. Maybe someone else from the @ts Committee has an opinion on this?

Other than that, the PR looks goot to me.

@ksvirkou-hubspot
Copy link
Contributor Author

@ksvirkou-hubspot : We should change the target branch to 7.0.

Also, I'm not sure if in certain cases the old handling would be preferred (generating a type instead of an enum) - and if we should have a setting to allow for the (old) handling as well. Maybe someone else from the @ts Committee has an opinion on this?

Other than that, the PR looks goot to me.

Do you mean 7.0.x branch?
@akehir

@ksvirkou-hubspot
Copy link
Contributor Author

ksvirkou-hubspot commented Feb 10, 2023

@ksvirkou-hubspot : We should change the target branch to 7.0.

Also, I'm not sure if in certain cases the old handling would be preferred (generating a type instead of an enum) - and if we should have a setting to allow for the (old) handling as well. Maybe someone else from the @ts Committee has an opinion on this?

Other than that, the PR looks goot to me.

I've just created PR but I can build it and generate samples.
Any Idea how to fix it?
I get error ./mvnw clean package

1723 [ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.5.5 from/to sonatype-snapshots (https://oss.sonatype.org/content/repositories/snapshots): transfer failed for https://oss.sonatype.org/content/repositories/snapshots/org/springframework/boot/spring-boot-dependencies/2.5.5/spring-boot-dependencies-2.5.5.pom @ line 21, column 25
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing. @ line 93, column 21
[ERROR] 'dependencies.dependency.version' for jakarta.validation:jakarta.validation-api:jar is missing. @ line 119, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 135, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-test:jar is missing. @ line 140, column 21
 @ 
1724 [ERROR] The build could not read 1 project -> [Help 1]
1724 [ERROR]   
1724 [ERROR]   The project org.openapitools:openapi-generator-online:7.0.0-SNAPSHOT (/gen/modules/openapi-generator-online/pom.xml) has 5 errors
1724 [ERROR]     Non-resolvable import POM: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.5.5 from/to sonatype-snapshots (https://oss.sonatype.org/content/repositories/snapshots): transfer failed for https://oss.sonatype.org/content/repositories/snapshots/org/springframework/boot/spring-boot-dependencies/2.5.5/spring-boot-dependencies-2.5.5.pom @ line 21, column 25: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 2]
1724 [ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing. @ line 93, column 21
1724 [ERROR]     'dependencies.dependency.version' for jakarta.validation:jakarta.validation-api:jar is missing. @ line 119, column 21
1724 [ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 135, column 21
1724 [ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-test:jar is missing. @ line 140, column 21
1725 [ERROR] 
1725 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
1726 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
1726 [ERROR] 
1726 [ERROR] For more information about the errors and possible solutions, please read the following articles:
1726 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
1726 [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

CC @akehir @TiFu

@TiFu
Copy link
Contributor

TiFu commented Feb 12, 2023

Not sure tbh. mvn clean package works on my machine with the 7.0.x branch :/ including the download for spring-boot-dependencies from sonatype.org

@ksvirkou-hubspot
Copy link
Contributor Author

Could you check this PR, please?
There is an error in the test but it is unrelated.
@TiFu

@ksvirkou-hubspot
Copy link
Contributor Author

Have you checked it by any chance?
@TiFu

@TiFu
Copy link
Contributor

TiFu commented Feb 19, 2023

Done & merged #14663.

Thank you @ksvirkou-hubspot for your contribution!

@TiFu TiFu closed this Feb 19, 2023
@ksvirkou-hubspot ksvirkou-hubspot deleted the feature/typescriptEnum branch March 21, 2023 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants