Tim Abil
05/24/2022, 7:21 PM@Json
property annotation that overrides serialized property names while visiting class properties with DeclarationDescriptorVisitor
from declarationChecker{..}
. When visitPropertyDescriptor
is invoked descriptor.annotations
is always empty.import com.squareup.moshi.Json
data class Sample(
val a: Color,
@Json(name="json_name") <-- not visible from declaration checker
val b: More,
)
ephemient
05/24/2022, 7:32 PM@Json
doesn't declare applicable targets (therefore all are allowed): https://square.github.io/moshi/1.x/moshi/moshi/com.squareup.moshi/-json/index.html
which means it'll be treated as @param:Json
in this usage by default: https://kotlinlang.org/docs/annotations.html#annotation-use-site-targetsTim Abil
05/24/2022, 7:44 PMephemient
05/24/2022, 7:45 PM@property:Json(...) val
Tim Abil
05/24/2022, 7:47 PM