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
JsonCreator annotation should work but does not #447
Comments
@devshorts thanks for the issue, we'll take a look. Pretty sure this functionality has changed with more recent Jackson upgrades since this code was first written. That is to say, I am not convinced this is intended to work with Finatra as at the time this was written the We're working on re-vamping our Jackson integration but in the interim we'll take a look at this. Thanks! |
@devshorts also...this works -- is it not acceptable to extend
|
In our situation not really. The reason is that the data we want to deserialize is from a company wide model library, and so tying in finatra annotations to those objects would leak that across our entire ecosystem, some of which are on 2.10, regular java, etc so it would wreak dependency havoc.
We worked around this by baking (in our finatra service extensions library) jackson modules that’s deserialize the specific data types we need, but each time a new one is onboarded with a json creator annotation we need to update the wrapper libs too.
… On Feb 24, 2018, at 9:21 AM, Christopher Coco ***@***.***> wrote:
@devshorts also...this works -- is it not acceptable to extend WrappedValue in your case?
case class Foo(int: Int) extends WrappedValue[Int]
test("wrapped value") {
val mapper = FinatraObjectMapper.create()
mapper.parse[Foo]("1") should be(Foo(1))
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@devshorts ok, understood. I'm glad you have a workaround for now at least. I've added this to the list of issues to address in re-working our Jackson integration. Thanks for the notes. |
Problem/Solution A link to the `@JsonCreator` issue #447 in Github is incorrectly rendered. Let's fix it. Differential Revision: https://phabricator.twitter.biz/D328669
The jackson statement on the finatra page states that
However, this isn't true. JsonCreator does work with scala:
Expected behavior
The finatra object mapper should respect json creator annotations
Actual behavior
Finatra object mapper doesn't:
We can work around this by getting the raw request and parsing the body using a standard jackson object mapper, but its a crappy workaround as it forces a non standard access pattern. We could also work around this by adding a custom deserializer module that forces a parse by companion object, but thats also nasty since it should just work out of the box
The text was updated successfully, but these errors were encountered: