-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove JsonView filter #11189
Remove JsonView filter #11189
Conversation
@sdelamo Is there something wrong with the test I wrote? It looks like the configuration is not applied for GraalVM |
maybe the metadata is lost when running without reflection? |
Looks like Jackson needs reflective metadata to read the view annotation |
@@ -64,13 +65,24 @@ public JsonMediaTypeCodec(ObjectMapper objectMapper, | |||
* @param applicationConfiguration The common application configurations | |||
* @param codecConfiguration The configuration for the codec | |||
*/ | |||
@Inject | |||
public JsonMediaTypeCodec(BeanProvider<ObjectMapper> objectMapper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we deprecate this constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see: #11194
@@ -75,7 +76,6 @@ public JsonStreamMediaTypeCodec(ObjectMapper objectMapper, | |||
* @param applicationConfiguration The common application configurations | |||
* @param codecConfiguration The configuration for the codec | |||
*/ | |||
@Inject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we deprecate this constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see: #11194
jackson-databind/src/main/java/io/micronaut/jackson/databind/JacksonDatabindMapper.java
Show resolved
Hide resolved
jackson-databind/src/main/java/io/micronaut/jackson/databind/JacksonDatabindMapper.java
Show resolved
Hide resolved
...server-netty/src/main/java/io/micronaut/http/server/netty/jackson/JsonViewCodecResolver.java
Show resolved
Hide resolved
...etty/src/main/java/io/micronaut/http/server/netty/jackson/JsonViewMediaTypeCodecFactory.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add the deprecation notices #11194 even if the classes are themselves already deprecated.
Quality Gate passedIssues Measures |
@Requires(property = JsonViewServerFilter.PROPERTY_JSON_VIEW_ENABLED) | ||
@ServerFilter("/**") | ||
@Internal | ||
public class JsonViewServerFilter implements Ordered { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strictly speaking we have to leave this in place and deprecate it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It's internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh in that case no problem :)
Complementary to micronaut-projects/micronaut-core#11189 .
* Implement JsonView support Complementary to micronaut-projects/micronaut-core#11189 . * review
This PR changes how JsonView used to work before. Instead of detecting the
JsonView
annotation using the filter and invoking serialization, the responsibility is moved to theJsonMapper
. This requires the method annotation to be correctly propagated to the serializer; we need to copy the method annotations if the argument is unwrapped. Jax-RS also expects that.The property to enable the view is
jackson.json-view.enabled
, but that also worked for Serde, so we need to fix it before the next minor release.