-
Notifications
You must be signed in to change notification settings - Fork 33
V2 Documenting Routes
The Swagger-UI plugin provides functions to create get, put, post, delete, ... routes. These work exactly the same as their respective base Ktor-functions, but allow OpenAPI documentation to be added. Functions to create routes provided by the plugin and those from Ktor can be mixed and allow for a gradual enhancement of the api with documentation.
Documentation can be added to get
, post
, put
, delete
, patch
, options
, head
, route
and method
. If multiple parts in a route have documentation, the documentation is merged with priority given to the last part (Example: the "route" and a nested "get" have a "description" set. When the two documentations are merged, the description of the "get" takes priority).
routing {
route("api", {
// add api-documentation here...
}) {
get {
// handle request...
}
get("hello", {
// add api-documentation here (has priority over documentation in "route")...
}) {
// handle request...
}
}
}
- Getting Started
- Configuration
- Documenting Routes
- Multiple Api-Specs
- Examples
- Changelog
Documentation for previous versions: