https://kotlinlang.org logo
Title
r

Razvan

11/06/2020, 12:16 AM
And another unexpected behaviour:
data class Test(val name: Int)
you declare in meta :
receiving(Body.auto<Test>().toLens() to Test(3))
you call in a curl with
-d "{\"name\":5}"
it passes (it’s ok is just for reference of a correct call) but you call also with a bad keyname ex:
-d "{\"ne\":5}"
the call is valid. if name is a String this works as expected, fails if the key is spelled bad. I don’t use that value so don’t know if the created object would be valid. I’ll try to make a full test tomorrow evening too late for that right now.
d

dave

11/06/2020, 7:18 AM
This is down to the Jackson configuration for failing on unexpected keys.
You should get a 400 for the second case. Regardless it’s all in Jackson’s hands here - we’re just delegating to it to unmarshall
👍 1