Class OpenApiSourceBase

java.lang.Object
io.helidon.openapi.OpenApiSourceBase
All Implemented Interfaces:
OpenApiDocumentSource

public abstract class OpenApiSourceBase extends Object implements OpenApiDocumentSource
Base class for generated OpenAPI document sources.
  • Constructor Details

    • OpenApiSourceBase

      protected OpenApiSourceBase()
      Constructor with no side effects.
  • Method Details

    • schemaRef

      protected static JsonObject schemaRef(String name)
      Create a schema reference object.
      Parameters:
      name - schema name
      Returns:
      schema reference JSON object
    • schema

      protected static JsonObject schema(String type)
      Create a simple schema object for a JSON type.
      Parameters:
      type - JSON schema type
      Returns:
      schema JSON object
    • arraySchema

      protected static JsonObject arraySchema(JsonObject items)
      Create an array schema object.
      Parameters:
      items - array item schema
      Returns:
      array schema JSON object
    • exampleValue

      protected static JsonValue exampleValue(String value)
      Create an OpenAPI example value from annotation text.
      Parameters:
      value - annotation value
      Returns:
      parsed JSON value, or a JSON string if the value is not JSON
    • extensionValue

      protected static JsonValue extensionValue(String name, String value, boolean parseValue)
      Create an OpenAPI extension value from resolved annotation text.
      Parameters:
      name - extension name
      value - resolved annotation value
      parseValue - whether to parse the value as JSON
      Returns:
      extension JSON value
      Throws:
      IllegalArgumentException - if parsing is enabled and the value is not exactly one valid JSON value
    • componentSchema

      protected static void componentSchema(OpenApiDocument.Builder document, JsonSchemaProvider provider, String name)
      Add a component schema from a JSON schema provider to the OpenAPI document.
      Parameters:
      document - OpenAPI document builder
      provider - JSON schema provider
      name - schema name