Class OpenApiResource
- Author:
- Florian Alpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplySecuritySchemes(io.swagger.v3.oas.models.OpenAPI openApi) Declares the token and the bearer security scheme on the given spec.static io.swagger.v3.oas.models.info.InfogetInfo()io.swagger.v3.oas.models.OpenAPIReturns the resource classes published by the v2 API.static List<io.swagger.v3.oas.models.tags.Tag> getTags()Returns the global tag list of the v2 API.
-
Constructor Details
-
OpenApiResource
public OpenApiResource()
-
-
Method Details
-
getOpenApi
-
getResourceClasses
Returns the resource classes published by the v2 API.Exposed as the single source of truth for the v2 resource set so the build-time
OpenApiSpecGeneratorproduces a spec identical to what this resource serves at runtime, instead of duplicating (and risking drift from) the class list.- Returns:
- set of the nine v2 resource classes
-
applySecuritySchemes
public static void applySecuritySchemes(io.swagger.v3.oas.models.OpenAPI openApi) Declares the token and the bearer security scheme on the given spec.Both schemes are defined once for the v1 API and reused verbatim here, so the two specs cannot end up describing the same header in different words.
They are declared even though no operation of the published resource set references one: the filters enforcing them are registered for v2 requests as well, and an operation whose security requirement names an undeclared scheme renders the whole spec invalid - a trap for the next class added to
getResourceClasses().- Parameters:
openApi- spec to declare the schemes on
-
getInfo
public static io.swagger.v3.oas.models.info.Info getInfo()- Returns:
Info
-
getTags
Returns the global tag list of the v2 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.
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 v2 API, in presentation order
-