Skip to content

Add post processing to files generated by TS generators #1063

Merged
wing328 merged 3 commits intomasterfrom
postProcessTS
Sep 29, 2018
Merged

Add post processing to files generated by TS generators #1063
wing328 merged 3 commits intomasterfrom
postProcessTS

Conversation

@wing328
Copy link
Copy Markdown
Member

@wing328 wing328 commented Sep 19, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if 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\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Allow users to define the environment variable "TS_POST_PROCESS_FILE" to post process TS files generated by TS generators (e.g. Angular, Fetch, etc), e.g. export TS_POST_PROCESS_FILE='/usr/local/bin/prettier --write'

Please refer to 07b2a36 for the code changes done by prettier as an example.

cc @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09)


@Override
public void postProcessFile(File file, String fileType) {
if (file == null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i suggest to call the parent method, too, since there could be some logic added later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure. I'll do it later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done via 9573d8e

/**
* Describes the result of uploading an image resource
*/
* Describes the result of uploading an image resource
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why was this changed? the generation parameters of the typescript-node samples have not changed, so I guess this is because of a local test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I simply want to show the change made by prettier.

I'll restore the old one before merging.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Restore via 9573d8e

@wing328
Copy link
Copy Markdown
Member Author

wing328 commented Sep 21, 2018

If no further feedback or question, I'll merge it tomorrow (Saturday)

@wing328 wing328 merged commit e0cbf46 into master Sep 29, 2018
@wing328 wing328 deleted the postProcessTS branch September 29, 2018 08:35
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
…#1063)

* add file post proess to TS generators

* update ts node petstore with prettier

* update base on feedback
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.

2 participants