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

Feature: Run OpenApi-Generator maven plug-in from within Eclipse #1332

Merged
merged 2 commits into from
Nov 4, 2018
Merged

Feature: Run OpenApi-Generator maven plug-in from within Eclipse #1332

merged 2 commits into from
Nov 4, 2018

Conversation

andreas-eternach
Copy link
Contributor

@andreas-eternach andreas-eternach commented Oct 26, 2018

  • Added life-cycle-mapping for recognition by M2E
  • Make BuildContext injectable by M2E in oder to detect if json-source
    has been modified and a regeneration is required.

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.4.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

insert support for Eclipse-M2E to be capable of running code-generation in eclipse

To close #509

* Added life-cycle-mapping for recognition by M2E
* Make BuildContext injectable by M2E in oder to detect if json-source
has been modified and a regeneration is required.
@andreas-eternach
Copy link
Contributor Author

i have no clue why circleci is failing, any explanation is very welcome.

@wing328
Copy link
Member

wing328 commented Oct 27, 2018

@andreas-eternach the CircleCI issue is not related to this PR. If you merge the latest master into this branch or rebase on the latest master, the issue should go away.

@wing328
Copy link
Member

wing328 commented Oct 27, 2018

cc @jmini

@@ -573,30 +599,39 @@ public void execute() throws MojoExecutionException {
return;
}
adjustAdditionalProperties(config);
try {
// try {
Copy link
Member

Choose a reason for hiding this comment

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

Minor suggestion: remove this line as it's commented out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed with second commit.

if (buildContext != null) {
buildContext.addError(inputSpecFile, 0, 0, "unexpected error in Open-API generation", e);
}
getLog().error(e);
Copy link
Member

Choose a reason for hiding this comment

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

Can you we use 4-space instead of tab?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed with second commit.

} catch (Exception e) {
// Maven logs exceptions thrown by plugins only if invoked with -e
// I find it annoying to jump through hoops to get basic diagnostic information,
// so let's log it in any case:
getLog().error(e);
if (buildContext != null) {
buildContext.addError(inputSpecFile, 0, 0, "unexpected error in Open-API generation", e);
Copy link
Member

Choose a reason for hiding this comment

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

Minor suggestion: add 4-space to indent this line properly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed with second commit.

new DefaultGenerator().opts(input).generate();

if (buildContext != null) {
buildContext.refresh(new File(getCompileSourceRoot()));
Copy link
Member

Choose a reason for hiding this comment

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

Use 4-space instead of 2-space inside the if block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed with second commit.

Copy link
Member

Choose a reason for hiding this comment

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

@andreas-eternach thanks for the quick fix. The change looks good to me.

@wing328 wing328 merged commit eb5a8cc into OpenAPITools:master Nov 4, 2018
@wing328 wing328 changed the title feat: OpenApi-generation from within eclipse (#509) Feature: Run OpenApi-Generator maven plug-in from within Eclipse Nov 4, 2018
@wing328
Copy link
Member

wing328 commented Nov 15, 2018

@andreas-eternach thanks for the PR, which has been included in the v3.3.3 release: https://twitter.com/oas_generator/status/1062929948191510528

A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
…APITools#1332)

* feat: OpenApi-generation from within eclipse (OpenAPITools#509)

* Added life-cycle-mapping for recognition by M2E
* Make BuildContext injectable by M2E in oder to detect if json-source
has been modified and a regeneration is required.

* core: fix indentation problems, remove commented code
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.

Plugin does not work from inside Eclipse
2 participants