swagger-api / swagger-api/swagger-codegen
How can I fail the build on warnings?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I have the following configuration :
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.23</version>
<executions>
<execution>
<id>generate-models</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>swagger.yaml</inputSpec>
<modelPackage>com.models</modelPackage>
<generateApis>false</generateApis>
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<language>java</language>
<configOptions>
<dateLibrary>java8</dateLibrary>
<useBeanValidation>true</useBeanValidation>
<serializableModel>true</serializableModel>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<failOnWarning>true</failOnWarning>
<failOnError>true</failOnError>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</plugin>
And in my swagger I purposely referenced an invalid value called "New type"
My goal is to fail the build when this situation happens (or any error or warning actually) but I only see a warning and my build continues as usual.
[WARNING] no property from New type
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Maven plugin configuration in the issue and the referenced swagger.yaml, then trace where the generator emits the "no property from New type" warning. Determine whether that warning is expected to fail the Maven build and identify the relevant failure behavior; done means the documented invalid value causes the build to fail.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100