Razvan
02/20/2021, 6:36 PMRazvan
02/20/2021, 6:39 PMdata class TestObj(val keys: List<Map<String, String>>)
private val bodyTestLens = Body.auto<TestObj>("Object with map").toLens()
private fun testRoute(): ContractRoute {
val spec = "/test" meta {
summary = "Test showing error on map object"
tags += Tag("Test")
returning(
OK,
bodyTestLens to TestObj(listOf(mapOf("testKey" to "testValue"))),
"Okresponse",
"TestObj"
)
} bindContract Method.GET
return spec to testHandler()
}
fun testHandler(): HttpHandler = {
Response(OK).with(
bodyTestLens of TestObj(listOf(mapOf("responseKey" to "responseValue")))
)
}
The JS error
Resolver error at paths./test.get.responses.200.content.application/json.schema.properties.keys.items.oneOf.0.$ref
Could not resolve reference: Not Found
The json definition of that object
TestObj":{"properties":{"keys":{"items":{"oneOf":[{"$ref":"SingletonMap"}]},"example":[{"testKey":"testValue"}],"type":"array"}},"example":{"keys":[{"testKey":"testValue"}]},"type":"object","required":["keys"]}
No other declaration of SingletonMap
in the JSONRazvan
02/20/2021, 6:43 PMdata class TestObj(val keys: Map<String, String>)
"TestObj":{"properties":{"keys":{"additionalProperties":{"properties":{"testKey":{"example":"testValue","type":"string"}},"example":{"testKey":"testValue"},"type":"object","required":["testKey"]},"type":"object"}