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] Fix: any type (8 liner PR) #10080

Merged
merged 4 commits into from
Aug 3, 2021
Merged

Conversation

lwj5
Copy link
Contributor

@lwj5 lwj5 commented Aug 2, 2021

1 line change to fix Anytype in TS client.

Regenerated all samples but no changes.

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.
  • File the PR against the correct branch: master, 5.3.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02)

Copy link
Contributor

@amakhrov amakhrov left a comment

Choose a reason for hiding this comment

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

Thanks @lwj5 !
I'm currently looking at the earlier fix for other TS generators that addresses the same problem: https://github.com/OpenAPITools/openapi-generator/pull/6335/files#diff-e07b04e9dd1e4acea6c1d994fd38512f06fa272ca70e4bca3e8d9126e74e5ca0R167

It looks like in addition to the type mapping, that PR also removes any from composite type, thus avoiding things like MyModel & any in common use cases (which in TS is the same as any - hence unnecessarily loosens types).

Any thoughts about doing the same here?

@lwj5
Copy link
Contributor Author

lwj5 commented Aug 3, 2021

It looks like in addition to the type mapping, that PR also removes any from composite type, thus avoiding things like MyModel & any in common use cases (which in TS is the same as any - hence unnecessarily loosens types).

@amakhrov yes I noticed #6335 as well. When I opened the TS generator I saw that those changes were already there, only this line was missed out.

@lwj5
Copy link
Contributor Author

lwj5 commented Aug 3, 2021

p.s. checking again I realised AllOf is missed out as well. Added that in.

@lwj5 lwj5 changed the title [typescript] Fix: any type (1 liner PR) [typescript] Fix: any type (8 liner PR) Aug 3, 2021
Copy link
Contributor

@amakhrov amakhrov left a comment

Choose a reason for hiding this comment

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

Thanks!
It looks good to me.
Maybe also consider adding some tests?

@lwj5
Copy link
Contributor Author

lwj5 commented Aug 3, 2021

Sure, done :)

@wing328
Copy link
Member

wing328 commented Aug 3, 2021

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java also has this line of fix but TypeScriptClient codegen class doesn't extends AbstractTypeScriptClientCodegen.java at the moment.

In the future we may consider extending TypeScriptClient class with AbstractTypeScriptClientCodegen

@wing328 wing328 merged commit bea17c9 into OpenAPITools:master Aug 3, 2021
@wing328 wing328 added this to the 5.2.1 milestone Aug 3, 2021
@lwj5 lwj5 deleted the tsany branch March 31, 2023 06:09
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.

3 participants