-
Notifications
You must be signed in to change notification settings - Fork 135
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
NPE when generating schema for class with JsonValue annotation over Collection/Array #34
Comments
Thanks. I assume this also occurs with 2.3.2. |
Same occurs in 2.3.2 and in 2.4.2. The problem seems to be in AsArraySerializerBase.java: @Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
throws JsonMappingException
{
JsonArrayFormatVisitor arrayVisitor = (visitor == null) ? null : visitor.expectArrayFormat(typeHint);
if (arrayVisitor != null) {
TypeFactory tf = visitor.getProvider().getTypeFactory();
JavaType contentType = tf.moreSpecificType(_elementType, typeHint.getContentType()); Here, typeHint is null for a List/Set used in a @JsonValue |
Fixed this in |
This bug seems not to be completely fixed. It doesn't throw a NPE anymore, but it doesn't generate the schema correctly either. It just generates: {
"type":"array"
} I extended the test to use a collection of nested beans, and expected to see the schema of the nested items, e.g.: {
"type" : "array",
"items" : {
"type" : "object",
"properties" : {
"property1" : {
"type" : "integer"
},
"property2" : {
"type" : "string"
}
}
}
} See updated test: |
Sounds like related bug (something that was masked by NPE most likely). I'll create a new issue since it may take longer to figure out this problem. |
When trying to generate jsonSchema for the following class, an NPE is raised.
jackson-databind version is 2.2.3.
The text was updated successfully, but these errors were encountered: