-
Notifications
You must be signed in to change notification settings - Fork 2.2k
NullPointerException in parser with additionalProperties: false #1437
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
While it shouldn't throw NPE, please note that setting |
Parser is a separate project, and this is addressed in the latest parser snapshot, which will be released soon after swagger-core-1.5.4 is out. |
Hi @webron, I came across this comment while researching a related issue:
That's not consistent with the specification, which says additionalProperties "...is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the Schema Object definition is used instead." According to that specification, we would expect |
@tedepstein - you're right that it's inconsistent with what the spec says, but the actual error is in the spec as that was the implied intent which never made it to the docs (unfortunately). There may even still be an open ticket to change that in the doc in 2.0... |
@webron OK. It looks like this is all getting revisited in OpenAPI 3.0 anyway. For now, I'll assume the following.
Please let me know if any of this is not correct. |
I'm trying to restrict properties by setting additionalProperties: false. However, this seems to crash the YAML parser with a NullPointerException. When testing, please note that the most visible error is a syntax error from the JSON parser which kicks in after the YAML parser failed.
Main.java:
npe-demo.yaml:
The problem happens in PropertyDeserializer.deserialize(JsonParser jp, DeserializationContext ctxt): The propertyFromNode(node) call returns null, which causes the NPE in the next line.
The text was updated successfully, but these errors were encountered: