Class OpenApiDocumentMapperSupport

java.lang.Object
io.helidon.openapi.v30.OpenApiDocumentMapperSupport

public final class OpenApiDocumentMapperSupport extends Object
Shared support for OpenAPI version document mappers.
  • Method Details

    • parseYaml

      public static Object parseYaml(String source)
      Parse YAML using JSON-compatible YAML 1.2 scalar resolution.
      Parameters:
      source - YAML source
      Returns:
      parsed value
    • validateQueryStringParameters

      public static void validateQueryStringParameters(Map<String,Object> document, OpenApi3xMapperRules rules)
      Validate querystring parameters in a projected OpenAPI 3.x document.
      Parameters:
      document - projected document
      rules - target version rules
    • validateMediaTypes

      public static void validateMediaTypes(Map<String,Object> document, OpenApi3xMapperRules rules)
      Validate media types in a projected OpenAPI 3.x document.
      Parameters:
      document - projected document
      rules - target version rules
    • validateOperationIds

      public static void validateOperationIds(OpenApiDocument document)
      Validate operation IDs reachable from the API paths and webhooks.
      Parameters:
      document - document to validate
    • validateOperationIds

      public static void validateOperationIds(Map<String,?> document)
      Validate operation IDs reachable from the API paths and webhooks.
      Parameters:
      document - projected document to validate
    • validateDocumentStructure

      public static void validateDocumentStructure(Map<String,?> document, OpenApi3xMapperRules rules)
      Validate the structure of an OpenAPI 3.x document.

      Unknown fields are ignored. Recognized fields must use the type required by the target version rules.

      Parameters:
      document - document to validate
      rules - target version rules
    • validateSecurityRequirementNames

      public static void validateSecurityRequirementNames(Map<String,?> document, OpenApi3xMapperRules rules)
      Validate Security Requirement Object names in an OpenAPI 3.x document.
      Parameters:
      document - document to validate
      rules - target version rules
    • validateDocumentRoot

      public static void validateDocumentRoot(OpenApiDocument document, String targetVersion)
      Validate required root fields at an OpenAPI version boundary.
      Parameters:
      document - document to validate
      targetVersion - target OpenAPI version
    • validateSchemas

      public static void validateSchemas(Map<String,?> document, OpenApi3xMapperRules rules)
      Validate schemas in an OpenAPI 3.x document.
      Parameters:
      document - document to validate
      rules - target version rules
    • jsonObject

      public static JsonObject jsonObject(Map<String,Object> source)
      Convert key-to-value data into a JSON object.
      Parameters:
      source - source values
      Returns:
      JSON object
    • jsonValue

      public static JsonValue jsonValue(Object value)
      Convert a value into a JSON value.
      Parameters:
      value - source value
      Returns:
      JSON value
    • jsonNumber

      public static JsonNumber jsonNumber(Number number)
      Convert a number into a JSON number without reducing precision.
      Parameters:
      number - number
      Returns:
      JSON number
    • copyAllowed

      public static Map<String,Object> copyAllowed(Map<String,?> source, Set<String> allowedFields)
      Copy allowed key-to-value fields.
      Parameters:
      source - source values
      allowedFields - allowed field names
      Returns:
      copied values
    • copyField

      public static void copyField(Map<String,Object> target, String key, Map<String,?> source)
      Copy a source field to a target.
      Parameters:
      target - target values
      key - field key
      source - source values
    • copyFieldValue

      public static Object copyFieldValue(String key, Map<String,?> source)
      Copy a source field value.
      Parameters:
      key - field key
      source - source values
      Returns:
      copied value
    • allowed

      public static boolean allowed(String key, Set<String> allowedFields)
      Check if a field is allowed.
      Parameters:
      key - field name
      allowedFields - allowed field names
      Returns:
      whether the field is allowed
    • copy

      public static Object copy(Object value)
      Deep-copy key-to-value or list values.
      Parameters:
      value - value to copy
      Returns:
      copied value
    • objectMap

      public static Map<String,Object> objectMap(Map<?,?> source)
      Convert arbitrary map keys to strings.
      Parameters:
      source - source values
      Returns:
      string-keyed values
    • objectMap

      public static Map<String,Object> objectMap(JsonObject object)
      Convert a JSON object to key-to-value data.
      Parameters:
      object - JSON object
      Returns:
      key-to-value data
    • object

      public static void object(Object value, Consumer<Map<String,Object>> consumer)
      Run a consumer if the value is key-to-value data.
      Parameters:
      value - value to inspect
      consumer - consumer
    • objectList

      public static List<Object> objectList(Object value, Function<Map<String,Object>, Map<String,Object>> mapper)
      Map a list of key-to-value data values.
      Parameters:
      value - source value
      mapper - item mapper
      Returns:
      mapped list
    • document3x

      public static Map<String,Object> document3x(Map<String,?> source, OpenApi3xMapperRules rules)
      Filter and normalize an OpenAPI 3.x document using version-specific field rules.
      Parameters:
      source - source document
      rules - version-specific rules
      Returns:
      filtered document