Class OpenApiResource
- Author:
- Florian Alpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyBearerSecurityScheme(io.swagger.v3.oas.models.OpenAPI openApi) Declares the bearer security scheme on the given spec.static voidapplyTokenSecurityScheme(io.swagger.v3.oas.models.OpenAPI openApi) Declares the token security scheme on the given spec.static io.swagger.v3.oas.models.security.SecuritySchemeReturns the security scheme describing the user bearer token.static io.swagger.v3.oas.models.info.InfogetInfo()Made static so the build-time OpenAPI spec generator can reuse the exact sameInfoobject as the runtime resource, instead of duplicating a slimmed-down copy that could drift out of sync (no instance state is used here).io.swagger.v3.oas.models.OpenAPIstatic List<io.swagger.v3.oas.models.tags.Tag> getTags()Returns the global tag list of the v1 API.static io.swagger.v3.oas.models.security.SecuritySchemeReturns the security scheme describing the API token.
-
Constructor Details
-
OpenApiResource
public OpenApiResource()
-
-
Method Details
-
getOpenApi
-
getTokenSecurityScheme
public static io.swagger.v3.oas.models.security.SecurityScheme getTokenSecurityScheme()Returns the security scheme describing the API token.The token is a static value the operator configures; it is sent in the request header named by
AuthorizationFilter.TOKEN_HEADER. The deprecated query parameter fall-back is deliberately left undocumented: a machine readable spec is an invitation to use what it describes, and a token in the URL leaks into access logs, Referer headers and browser history.- Returns:
- the api key security scheme for the token header
-
applyTokenSecurityScheme
public static void applyTokenSecurityScheme(io.swagger.v3.oas.models.OpenAPI openApi) Declares the token security scheme on the given spec.Adds to the existing
Componentsrather than replacing them: the reader has already filled in the model schemas at this point, andsetComponentswould drop them. Applied afterread()for the same reason — the reader assigns the scheme map wholesale, so a pre-populated configuration could be overwritten.Static so the build-time spec generator applies the identical scheme, instead of a copy that could drift.
- Parameters:
openApi- spec to declare the scheme on
-
getBearerSecurityScheme
public static io.swagger.v3.oas.models.security.SecurityScheme getBearerSecurityScheme()Returns the security scheme describing the user bearer token.Issued by
POST /auth/login, which returns the plaintext token in its response body. The endpoints requiring it also accept a logged-in browser session; that alternative is deliberately left undescribed, because a client cannot obtain a session through the API and no tooling can supply one.- Returns:
- the http bearer security scheme
-
applyBearerSecurityScheme
public static void applyBearerSecurityScheme(io.swagger.v3.oas.models.OpenAPI openApi) Declares the bearer security scheme on the given spec.Adds to the existing
Componentsfor the same reason asapplyTokenSecurityScheme(OpenAPI).- Parameters:
openApi- spec to declare the scheme on
-
getInfo
public static io.swagger.v3.oas.models.info.Info getInfo()Made static so the build-time OpenAPI spec generator can reuse the exact sameInfoobject as the runtime resource, instead of duplicating a slimmed-down copy that could drift out of sync (no instance state is used here).- Returns:
Info
-
getTags
Returns the global tag list of the v1 API.Operations reference these tags by name only. Declaring them here is what gives each group in the API documentation a description, and this list's order is the order in which the groups are presented. A tag used by an operation but missing here still forms a group, just an undescribed one at the end.
Static for the same reason as
getInfo(): the build-time spec generator reuses it, so the validated spec stays identical to what this resource serves.- Returns:
- tags of the v1 API, in presentation order
-