micronaut-aws
micronaut-aws copied to clipboard
Move away from Jackson
Started with function-aws-api-proxy to gather feedback
- Is this going in the right direction?
- Are request bodies always Maps in Lambdas? I couldn't find a way to parse a JsonNode here
- I had to @SerdeImport` quite a few AWS classes, but I'm not sure our coverage has shown them all
- I had to write my own replacements for ObjectWriter and ObjectReader
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
@yawkat can you provide feedback?
The HateOas model doesn't seem to be coming through correctly...
{"message":"Internal Server Error","_links":{"self":[{"href":"https://null.execute-api.us-east-1.amazonaws.com/filter-error-spec-3","templated":false}]},"_embedded":{"errors":[{}]}}
Notice the errors are not serialized with any properties...
I've tried @SerdeImport(JsonError.class) but it has no effect on the result
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 https://github.com/micronaut-projects/micronaut-aws/blob/dca8a6cfe7a2325aac742034881d61d6cec64b56/aws-alexa-httpserver/src/test/groovy/io/micronaut/aws/alexa/httpserver/controllers/SkillControllerPathSpec.groovy#L42-L45
We send an AWS RequestEnvelope(link), and expect an AWS ResponseEnvelope in return.
Serde fails to deserialize the request model as No default constructor exists... I'm going to look into a custom deserializer
@graemerocher @yawkat I'm not sure how to use Serde to handle RequestEnvelope from AWS (see https://github.com/micronaut-projects/micronaut-aws/pull/1323#issuecomment-1083124887 above)
The class iteself and a lot of it's member classes use
@JsonDeserialize(builder = RequestEnvelope.Builder.class)
Which we don't support in Serde 🤔. Anyone got any ideas about getting round this?
@timyates i would use a JsonCreator in a mixin
@yawkat Like this?
public class RequestEnvelopeMixin {
@JsonCreator
public static RequestEnvelope factory(
@JsonProperty("version") String version,
@JsonProperty("session") Session session,
@JsonProperty("context") Context context,
@JsonProperty("request") Request request
) {
return RequestEnvelope.builder()
.withVersion(version)
.withSession(session)
.withContext(context)
.withRequest(request)
.build();
}
}
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 builder=
Currently blocked by https://github.com/micronaut-projects/micronaut-serialization/issues/176
The blocking issue seems closed; Any intentions to continue work on this?







