Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1008 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 1008 Bytes

klite-openapi

A 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 context
  }

See sample Launcher.

Swagger UI

You can request the following endpoints in your context (/api in this case):

  • /openapi.json - will serve Open API json spec
  • /openapi.html - will serve Swagger UI
  • /openapi - will detect if you are asking for json or html

Docs