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-angular: add providedIn for Angular 9+ #8324

Merged
merged 6 commits into from
Jan 6, 2021

Conversation

UnleashSpirit
Copy link
Contributor

@UnleashSpirit UnleashSpirit commented Jan 4, 2021

Adding new option, providedIn, for generator typescript-angular
Keep providedInRoot for backward compatibility but mark as deprecated for Angular 9+

fix: #6432

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, 5.1.x, 6.0.x
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@UnleashSpirit
Copy link
Contributor Author

technical committee for typescript
@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)

@UnleashSpirit UnleashSpirit marked this pull request as ready for review January 5, 2021 12:32
@wing328
Copy link
Member

wing328 commented Jan 6, 2021

Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors.

Let me know if you need help fixing it.

Ref: https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-can-i-update-commits-that-are-not-linked-to-my-github-account

Adding new option, providedIn, for generator typescript-angular
Keep providedInRoot for backward compatibility but mark as deprecated
for Angular 9+

fix: OpenAPITools#6432
infos about providedIn
Mark providedInRoot as deprecated
using typescript-angular-v9-provided-in-any.yaml
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.

the providers array should also be adapted according the the selected providedIn option:

providers: [{{^providedInRoot}}
{{#apiInfo}}{{#apis}}{{classname}}{{^-last}},
{{/-last}}{{/apis}}{{/apiInfo}} {{/providedInRoot}}]

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

@macjohnny macjohnny added this to the 5.0.1 milestone Jan 6, 2021
@macjohnny macjohnny changed the title feat: add providedIn for Angular 9+ typescript-angular: add providedIn for Angular 9+ Jan 6, 2021
@macjohnny
Copy link
Member

@UnleashSpirit thanks for your contribution!
please re-generate the samples

@UnleashSpirit
Copy link
Contributor Author

UnleashSpirit commented Jan 6, 2021

@UnleashSpirit thanks for your contribution!
please re-generate the samples

Hmm ok, now I guess I need some explanation.
I just ran bin/generate-samples.sh and git status gives me 104 files to commit.
But none of them show any change inside?

@macjohnny
Copy link
Member

Hmm ok, now I guess I need some explanation.
I just ran bin/generate-samples.sh and git status gives me 104 files to commit.
But none of them show any change inside?

simply run

mvn clean package
bin/generate-samples.sh

@UnleashSpirit
Copy link
Contributor Author

Ok I figured out why, I'm on windows and newline are a mix of LF & CRLF currently.
Using GitBash to generate-samples gives me 334 files changes
Using WSL to generate-samples gives me 104 files changes
What do I do ? ^^

@macjohnny
Copy link
Member

commit all changed files with WSL

@UnleashSpirit
Copy link
Contributor Author

UnleashSpirit commented Jan 6, 2021

commit all changed files with WSL

Ok so I changed my mind, I clone again my repo with WLS so only LF newline.
Run mvn clean package then bin/generate-samples.sh, and guess what ? Nothing change ! (except the sample related to your remark)

May be add * text=auto eol=lf to gitattributes works ?

@macjohnny macjohnny merged commit 9bd2a45 into OpenAPITools:master Jan 6, 2021
@UnleashSpirit UnleashSpirit deleted the fix_issue6432 branch January 22, 2021 11:14
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.

[REQ][typescript-angular] Angular 9 providedIn support
3 participants