-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
NullPointerException in StaticHtmlGenerator when components: doesn't have schema: #1623
Comments
Can you please test with the latest stable version instead and if it's still an issue? |
@wing328 : the code is still the same on master: Lines 193 to 202 in df19c13
Replacing line 197 with @jmalin-signalfx can you propose a pull request? do you need help for that? |
@jmalin-signalfx do you need help filing a fix? Let us know. |
@jmalin-signalfx The issue has been fixed by @jmini. Please pull the latest master to give it a try. |
Description
I found a possible bug the 3.0.3 generator for html. If a file has a
components
object that doesn't contain aschemas
object, I get a NullPointerException in the StaticHtmlGenerator.I've tested this against 17 different
.yaml
files. The only ones that fail have acomponents
object that contains asecuritySchemes
object but not aschemas
object.The full error is:
openapi-generator version
v3.0.3. Don't know if it's a regression, because I haven't used an earlier version.
OpenAPI declaration file content or url
The entire contents of the
components
object is:Sample YAML file available as a Gist:
https://gist.github.com/jmalin-signalfx/0d18add1615f3fe19de5da716ad9b9ed
Command line used for generation
Steps to reproduce
Attempt to generate HTML from the YAML.
Note: I don't think this is related to templates. I've customized the templates, but 15 YAML files work, and 2 dont', all using the same templates.
Related issues/PRs
Haven't found any.
Suggest a fix/enhancement
I looked at
StaticHtmlGenerator.preprocessOpenAPI(StaticHtmlGenerator.java
line 197. It's in the following method:I notice that the method seems to be getting
Schemas
objects from theComponents
objects, but it's not checking to see if aSchemas
object actually exists. According to the OAS3 3.0.2 specification, none of the fields within theComponents
object is required, so aComponents
object that only contains asecuritySchemes
object is valid.The text was updated successfully, but these errors were encountered: