Interface OpenApiVersion

All Superinterfaces:
NamedService
All Known Implementing Classes:
OpenApi30Version, OpenApi31Version, OpenApi32Version

@Contract public interface OpenApiVersion extends NamedService
OpenAPI version implementation.
  • 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 as 3.1.0-rc1.

      Specified by:
      type in interface NamedService
      Returns:
      supported OpenAPI version family
    • version

      String version()
      Exact OpenAPI document version produced by this implementation.
      Returns:
      OpenAPI document version
    • parse

      OpenApiDocument parse(OpenApiDocumentContext context, String content, MediaType mediaType)
      Parse OpenAPI content into the version-neutral document model.
      Parameters:
      context - document context
      content - OpenAPI JSON or YAML content
      mediaType - media type guessed from the static document path
      Returns:
      parsed document model
    • render

      String render(OpenApiDocumentContext context, OpenApiDocument document)
      Render an OpenAPI document.

      All supported OpenAPI versions require an Info Object. OpenAPI 3.0 documents also require a paths field. Use OpenApiDocument.Builder.paths(java.util.Map) with Map.of() to render an intentionally empty Paths Object. OpenAPI 3.1 and 3.2 documents require at least one of paths, components, or webhooks.

      Parameters:
      context - document context
      document - 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