An experimental module to generate OpenAPI spec for klite routes.
Input/output parameters, paths, names will be generated from annotated route classes automatically. Use Swagger/OpenAPI annotations to specify descriptions or more details.
Usage:
@OpenAPIDefinition(info = Info(title = "My API", version = "1.x"))
class MyRoutes { ... }
context("/api") {
useOnly<JsonBody>()
annotated<MyRoutes>()
// ... more routes
openApi(annotations = MyRoutes::class.annotations) // adds /openapi endpoint to the /api context
}
See sample Launcher.
For nice visual representation of OpenAPI json output:
before(CorsHandler())
before openApi()
, as Swagger UI requires CORS to request openapi json from another host/domaindocker run -d -p 8080:8088 swaggerapi/swagger-ui
/openapi
route is available over https.