-
Notifications
You must be signed in to change notification settings - Fork 9
More descriptive exceptions need to be thrown #133
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
Comments
After some through debugging i've found out that i was copying from the yaml formatter to my IDE and losing the format. Resolved by copying without formatting from IDE pov. However maybe a proper yaml validator/openapi3 can be added? |
the processor does currently depend on the parser to provide validation info. Sometimes the parser output helps sometimes not :-( Having more specific validation would be nice. Have to do some research :-) |
closing this one, the feature request moved to openapi-processor/openapi-processor-core#77 |
since validation with the schema will probably not work I will take another look at the parser validation. |
ok, getting the following error when running via gradle but not when running via maven. So its is the maven plugin that does not print the validation messages. OpenApi3 validation failure
Validation error(s) :
paths./manager/epa.get.responses.400.description: Required field is missing 'description'. (code: 105)
From: paths./manager/epa.get.responses.400.description
paths./manager/epa.get.responses.400.extensions.type: Invalid key 'type' in map 'x-.+'. (code: 107)
From: paths./manager/epa.get.responses.400.extensions.type
paths./manager/epa.get.responses.400.extensions.properties: Invalid key 'properties' in map 'x-.+'. (code: 107)
From: paths./manager/epa.get.responses.400.extensions.properties |
Thanks Hauner! |
improved in 2021.6 |
So I've got the same error over here and I can't figure what's wrong with it Plugin Settings:
Error thrown: [ERROR] Failed to execute goal io.openapiprocessor:openapi-processor-maven-plugin:2021.1:process (default-cli) on project sboot-api-atom-global: openapi-processor-openapi-generation execution failed!: NullPointerException -> [Help 1] |
The interesting lines in the error are:
The plugin creates a This is strange because I tried a sample with your configuration and it doesn't fail. So the configuration itself is ok. Is it possible for you to provide a minimal project that shows the error? I will add a few validations to the plugin that will check & report problem with the options. It should help to understand why the options are empty. |
sboot-api-atom-global.yaml:
Mapping.yaml:
Is there anything else I should provide? |
Hmm, how do you run it? I just noticed that when I run No idea yet, what I'm doing wrong in the plugin. Looking into it. |
Found something, looks like the I don't fully understand at the moment what the difference is. My maven know-how is a bit limited. ;-) Here is an example with the moved options: <plugin>
<groupId>io.openapiprocessor</groupId>
<artifactId>openapi-processor-maven-plugin</artifactId>
<version>2021.1</version>
<configuration>
<id>openapi-generation</id>
<apiPath>${project.basedir}/src/main/resources/swagger/openapi.yaml</apiPath>
<!-- added options here -->
<options>
<values>
<targetDir>${project.basedir}/target/generated-sources</targetDir>
<mapping>${project.basedir}/src/main/resources/swagger/mapping.yaml</mapping>
<parser>OPENAPI4J</parser>
<showWarnings>true</showWarnings>
</values>
</options>
</configuration>
<executions>
<execution>
<id>openapi-generation</id>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<!-- removed configuration -->
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.openapiprocessor</groupId>
<artifactId>openapi-processor-spring</artifactId>
<version>2022.1</version>
</dependency>
</dependencies>
<plugin> |
I learned a few things about maven today and I found a "simpler" solution. just change you original configuration before: <executions>
<execution>
<id>openapi-generation</id>
<phase>generate-sources</phase>
</execution>
</executions> to after: <executions>
<execution>
<id>default-cli</id>
<phase>generate-sources</phase>
</execution>
</executions> The |
Thanks Hauner!! This really solved my problem! |
Thanks for reporting and for confirming that it helped. :-) |
Im unable to debug my openapi.yaml file properly if this validation error is thrown.
I've got another validator for my openapi spec and this reports that my openapi spec has no validation errors.
Plugin settings:
OpenAPI SPEC:
The text was updated successfully, but these errors were encountered: