I have this simple class that I use as a model for...
# ktor
j
I have this simple class that I use as a model for a a GET call with ktor
Copy code
@Serializable
data class MeasurementsEndpoint(
    @SerialName("measurements")
    val measurements: List<Measurement>,

    @SerialName("measurementGroups")
    val measurementGroups: Map<String, MeasurementGroup>,
)
the call is made like so
http.get<MeasurementsEndpoint>(…)
nothing fancy here, but for some reason I get the error
kotlinx.serialization.MissingFieldException: Fields [measurements, measurementGroups] are required for type with serial name ‘no.beiningbogen.snute.sharedlibrary.library.model.endpoint.MeasurementsEndpoint’, but they were missing
When I test my request locally I don’t get this error, it only happens when I run the request from android or iOS clients. Any idea what I’m doing wrong?
a
Could you please share a request example that is made from Android or iOS?
j
I found that the error was due to wrong query parameters in my requests. Somehow the error message was telling the root object had an issue when it really was one of the nested object