Class Schema


public abstract class Schema extends JsonSerializable
Schema is used to define the format of input/output data.

Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may be added in the future as needed.

  • Constructor Details

    • Schema

      public Schema()
  • Method Details

    • anyOf

      public abstract Optional<List<Schema>> anyOf()
      Optional. The instance must be valid against any (one or more) of the subschemas listed in `any_of`.
    • default_

      public abstract Optional<Object> default_()
      Optional. Default value to use if the field is not specified.
    • description

      public abstract Optional<String> description()
      Optional. Description of the schema.
    • enum_

      public abstract Optional<List<String>> enum_()
      Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, format:enum, enum:["EAST", "NORTH", "SOUTH", "WEST"]}` 2. To define apartment numbers: `{type:INTEGER, format:enum, enum:["101", "201", "301"]}`
    • example

      public abstract Optional<Object> example()
      Optional. Example of an instance of this schema.
    • format

      public abstract Optional<String> format()
      Optional. The format of the data. For `NUMBER` type, format can be `float` or `double`. For `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can be `email`, `byte`, `date`, `date-time`, `password`, and other formats to further refine the data type.
    • items

      public abstract Optional<Schema> items()
      Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array.
    • maxItems

      public abstract Optional<Long> maxItems()
      Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array.
    • maxLength

      public abstract Optional<Long> maxLength()
      Optional. If type is `STRING`, `max_length` specifies the maximum length of the string.
    • maxProperties

      public abstract Optional<Long> maxProperties()
      Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that can be provided.
    • maximum

      public abstract Optional<Double> maximum()
      Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value.
    • minItems

      public abstract Optional<Long> minItems()
      Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array.
    • minLength

      public abstract Optional<Long> minLength()
      Optional. If type is `STRING`, `min_length` specifies the minimum length of the string.
    • minProperties

      public abstract Optional<Long> minProperties()
      Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that can be provided.
    • minimum

      public abstract Optional<Double> minimum()
      Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value.
    • nullable

      public abstract Optional<Boolean> nullable()
      Optional. Indicates if the value of this field can be null.
    • pattern

      public abstract Optional<String> pattern()
      Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must match.
    • properties

      public abstract Optional<Map<String,Schema>> properties()
      Optional. If type is `OBJECT`, `properties` is a map of property names to schema definitions for each property of the object.
    • propertyOrdering

      public abstract Optional<List<String>> propertyOrdering()
      Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.
    • required

      public abstract Optional<List<String>> required()
      Optional. If type is `OBJECT`, `required` lists the names of properties that must be present.
    • title

      public abstract Optional<String> title()
      Optional. Title for the schema.
    • type

      public abstract Optional<Type> type()
      Optional. Data type of the schema field.
    • builder

      public static Schema.Builder builder()
      Instantiates a builder for Schema.
    • toBuilder

      public abstract Schema.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static Schema fromJson(String jsonString)
      Deserializes a JSON string to a Schema object.