Skip to content
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

Unable to use registerReferencedType on Option with default value None #598

Closed
AntoineDuComptoirDesPharmacies opened this issue Sep 2, 2022 · 1 comment

Comments

@AntoineDuComptoirDesPharmacies

With the following scala case classes :

final case class NestedLong(var id: Option[Long] = None)
final case class ParentWithNested(var nested: NestedLong)

When deserializing this, we obtain an Integer instead of a Long in the id field.
As stated in the FAQ, we used the following sentence to give the correct Option primitive type on deserialize :
ScalaAnnotationIntrospectorModule.registerReferencedValueType(classOf[NestedLong], "id", classOf[Long])

However, it seems that it doesn't work when the option have an initialization value set to None.
The same model without initialization works :

final case class NestedLong(var id: Option[Long])
final case class ParentWithNested(var nested: NestedLong)

Yours faithfully,
LCDP

@pjfanning
Copy link
Member

I didn't see this and raised #599 - the latter has commits based on it - so I'll close this as the duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants