dave
07/09/2021, 1:22 PMAndrew O'Hara
07/09/2021, 5:11 PMStefan
07/12/2021, 9:58 AMMap<Key,Any>
as context to each request?Norman
07/12/2021, 4:05 PMJoseph Pickering
07/13/2021, 12:00 PMAndrew O'Hara
07/18/2021, 5:58 PMdave
07/21/2021, 5:46 PMdave
07/27/2021, 9:26 AMdave
07/27/2021, 4:37 PMCosmin Victor Celea
08/05/2021, 6:17 PMRazvan
08/10/2021, 3:17 PMException in thread "main" java.lang.ExceptionInInitializerError
at guide.reference.graphql.TmpKt.main(Tmp.kt:32)
at guide.reference.graphql.TmpKt.main(Tmp.kt)
Caused by: com.expediagroup.graphql.generator.exceptions.EmptyQueryTypeException: Invalid query object type - no valid queries are available.
andyg
08/11/2021, 8:19 AMmain()
when the entry point is class HelloServerlessHttp4k : ApiGatewayV1LambdaFunction(http4kApp)
. Also, how to import the LambdaHttpClient
? thank youandyg
08/11/2021, 8:34 AMval myLens = Query.nonEmptyString().required("ids")...split(";")
Within the route I can insert the request then add functions: myLens(myRequest).split(";")
but is it possible to add the split
to the Lens definition?Razvan
08/12/2021, 8:43 AMprivate val bodyTokenResponseLens = Body.auto<TokenResponse>().toLens()
fun createTokenRoute(): ContractRoute = "/token" meta {
returning(OK, bodyTokenResponseLens to TokenResponse("A", "B", 1800))
} bindContract <http://Method.POST|Method.POST> to createTokenHandler2()
private fun createTokenHandler2(): HttpHandler = { req -> Response(OK) }
try to use it in with a openApi3 render I get a
Exception in thread "main" java.lang.NullPointerException
at org.http4k.contract.RouteMetaDsl.returningStatus(routeMeta.kt:85)
at org.http4k.contract.RouteMetaDsl.returningStatus$default(routeMeta.kt:83)
If i comment the return line is all OK, if it take the code and move it in test class it runs...Razvan
08/12/2021, 9:56 AMclass FakeBasicAuthSecurity(realm: String, credentials: Credentials, val name: String = "basicAuth") : Security {
override val filter: Filter = ServerFilters.BasicAuth(realm, credentials )
companion object
}
and I use it in
security = FakeBasicAuthSecurity("Backbone", Credentials("tom", "jerry"))
No Security is added generated spec, any reason why ?Sean Abbott
08/12/2021, 6:16 PMobject ExampleContractRoute {
// this specifies the route contract, including examples of the input and output body objects - they will
// get exploded into JSON schema in the OpenAPI docs
private val spec = "/echo" meta {
summary = "echoes the name and message sent to it"
receiving(nameAndMessageLens to NameAndMessage("jim", "hello!"))
returning(OK, nameAndMessageLens to NameAndMessage("jim", "hello!"))
} bindContract POST
// note that because we don't have any dynamic parameters, we can use a HttpHandler instance instead of a function
private val echo: HttpHandler = { request: Request ->
val received: NameAndMessage = nameAndMessageLens(request)
Response(OK).with(nameAndMessageLens of received)
}
operator fun invoke(): ContractRoute = spec to echo
}
which is being called inside contract in my app function
"/" bind contract {
renderer = OpenApi3(ApiInfo("Test API", "v1.0"), Jackson)
// Return Swagger API definition under /swagger.json
descriptionPath = "/swagger.json"
// Add contract routes
routes += ExampleContractRoute()
routes += HealthRoute()
},
and I'm trying to add a nested route to the ExampleContract route, like /echo/excited
just as a toy example What would be idiomatic way to do that?Matt
08/13/2021, 8:41 AMGopal S Akshintala
08/16/2021, 4:25 PMMatt
08/18/2021, 11:21 AMSean Abbott
08/23/2021, 7:16 PMfun partnerAccountTaskRoute(): ContractRoute {
return spec to ::partnerAccountTaskHandler
}
fun partnerAccountTaskHandler(partnerAccountId: Long, task: String, taskType: String): HttpHandler = { request: Request ->
...
}
and
fun validTaskTypeFilter() = Filter { next ->
...
}
but I can't figure out how to compose the spec to ::function
with the filter on itandyg
08/27/2021, 9:55 AMBart
08/28/2021, 6:02 PMJippe Holwerda
09/08/2021, 9:26 AMVojtěch Knyttl
09/09/2021, 3:00 PMAndrew O'Hara
09/09/2021, 9:29 PM+
appears to be valid for application/x-www-form-urlencoded
content such as query args, so http4k's implementation is valid. A workaround would still be great, if possible.Sandymcp
09/14/2021, 8:40 AMSandymcp
09/22/2021, 12:07 PMArnab
09/30/2021, 11:20 AMobject HelloWorldQueryHandler {
fun hello(yourname: String) = "Hello $yourname"
}
class GraphQLHandler: GraphQLHandler {
private val graphql = newGraphQL(
toSchema(
SchemaGeneratorConfig(supportedPackages = listOf("no.example.capgemini")),
listOf(TopLevelObject(HelloWorldQueryHandler))
)
).build()
override fun invoke(request: GraphQLRequest): GraphQLResponse =
GraphQLResponse.from(
graphql.execute {
Builder()
.query(request.query)
.variables(request.variables)
}
)
}
fun main() {
val app = routes("/graphql" bind graphQL(GraphQLHandler()))
app.asServer(Netty()).start()
}
Now, this works when I use the GraphQL playground, but not when I use the Graphiql client. For the Graphiql client, this just returns an empty response. Am I missing something? Why is there a difference?MrNiamh
10/04/2021, 7:09 PMError: org.eclipse.jetty.websocket.api.CloseException: java.util.concurrent.TimeoutException: Idle timeout expired: 300008/300000 ms
s4nchez
10/05/2021, 1:48 PMval sse = sse(
"/hello" bind sse(
"/{name}" bind { sse: Sse ->
val name = sse.connectRequest.path("name")!!
sse.send(Event("event1", "hello $name", "123"))
sse.send(Event("event2", "again $name", "456"))
sse.send(Data("goodbye $name".byteInputStream()))
}
)
)