Skip to content

Add a new cli command to output version information (2nd attempt) #3892#3899

Merged
wing328 merged 3 commits intoswagger-api:masterfrom
MiguelGL:feature/version-in-cli
Oct 3, 2016
Merged

Add a new cli command to output version information (2nd attempt) #3892#3899
wing328 merged 3 commits intoswagger-api:masterfrom
MiguelGL:feature/version-in-cli

Conversation

@MiguelGL
Copy link
Copy Markdown
Contributor

PR checklist

  • Read the contribution guildelines.
  • Ran the shell/batch 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)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

(Second PR, after fixing issues with my account email references)

This is as per discussed in #3007. I am using maven resources filtering support to generate a resource file with the ${project.version} stamped on it.

Please note when running (from example from an IDE) from a non-maven env. this will lead to the
version be the literal unset string.

Miguel García López added 3 commits September 29, 2016 11:05
).

I am using maven resource filtering capabilities so that an existing version.properties resource file
gets filtered upon build and populated with the project version tag. This resource is then read
at runtime as required.
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
Copy link
Copy Markdown
Contributor

@ePaul ePaul Sep 29, 2016

Choose a reason for hiding this comment

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

I fear there might have some side effects as we are filtering all the files under src/main/resources, not just the version.properties one – including all the templates.

To make sure that there are none, could you actually run all the petstore samples and see if there are any changes in the output?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unless I'm missing anything build-wise, I think this should not be a problem because the filtering is enabled just for the swagger-codegen-cli artifact and should not apply to the resources from swagger-codegen artifact (which is where all the templates are included as resources).

Running the samples should be a good practice anyway, so I'll try to find the time to do so, however.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, good point, I missed this.

@wing328 wing328 added this to the v2.2.2 milestone Sep 29, 2016
@wing328 wing328 merged commit e633073 into swagger-api:master Oct 3, 2016
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Oct 3, 2016

@MiguelGL thanks for the PR, which has been merged into master.

Test result looks good:

$ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar version
2.2.2-SNAPSHOT

acramatte added a commit to comerge/swagger-codegen that referenced this pull request Oct 4, 2016
* upstream/master: (79 commits)
  add undertow
  Add a new cli command to output version information (2nd attempt) swagger-api#3892 (swagger-api#3899)
  fix python flask controller without tag (default_controller)
  [aspnet5] Fix basePath application to operations (swagger-api#3911)
  Bugfix/issue 3723 (swagger-api#3726)
  Cgardens nested object regex (swagger-api#3879)
  [Cpprest] Fixing issue swagger-api#3773 (swagger-api#3876)
  escape callback parameter for java(okhttp) and python
  fix warning in html generator
  [PHP] fix PHPUnit invocation, add basic phpunit.xml.dist (swagger-api#3864)
  [Java] Remove duplicated model description in Spring, JAX-RS models (swagger-api#3887)
  [PHP] Better PSR2 compatibility (swagger-api#3863)
  Mention security script in pull request template
  [Swift] Use thread safe manager dictionary
  Replace ^M with new line (\r) in mustache template (swagger-api#3865)
  [swfit] fix url param with base name
  [JaxRS]Show correct default value on CLI option description (swagger-api#3862)
  add title, description to HTML output (swagger-api#3860)
  fix trailing comma in go api client
  fix typescript-fetch base path by removing ending slash
  ...
@MiguelGL MiguelGL deleted the feature/version-in-cli branch March 6, 2017 20:35
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