hi! i am currently updating to ktor2 and i am movi...
# ktor
b
hi! i am currently updating to ktor2 and i am moving from the location API to the resource API. in my URL parameters i used to have a parameter defined like this val format: ImportFormat = ImportFormat.NDJSONLD (where import format is an enum). it was possible to omit the enum parameter in the location API and it just took the default value. now i get the exception Can't transform call to resource with an underlying NPE. any ideas?
the whole thing looks like this
Copy code
@Serializable
@Resource("/api/import-results")
class ImportResultData(
    val resource: String,
    val format: ImportFormat = ImportFormat.NDJSONLD
)
r
Can you share stacktrace, please?
maybe i have to configure the serializer used?
btw it also doesnt work to make it just nullable val format: ImportFormat?
stacktrace looks the same
r
Ok, i reproduced it. Will open PR shortly
b
any fast workaround for 2.0.1?
r
I can’t think of any workaround for now
b
i found one .. just write a custom serializer for the enum like this
and then use
Copy code
@Serializable(with = ImportFormatSerializer::class) val format: ImportFormat = ImportFormat.NDJSONLD