dave
03/10/2019, 4:47 PMv3.116.0
that we've just released, we've introduced a better API for http4k-contract
which is more consistent with the way we define route
meta. It looks like this: val router = "/basepath" bind contract {
renderer = SimpleJson(Jackson)
descriptionPath = "/swagger.json"
security = ApiKey(Query.required("the_api_key"), { true })
routes += "/descriptions" meta {
summary = "endpoint"
description = "some rambling description of what this thing actually does"
operationId = "echoMessage"
tags += Tag("tag1")
queries += Query.boolean().required("b", "booleanQuery")
receiving(Body.json("json").toLens())
} bindContract GET to { Response(OK) }
}
We've deprecated the old contract()
functions for the time being - they were getting a little out of hand with 8 or so overloaded (and all defaulted anyway) args, hence this change. Have a play and let us know if you like/hate it.
Also in this release, there's a new http4k-template-freemarker
module. 🙄fredrik.nordin
03/12/2019, 10:02 AMdave
03/12/2019, 10:04 AMbindContractRoute
...fredrik.nordin
03/12/2019, 10:22 AM