OpenAPI and springdoc
A service's routes come from its Manifest, and so does their OpenAPI document: every command, state read, query and dataset route, with the request and response schemas of the Manifest's types. This page shows where to get the document and how it joins springdoc's.
Get the document
| Where | When |
|---|---|
GET /wow/openapi | At run time, from the service's merged Manifest (wow.http.openapi.enabled, on by default) |
build/wow/openapi.json | At build time, from the Gradle plugin's generateWowOpenApi, for tools that need it before the service runs |
The document is OpenAPI 3.1, with JSON Schema 2020-12 schemas. It declares no jsonSchemaDialect: OpenAPI 3.1's default dialect is JSON Schema 2020-12 with OpenAPI's own keywords added, so the schemas read the same under it, and Swagger UI takes no other dialect. It describes the public port only: the internal port's calls, cluster channel and signals are never in it, and neither are the internal commands (@InternalCommand), which the public port does not serve, nor the schemas only they use (Keep a command internal).
A request is described by what the service reads. A computed property, a getter with no field behind it (val searchCode: String get() = ...), is readOnly in the schema and required, since every value the service writes holds it, but the service reads nothing into it. So each type a request carries (a command's body, a lifecycle command's body, a service route's request or parameter) that holds a computed property, at any depth, has a second component beside it, its input, named <component>Input (me.ahoo.shop.ProductRefInput). The input is the type's schema with each computed property left out of required, its schema and readOnly kept, and every reference to a type that has an input pointing to that input: a request may leave the property out, or hand back a value read from the service, which holds it. Requests refer to the inputs; responses, events and states to the types themselves. A name the Manifest already gives one of its own types is taken first, and the input takes the first free _<n> suffix (me.ahoo.shop.ProductRefInput_2). The TypeScript clients declare an input for the same types (ProductRefInput, numbered ProductRefInput2 on a clash).
With springdoc
When the application has springdoc on its class path, the Wow document joins springdoc's, so /v3/api-docs and Swagger UI list the application's own controllers and the Wow routes together:
- The Wow routes are merged into springdoc's default document. A route both define, by path and method, or a component name both use for different definitions, fails the startup, which renders the document once to check.
- The group
wow.http.openapi.springdoc.group(wow) serves the Wow routes alone, at/v3/api-docs/wow. - Swagger UI lists the default document first, then the groups.
/v3/api-docsand Swagger UI are springdoc's, guarded by the application's security configuration.GET /wow/openapiis unchanged.
wow.http.openapi.springdoc.enabled: false turns the bridge off.
Behind a proxy that serves the service under a path prefix it strips, and sends that prefix as X-Forwarded-Prefix, Spring Boot 4.2 ignores the header unless server.request.header.forwarded.use-prefix: true is set: without it, Swagger UI's URLs lack the prefix. A gateway that routes by the context prefix and keeps it, as Wow's routes expect, needs nothing.
Security schemes
Springdoc's documents (/v3/api-docs, /v3/api-docs/wow) declare how a caller presents its identity, so Swagger UI's "Try it out" sends it; GET /wow/openapi and the build's document declare none. The host fills that from its caller resolver: CoSec's resolver takes a bearer token, and the development callers take the Wow-* identity headers, one scheme each. Their global security is one requirement naming them all: they are the parts of one identity, which a request sends together, not alternatives. An application with a resolver of its own declares its schemes with a WowOpenApiSecurity bean, which replaces the host's.
What the host adds
The document a running service serves (GET /wow/openapi, and springdoc's) also lists what the host adds to the routes, which the Manifest does not say. The build's openapi.json has none of it: no host is configured when the build writes it.
- The request facts: the headers
wow.http.request-factslists, each a header parameter of every command, which copies it into its headers. - The request id headers: the ones an integration reads beside
Wow-Request-Id, a parameter of every command;CoSec-Request-Idwith CoSec on. - What a filter answers before the routes: with CoSec on, its 429
wow.request.rate-limitedand 503wow.auth.unavailable, listed on every operation.
Clients from the document
TypeScript clients are generated from the Manifest rather than from the OpenAPI document, so they keep what OpenAPI cannot say, such as wait plans and query fields; they leave the internal commands out as the document does. The OpenAPI document serves every other language and tool.