FasterXML / FasterXML/jackson-jaxrs-providers

ProviderBase: JAX-WS controller http handler method returning a generic collection forces static type serialisation for that collection

Open
#73 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
126
Forks
83
Avg merge
10h 11m
Merged PRs (30d)
1

Description

Example:

``` java
class Controller {
@GET
public Collection getCollection {
return Arrays.asList(new SubclassOfMyClass())
}
}

class MyClass {
public getA() {
...
}
}
class SubclassOfMyClass extends MyClass {
public getB() {
...
}
}
```

When used with Jersey's JacksonFeature, JSON returned will only contain attribute A and not attribute B because static serialisation of the root type is forced and there is no way I can override that. If, however, I wrap the collection with some other non-generic type, then static serialisation will not be forced and I will get both attribute "a" and "b" in the JSON produced by this GET.

jackson-jaxrs-base version used is 2.5.4.

Issue originally reported against Jersey but they are inclined to blame jackson: https://java.net/jira/browse/JERSEY-2939.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.