Enum Class OpenAPIMediaType

java.lang.Object
java.lang.Enum<OpenAPIMediaType>
io.helidon.openapi.OpenAPIMediaType
All Implemented Interfaces:
Serializable, Comparable<OpenAPIMediaType>, Constable

public enum OpenAPIMediaType extends Enum<OpenAPIMediaType>
Abstraction of the different representations of a static OpenAPI document file and the file type(s) they correspond to.

Each OpenAPIMediaType stands for a single format (e.g., yaml, json). That said, each can map to multiple file types (e.g., yml and yaml) and multiple actual media types (the proposed OpenAPI media type vnd.oai.openapi and various other YAML types proposed or in use).

  • Enum Constant Details

  • Field Details

    • DEFAULT_TYPE

      public static final OpenAPIMediaType DEFAULT_TYPE
      Default media type (YAML).
  • Method Details

    • values

      public static OpenAPIMediaType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static OpenAPIMediaType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • format

      public io.smallrye.openapi.runtime.io.Format format()
      Format associated with this media type.
      Returns:
      format
    • matchingTypes

      public List<String> matchingTypes()
      File types matching this media type.
      Returns:
      file types
    • byFileType

      public static Optional<OpenAPIMediaType> byFileType(String fileType)
      Find media type by file suffix.
      Parameters:
      fileType - file suffix
      Returns:
      media type or empty if not supported
    • byMediaType

      public static Optional<OpenAPIMediaType> byMediaType(io.helidon.common.media.type.MediaType mt)
      Find OpenAPI media type by media type.
      Parameters:
      mt - media type
      Returns:
      OpenAPI media type or empty if not supported
    • recognizedFileTypes

      public static List<String> recognizedFileTypes()
      List of all supported file types.
      Returns:
      file types
    • preferredOrdering

      public static io.helidon.common.media.type.MediaType[] preferredOrdering()
      Media types we recognize as OpenAPI, in order of preference.
      Returns:
      MediaTypes in order that we recognize them as OpenAPI content.