OpenAPITools / OpenAPITools/openapi-generator
[BUG] Maven plugin - Error in spec validation does not fail build
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
With skipValidateSpec=false the Maven build succeeds even though spec validation logs errors.
openapi-generator version
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.4.0</version>
</plugin>
OpenAPI declaration file content or url
components:
schemas:
ContainerItemResponse:
properties:
container:
type: object
$ref: '#/components/schemas/Container'
Container:
properties:
containerType:
type: string
provokes
[ERROR] Illegal schema found with $ref combined with other properties, no properties should be defined alongside a $ref:
Yet, the Maven build succeeds.
Generation Details
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<id>xs2r-api-generation</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/../spec/api.yml</inputSpec>
<generatorName>spring</generatorName>
<auth>true</auth>
<supportingFilesToGenerate>ApiUtil.java</supportingFilesToGenerate>
<skipValidateSpec>false</skipValidateSpec>
<generateModels>false</generateModels>
<configOptions>
<languageSpecificPrimitives>
OrderStatus
</languageSpecificPrimitives>
<delegatePattern>true</delegatePattern>
</configOptions>
<typeMappings>
<typeMapping>string+date-time=Instant</typeMapping>
</typeMappings>
<importMappings>
Instant=java.time.Instant
</importMappings>
</configuration>
</execution>
</executions>
</plugin>
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's generate execution and the skipValidateSpec=false validation path, using the supplied schema as a reproduction. Trace how validation errors are reported and verify that the build fails for the invalid $ref/property combination with a Maven-plugin regression test.
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
- Mostly clear
- Newbie friendliness
- 35/100