Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to fix the error: java.lang.NoSuchMethodError: 'io.swagger.v3.oas.models.media.Schema io.swagger.v3.oas.models.media.ComposedSchema.addAllOfItem(io.swagger.v3.oas.models.media.Schema)'? #659

Unanswered
filmor732 asked this question in Q&A
Discussion options

Dear Community,
I have a problem with the openapi-style-validator plugin for Maven and I wanted to ask you for help.

Description of the problem

When I validate a yaml file this error shows up:

[ERROR] Failed to execute goal org.openapitools.openapistylevalidator:openapi-style-validator-maven-plugin:1.10:validate (default) on project [...]: Execution default of goal org.openapitools.openapistylevalidator:openapi-style-validator-maven-plugin:1.10:validate failed: An API incompatibility was encountered while executing org.openapitools.openapistylevalidator:openapi-style-validator-maven-plugin:1.10:validate: java.lang.NoSuchMethodError: 'io.swagger.v3.oas.models.media.Schema io.swagger.v3.oas.models.media.ComposedSchema.addAllOfItem(io.swagger.v3.oas.models.media.Schema)'

To Reproduce

I'm using v1.10 of the openapi-style-validator plugin for Maven and OpenAPI specification v3.0.1.
There are models references in this yaml file in which the keyword allOf is used:

ExampleModel:
allOf:
- $ref: "[...]"
- type: object
properties:
violations:
type: array
items:
$ref: "[...]"

Just to narrow down the problem, I've written the keyword allOf in lowercase.
Like this:

ExampleModel:
allof:
- $ref: "[...]"
- type: object
properties:
violations:
type: array
items:
$ref: "[...]"

After changing to lowercase the validation worked without the error.
Now I think there's a connection between the keywords and the error..

Question

Have any of you ever seen this error or could someone help me here?

Thank you!

You must be logged in to vote

Replies: 2 comments

Comment options

Hi @laurawinck !

The Maven plugin was created by a contributor a while back and didn't get any love since then. I must admit I'm not familiar with it but I'll try to give it a look in the upcoming weeks.
With the error you have, it looks like a problem with the library of swagger-parser with version 3, but I'm not sure of the issue exactly.

Can you try to validate the same thing but with the .jar directly in command line? If the error is the same, it will be easier to pinpoint because it means the core of the validator is the problem. If the error is not present, that means it's a problem with the maven plugin and that could be harder to find.

If you have the time to try it with the jar I'd appreciate but if you don't, then I'll check on my free time in the upcoming weeks.
Thanks!

You must be logged in to vote
0 replies
Comment options

Hey @JFCote,
the error could be solved! You were right that it had something to do with the swagger library.

When running the openapi-style-validator plugin, there was a dependency conflict between several swagger-models libraries, which could be fixed by explicitly specifying the swagger-models dependency which should be used by the plugin:

 <plugin>
 <groupId>org.openapitools.openapistylevalidator</groupId>
 <artifactId>openapi-style-validator-maven-plugin</artifactId>
 <version>1.10</version>
 <configuration>
 <inputFile>${inputFile}</inputFile>
 <validateInfoLicense>true</validateInfoLicense>
 <validateInfoDescription>true</validateInfoDescription>
 <validateInfoContact>true</validateInfoContact>
 <validateOperationDescription>true</validateOperationDescription>
 <validateOperationSummary>true</validateOperationSummary>
 <validateOperationTag>true</validateOperationTag>
 </configuration>
 <executions>
 <execution>
 <phase>validate</phase>
 <goals>
 <goal>validate</goal>
 </goals>
 </execution>
 </executions>
 <dependencies>
 <dependency>
 <groupId>io.swagger.core.v3</groupId>
 <artifactId>swagger-models</artifactId>
 <version>2.2.2</version>
 </dependency>
 </dependencies>
 </plugin>

Thank you for your quick response and your support!! :)

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /