sphere-scala-libs icon indicating copy to clipboard operation
sphere-scala-libs copied to clipboard

Using java annotations instead of scala type aliases does not work

Open yanns opened this issue 6 years ago • 2 comments

Using java annotations directly has no effect. One have to use the scala type aliases.

Ex:

import io.sphere.mongo.generic.annotations.MongoKey
case class Student(
  @MongoKey("_id") id: String
)

does not work.

The following works

import io.sphere.mongo.generic.MongoKey
case class Student(
  @MongoKey("_id") id: String
)

yanns avatar Oct 10 '19 04:10 yanns

https://github.com/sphereio/sphere-scala-libs/pull/52 was a try to fix that, but it does not really fix the issue.

yanns avatar Oct 10 '19 04:10 yanns

An experimental branch is using magnolia for the derivation. It is only using scala annotation, fixing this issue: https://github.com/sphereio/sphere-scala-libs/tree/derive_with_magnolia

yanns avatar Feb 04 '20 15:02 yanns