Interface OpenApiVersion
- All Superinterfaces:
NamedService
- All Known Implementing Classes:
OpenApi30Version, OpenApi31Version, OpenApi32Version
OpenAPI version implementation.
-
Method Summary
Modifier and TypeMethodDescriptionparse(OpenApiDocumentContext context, String content, MediaType mediaType) Parse OpenAPI content into the version-neutral document model.render(OpenApiDocumentContext context, OpenApiDocument document) Render an OpenAPI document.type()OpenAPI version family supported by this implementation.version()Exact OpenAPI document version produced by this implementation.Methods inherited from interface NamedService
nameModifier and TypeMethodDescriptionname()Name of this implementation, as provided inConfiguredProvider.create(Config, String).
-
Method Details
-
type
String type()OpenAPI version family supported by this implementation.The value is the major and minor version prefix, such as
3.1. It is used to select an implementation for static documents that declare a more specific version beginning with the family followed by a period, such as3.1.0-rc1.- Specified by:
typein interfaceNamedService- Returns:
- supported OpenAPI version family
-
version
String version()Exact OpenAPI document version produced by this implementation.- Returns:
- OpenAPI document version
-
parse
Parse OpenAPI content into the version-neutral document model.- Parameters:
context- document contextcontent- OpenAPI JSON or YAML contentmediaType- media type guessed from the static document path- Returns:
- parsed document model
-
render
Render an OpenAPI document.All supported OpenAPI versions require an Info Object. OpenAPI 3.0 documents also require a
pathsfield. UseOpenApiDocument.Builder.paths(java.util.Map)withMap.of()to render an intentionally empty Paths Object. OpenAPI 3.1 and 3.2 documents require at least one ofpaths,components, orwebhooks.- Parameters:
context- document contextdocument- version-neutral document model- Returns:
- rendered OpenAPI document content
- Throws:
IllegalStateException- if the document lacks required metadata or does not satisfy the root requirements for the rendered version
-