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

Nezteb

05/31/2019, 7:14 PM
so i’m trying to upgrade to 3.146.0 to get that new OpenAPI goodness, but i’m getting weird stack traces anytime i try to access the generated swagger:
if i upgrade to 3.151.0, i get
org.http4k.contract.openapi.v3.NoFieldFound
when trying to retrieve the swagger
but i can’t figure out what field is missing
d

dave

05/31/2019, 8:39 PM
@Nezteb hmmm. Have you got any annotated fields?
I've added the name and type to the exception, but it's not released yet
Are your data objects kotlin or java?
You can put a debugger in the FieldRetrival.compose at the throw point and go from there.
(it turns out that the reflective thing is quite involved with a few different ways in which you can get the value from the reflection API.
Also, try to write your own FieldRetreival and it should reveal itself.
On the plus side, I've managed to track down a few of these already, and it's easy to fix locally (and then fall back a new FieldRetrieval that fixed it, so you won't necessarily have to wait for us to release the whole thing.)
Also - make sure you have absolutely no null values in your model - that definitely makes it angry. 🙃
here's an example FieldRetrieval you can use - just stick it at the end of the list:
Copy code
object FallbackReporter : FieldRetrieval {
    override fun invoke(p1: Any, p2: String): Field {
        throw IllegalArgumentException("$p2 cannot be found in $p1")
    }
}
2 Views