FasterXML / jackson-annotations

Core annotations (annotations that only depend on jackson-core) for Jackson data processor
https://github.com/FasterXML/jackson
Apache License 2.0
1.03k stars 330 forks source link

@JsonView on generic types doesn't work #59

Closed dennisa closed 9 years ago

dennisa commented 9 years ago

I have a class defined as

@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = MyEvent.class, name = "myevent"), }) public abstract class Event { private D data; ... }

My event is defined as public class MyEvent extends Event {

}

And User is defined as

public class User { @JsonView({ Views.Meta.class }) private final String username;

private final String first;

private final String last; }

However, in my JaxRS web service the username is still getting serialized out when inside the MyEvent class, but on its won (standalone User) it excludes the serialization of the username.

cowtowncoder commented 9 years ago

I think this actually belongs to https://github.com/FasterXML/jackson-jaxrs-providers/issues unless the issue can be reproduced outside of JAX-RS container (in which case it'd belong to https://github.com/FasterXML/jackson-databind/issues).

If you could refile there, that'd be useful. But one more piece of information is needed: resource definition, to show the type declaration of the value to return.

cowtowncoder commented 9 years ago

Moved to https://github.com/FasterXML/jackson-databind/issues/804