Open elgca opened 1 day ago
There are more things. Routes
can only add endpoints and must include execution logic.
def add[A: Tag, I, E: SafeClassTag, O: Flat](e: Endpoint[A, I, E, O, Any])(
f: I => O < (Async & Env[A] & Abort[E])
)(using Frame): Unit < Routes =
There should be support for loading existing endpoints in the library class, whether it's integrating existing endpoints or adding tools for endpoints provided by tapir such as swagger, staticResource, and staticFiles. It's very convenient. I spent a lot of time understanding the Emit
, but it is not need work when creating swagger endpoints. I have to do something like :
def swaggerUI2(r: Unit < Routes): Unit < Routes = {
Emit.run[Route].apply(r).map { (seq, _) =>
val end: List[AnyEndpoint] = seq.toSeq.map { x =>
val z: AnyEndpoint = x.endpoint.endpoint
z
}.toList
SwaggerInterpreter()
.fromEndpoints(end, "hello-kyo", "1.0.0")
.map(Route(_))
.foldLeft(r) { (a, b) =>
a.andThen(Emit(b).unit)
}
}
}
When running application built with graalvm native-image, start fails due to java.lang.NoSuchFieldException: producerIndex
I have made some settings in the
META-INF/native-image
, including files created from-agentlib:native-image-agent
、reflect-config.json
...OS : windows 11 graalvm: graalvm-oracle:21
native-image options:
here is the demo:
server.zip