Class Schema.Builder

java.lang.Object
com.google.genai.types.Schema.Builder
Enclosing class:
Schema

public abstract static class Schema.Builder extends Object
Builder for Schema.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • anyOf

      public abstract Schema.Builder anyOf(List<Schema> anyOf)
      Setter for anyOf.

      anyOf: Optional. The value should be validated against any (one or more) of the subschemas in the list.

    • anyOf

      public Schema.Builder anyOf(Schema... anyOf)
      Setter for anyOf.

      anyOf: Optional. The value should be validated against any (one or more) of the subschemas in the list.

    • anyOf

      public Schema.Builder anyOf(Schema.Builder... anyOfBuilders)
      Setter for anyOf builder.

      anyOf: Optional. The value should be validated against any (one or more) of the subschemas in the list.

    • default_

      public abstract Schema.Builder default_(Object default_)
      Setter for default_.

      default_: Optional. Default value of the data.

    • description

      public abstract Schema.Builder description(String description)
      Setter for description.

      description: Optional. The description of the data.

    • enum_

      public abstract Schema.Builder enum_(List<String> enum_)
      Setter for enum_.

      enum_: Optional. Possible values of the element of primitive type with enum format. Examples: 1. We can define direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} 2. We can define apartment number as : {type:INTEGER, format:enum, enum:["101", "201", "301"]}

    • enum_

      public Schema.Builder enum_(String... enum_)
      Setter for enum_.

      enum_: Optional. Possible values of the element of primitive type with enum format. Examples: 1. We can define direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} 2. We can define apartment number as : {type:INTEGER, format:enum, enum:["101", "201", "301"]}

    • example

      public abstract Schema.Builder example(Object example)
      Setter for example.

      example: Optional. Example of the object. Will only populated when the object is the root.

    • format

      public abstract Schema.Builder format(String format)
      Setter for format.

      format: Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc

    • items

      public abstract Schema.Builder items(Schema items)
      Setter for items.

      items: Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY.

    • items

      public Schema.Builder items(Schema.Builder itemsBuilder)
      Setter for items builder.

      items: Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY.

    • maxItems

      public abstract Schema.Builder maxItems(Long maxItems)
      Setter for maxItems.

      maxItems: Optional. Maximum number of the elements for Type.ARRAY.

    • maxLength

      public abstract Schema.Builder maxLength(Long maxLength)
      Setter for maxLength.

      maxLength: Optional. Maximum length of the Type.STRING

    • maxProperties

      public abstract Schema.Builder maxProperties(Long maxProperties)
      Setter for maxProperties.

      maxProperties: Optional. Maximum number of the properties for Type.OBJECT.

    • maximum

      public abstract Schema.Builder maximum(Double maximum)
      Setter for maximum.

      maximum: Optional. Maximum value of the Type.INTEGER and Type.NUMBER

    • minItems

      public abstract Schema.Builder minItems(Long minItems)
      Setter for minItems.

      minItems: Optional. Minimum number of the elements for Type.ARRAY.

    • minLength

      public abstract Schema.Builder minLength(Long minLength)
      Setter for minLength.

      minLength: Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING

    • minProperties

      public abstract Schema.Builder minProperties(Long minProperties)
      Setter for minProperties.

      minProperties: Optional. Minimum number of the properties for Type.OBJECT.

    • minimum

      public abstract Schema.Builder minimum(Double minimum)
      Setter for minimum.

      minimum: Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER

    • nullable

      public abstract Schema.Builder nullable(boolean nullable)
      Setter for nullable.

      nullable: Optional. Indicates if the value may be null.

    • pattern

      public abstract Schema.Builder pattern(String pattern)
      Setter for pattern.

      pattern: Optional. Pattern of the Type.STRING to restrict a string to a regular expression.

    • properties

      public abstract Schema.Builder properties(Map<String,Schema> properties)
      Setter for properties.

      properties: Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT.

    • propertyOrdering

      public abstract Schema.Builder propertyOrdering(List<String> propertyOrdering)
      Setter for propertyOrdering.

      propertyOrdering: Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.

    • propertyOrdering

      public Schema.Builder propertyOrdering(String... propertyOrdering)
      Setter for propertyOrdering.

      propertyOrdering: Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.

    • required

      public abstract Schema.Builder required(List<String> required)
      Setter for required.

      required: Optional. Required properties of Type.OBJECT.

    • required

      public Schema.Builder required(String... required)
      Setter for required.

      required: Optional. Required properties of Type.OBJECT.

    • title

      public abstract Schema.Builder title(String title)
      Setter for title.

      title: Optional. The title of the Schema.

    • type

      public abstract Schema.Builder type(Type type)
      Setter for type.

      type: Optional. The type of the data.

    • type

      @CanIgnoreReturnValue public Schema.Builder type(Type.Known knownType)
      Setter for type given a known enum.

      type: Optional. The type of the data.

    • type

      @CanIgnoreReturnValue public Schema.Builder type(String type)
      Setter for type given a string.

      type: Optional. The type of the data.

    • build

      public abstract Schema build()