-
Notifications
You must be signed in to change notification settings - Fork 81
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
Move away from Jackson #1323
base: 5.0.x
Are you sure you want to change the base?
Move away from Jackson #1323
Conversation
And direction
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.
This will be a breaking change. We have to do it for next mayor of AWS.
function-aws-api-proxy/build.gradle
Outdated
@@ -4,12 +4,15 @@ plugins { | |||
|
|||
dependencies { | |||
annotationProcessor libs.micronaut.graal | |||
annotationProcessor("io.micronaut.serde:micronaut-serde-processor:1.0.1") |
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.
I would recommend to update the build to 3.4.0, githubCoreBranch
to 3.5.0 and use the serde version in the BOM.
@@ -119,7 +117,7 @@ protected AbstractLambdaContainerHandler(Class<RequestType> requestClass, | |||
* | |||
* @return Return the object mapper. | |||
*/ | |||
protected abstract ObjectMapper objectMapper(); | |||
protected abstract JsonMapper 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.
There is a import io.micronaut.serde.ObjectMapper;
. Why not return it instead?
*/ | ||
default ObjectMapper getObjectMapper() { | ||
return getJsonCodec().getObjectMapper(); | ||
default JsonMapper getObjectMapper() { |
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.
There is a import io.micronaut.serde.ObjectMapper;
why not use instead of JsonMapper
?
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.
JsonCodec returns a JsonMapper, which isn't an ObjectMapper 😔
@@ -202,18 +220,18 @@ public ApplicationContext getApplicationContext() { | |||
} | |||
|
|||
@Override | |||
protected ObjectMapper objectMapper() { | |||
protected JsonMapper 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.
why not use import io.micronaut.serde.ObjectMapper
instead?
@yawkat can you provide feedback? |
final Map<?, ?> node = lambdaContainerEnvironment.getJsonCodec().decode(Map.class, body.get()); | ||
((MicronautAwsProxyRequest) containerRequest).setDecodedBody(node); |
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.
We can't decode to a serde JsonNode here (it fails to create one), so I fell back to a Map. This will break if the body is not a map (ie: a simple json string), but I'm not sure if Lambdas can receive simple strings
The HateOas model doesn't seem to be coming through correctly...
Notice the errors are not serialized with any properties... I've tried The model should look like this: |
@alvarosanchez Any idea how we migrate this to Serde serialization? The tests are checking for Jackson features which I don't believe we support in Serde |
This was the original reason for that code. If you are removing Jackson from here, then I don't think that feature is needed at all. Note that this change requires a new major version of the module. |
@alvarosanchez Thanks! We're well into new major version territory already, so that should be fine 👍 |
So here Lines 42 to 45 in dca8a6c
We send an AWS Serde fails to deserialize the request model as |
@graemerocher @yawkat I'm not sure how to use Serde to handle RequestEnvelope from AWS (see #1323 (comment) above) The class iteself and a lot of it's member classes use
Which we don't support in Serde 🤔. Anyone got any ideas about getting round this? |
@timyates i would use a |
@yawkat Like this?
I guess I need to mixin the whole tree of types before it will start working 😀 |
sure something like that. But yea looking at the other classes, this seems infeasible |
A custom deserializer is probably the simplest to be honest |
@graemerocher the classes only get bigger, see eg https://github.com/alexa/alexa-apis-for-java/blob/master/ask-sdk-model/src/com/amazon/ask/model/Context.java |
seems like we are going to have to add support for |
SonarCloud Quality Gate failed. |
Currently blocked by micronaut-projects/micronaut-serialization#176 |
The blocking issue seems closed; Any intentions to continue work on this? |
Started with function-aws-api-proxy to gather feedback
When I look at a scan for running the tests, I still see a LOT of Jackson, so I'm not sure if I'm doing the right thing
https://ge.micronaut.io/s/s7dmxjatvn6c4/dependencies?dependencies=fasterxml&expandAll