[typescript-node] fixed enum generator for top level enums#2266
[typescript-node] fixed enum generator for top level enums#2266macjohnny merged 5 commits intoOpenAPITools:masterfrom
Conversation
|
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
|
I have merged |
|
Dear TypeScript Technical Committee, can you have a look at this PR? @TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @nicokoenig @topce |
| export enum {{classname}} { | ||
| {{#allowableValues}} | ||
| {{#enumVars}} | ||
| {{name}} = <any> {{{value}}}{{^-last}},{{/-last}} |
There was a problem hiding this comment.
is there any particular reason for using <any> here?
it seems to work out without it e.g. here
There was a problem hiding this comment.
I just copied this part from the already existing code for enums inside a request. "" was already used in the first typescript node template from Geoff Brown.
Being not a typescript expert myself I just didn't want to change too much.
And I just asked my typescript college, he thinks is not needed...
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| public class TypescriptNodeEnumIntegrationTest extends AbstractIntegrationTest { |
There was a problem hiding this comment.
what does this test do?
to simply compare the generated files it would be better to add a new variation to https://github.com/OpenAPITools/openapi-generator/blob/master/bin/typescript-node-petstore-all.sh
There was a problem hiding this comment.
AbstractIntegrationTest are generally disabled at the moment (disabled not by me, and I have not understood why).
To test my implementation, I temporarily activated integration test.
And I am hoping that integration tests will be active in the future.
The petstore example doesn't use enums.
And I agree an example with enums would be create.
|
@christof-vollrath-spring-media ping... I just came across this issue and was excited to see a fix... but it sounds like it still needs work? |
For us, everything looked fine with this fix. In the end we stopped using the Typescript client because of other issues concerning inheritance for incoming data. |
|
@christof-vollrath-spring-media thanks for your feedback. which issues concerning inheritance to you refer to? |
|
@christof-vollrath-spring-media thanks for the PR, which has been included in the 4.1.0 release: https://twitter.com/oas_generator/status/1160000504455319553 |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.sh,./bin/security/{LANG}-petstore.shand./bin/openapi3/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,. Default:3.4.x,4.0.xmaster.Description of the PR
(details of the change, additional tests that have been done, reference to the issue for tracking, etc)