-
Notifications
You must be signed in to change notification settings - Fork 6k
[maven-plugin] allow for ignore file override #4594
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
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>
```
|
This PR would likely also resolve #3042 |
|
@jimschubert just checked the PR, works greatly, no more clutter in the target directory :). |
| // override with any special handling of the JMustache compiler | ||
| @SuppressWarnings("unused") | ||
| public Compiler processCompiler(Compiler compiler) { | ||
| return compiler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 looks like a bad merge, maybe, causing CI to fail. I think this is missing the closing semicolon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, just noticed it. I'm pushing a fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the bad merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¯\_(ツ)_/¯ I only called it out because I know you're fairly busy and may not have seen it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As always, thanks for catching the issue and make sure I'm aware 👍
|
Closed via #4597 |
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.