Class Schema

  • All Implemented Interfaces:

    
    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 Detail

      • Schema

        Schema()
    • Method Detail

      • anyOf

         abstract Optional<List<Schema>> anyOf()

        Optional. The instance must be valid against any (one or more) of the subschemas listed in `any_of`.

      • description

         abstract Optional<String> description()

        Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt.

      • enum_

         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"]}`

      • format

         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

         abstract Optional<Schema> items()

        Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array.

      • maxItems

         abstract Optional<Long> maxItems()

        Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array.

      • maxLength

         abstract Optional<Long> maxLength()

        Optional. If type is `STRING`, `max_length` specifies the maximum length of the string.

      • maxProperties

         abstract Optional<Long> maxProperties()

        Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that can be provided.

      • maximum

         abstract Optional<Double> maximum()

        Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value.

      • minItems

         abstract Optional<Long> minItems()

        Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array.

      • minLength

         abstract Optional<Long> minLength()

        Optional. If type is `STRING`, `min_length` specifies the minimum length of the string.

      • minProperties

         abstract Optional<Long> minProperties()

        Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that can be provided.

      • minimum

         abstract Optional<Double> minimum()

        Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value.

      • pattern

         abstract Optional<String> pattern()

        Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must match.

      • properties

         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

         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

         abstract Optional<List<String>> required()

        Optional. If type is `OBJECT`, `required` lists the names of properties that must be present.

      • fromJson

         static Schema fromJson(String jsonString)

        Deserializes a JSON string to a Schema object.