https://kotlinlang.org logo
#http4k
Title
# http4k
r

Razvan

12/04/2021, 8:37 PM
what have you done with the swagger mapping... looks like the keys are mapped to lowecase mapping is kinda failing...
Copy code
data class TestData(
    val s1: Int? = null,
    val sXe: Int? = null,
)
object TestRoute {
    val bodyTest = Body.auto<TestData>().toLens()

    operator fun invoke(): ContractRoute {
        val metaData: RouteMetaDsl.() -> Unit = {
            tags += Tag("aaa")
            returning(
                Status.OK,
                bodyTest to TestData(s1 = 1, sXe = 22)
            )
        }
        return "/test" meta metaData bindContract Method.GET to { _: Request -> Response(Status.OK).with(bodyTest of TestData(s1 = 1, sXe = 12))  }
    }
}
if in the example
sXe
has a value the /api/swagger.json fails to load:
Copy code
Could not find sxe in TestData(s1=1, sXe=22)
if i set it to null in the example it loads but when i run the query I get as response body
Copy code
{
  "s1": 1,
  "sxe": 12
}
Looks like the uppercase
X
is no longer in uppercase... In
4.17.2.0
Strange, I got other endpints for which that works.... why the heck this one does not...
Copy code
"universeCode": "XXX",
    "universeLabel": "yyyy",
    "familyCode": "11",
d

dave

12/04/2021, 9:03 PM
Was there a Jackson upgrade between the versions?
#deflection 😂
r

Razvan

12/04/2021, 9:04 PM
Using the one you provide with http4k
d

dave

12/04/2021, 9:04 PM
Yep - but what version did you upgrade from?
We did introduce the OpenApiJackson somewhat recently
r

Razvan

12/04/2021, 9:05 PM
"4.14.1.2"
so i guess it might be that 😉
turns out is because is a single lowercase before the upercase. if I add a lowercase letter like
seX
it works
d

dave

12/04/2021, 9:06 PM
That definitely smells like a Jackson change.
Suggest checking the maven dependency tree for the different versions
(of Http4k-format-jackson)
There are the Jackson annotations that might help if it is that
r

Razvan

12/04/2021, 9:11 PM
turns out that it's just a new api that's why after migrating to the latest version (it uses jackson 2.13) all was ok... so i just have to rename that key no big deal... I try to avoid annotations when possible.
d

dave

12/04/2021, 9:12 PM
Yep - us too. 🙃
r

Razvan

12/04/2021, 9:13 PM
looks like nobody have problems with jackson, only two open issues... 😉
lol not the right repository 😉
d

dave

12/04/2021, 9:14 PM
Says 390 open issues on my browser...
r

Razvan

12/04/2021, 9:17 PM
was just the jackson repo (just the portal) others have plantly
Turns out 2.12 has the problem too, just never used a short enough key https://github.com/FasterXML/jackson-module-kotlin/issues/475 thanks for your time
d

dave

12/04/2021, 9:21 PM
Np 🙃
3 Views