-
Notifications
You must be signed in to change notification settings - Fork 533
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
Deserialization of OpenAPI v3 Schema fails #1311
Comments
Technically, that makes is an invalid OpenAPI definition as there's no support for full JSON Schema and some keywords are not supported (this will change in OAS3.1). |
@webron hmm, indeed, it mentions that (in no uncertain terms) in the spec: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#properties I wasn't aware of that, and I can see how extending the parser this way might set an unwanted precedent. Feel free to close the issue if you like. In the meantime I'll rewrite the schema using |
Hi everyone!
I think I found a very small issue in the OpenAPIDeserializer; the JSON schema parser more specifically.
tl;dr: The parser throws a NullPointerException when it encounters a JSON schema that uses
patternProperties
.First, let me try to explain what happened: I'm describing an endpoint which returns an OpenAPI v3 document ("swagger.yaml") as a response.
To describe the response format, I'm
$ref
ering to a local copy of the OpenAPI specification.When using swagger-parser to parse it as a schema, I get a
NullPointerException
inio.swagger.v3.parser.util.OpenAPIDeserializer.getSchema(OpenAPIDeserializer.java:2418)
(which is here).Turns out, the Parser is trying to access
result.extra
whenresult
isnull
.I'm not exactly sure what that signifies, but I discovered that the
patternProperties
key was causing the error.If I understand that part of the method correctly, I'd assume that
patternProperties
should be listed inSCHEMA_KEYS
.The following should file should trigger the NPE:
Edit: updated example yaml. Apparently, it only happens when using
$ref
.The text was updated successfully, but these errors were encountered: