[maven-plugin] allow for ignore file override#4594
Closed
jimschubert wants to merge 3 commits intoswagger-api:masterfrom
Closed
[maven-plugin] allow for ignore file override#4594jimschubert wants to merge 3 commits intoswagger-api:masterfrom
jimschubert wants to merge 3 commits intoswagger-api:masterfrom
Conversation
The .swagger-codegen-ignore file is beneficial for existing source
directories to provide pattern-based exclusion rules for existing source
to be ignored by swagger codegen. Until now, there's been no utility
other than skipOverwrite to modify the initial generation of code
(either via CLI or maven plugin).
This commit adds support for an ignoreFileOverride option to both the
CLI and the maven plugin.
Example CLI usage:
```
java -jar swagger-codegen.jar generate \
-i swagger.json -l csharp \
-o target --ignore-file-override /path/to/ignore-file
```
Example Maven Plugin configuration:
```
<build>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.2-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/swagger.yaml</inputSpec>
<language>csharp</language>
<invokerPackage>io.swagger</invokerPackage>
<modelPackage>io.swagger.models</modelPackage>
<apiPackage>io.swagger.apis</apiPackage>
<ignoreFileOverride>/Users/jim/projects/swagger-codegen/.sample-ignore</ignoreFileOverride>
<configOptions>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
```
Contributor
Author
|
This PR would likely also resolve #3042 |
Contributor
|
@jimschubert just checked the PR, works greatly, no more clutter in the target directory :). |
jimschubert
commented
Jan 19, 2017
Contributor
Author
There was a problem hiding this comment.
@wing328 looks like a bad merge, maybe, causing CI to fail. I think this is missing the closing semicolon.
Contributor
There was a problem hiding this comment.
Yup, just noticed it. I'm pushing a fix.
Contributor
Author
There was a problem hiding this comment.
¯\_(ツ)_/¯ I only called it out because I know you're fairly busy and may not have seen it.
Contributor
There was a problem hiding this comment.
As always, thanks for catching the issue and make sure I'm aware 👍
3 tasks
Contributor
|
Closed via #4597 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)2.3.0branch for breaking (non-backward compatible) changes.Description of the PR
see #4514
The .swagger-codegen-ignore file is beneficial for existing source
directories to provide pattern-based exclusion rules for existing source
to be ignored by swagger codegen. Until now, there's been no utility
other than skipOverwrite to modify the initial generation of code
(either via CLI or maven plugin).
This commit adds support for an ignoreFileOverride option to both the
CLI and the maven plugin.
Example CLI usage:
Example Maven Plugin configuration:
To evaluate, you can publish the maven plugin locally:
And reference 2.2.2-SNAPSHOT in your pom with the new option
ignoreFileOverride.NOTES:
I called this
ignoreFileOverridebecause although it's intended for the initial generation, the option will act as an override for subsequent generations. There's no merge with the.swagger-codegen-ignorefile from your target templated code.I've updated the ignore processor to accept: directory, directory + filename, and File. This would allow us a future enhancement to allow modification of the
.swagger-codegen-ignorefilename.