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

      @CanIgnoreReturnValue 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

      @CanIgnoreReturnValue 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.

    • clearAnyOf

      @CanIgnoreReturnValue public Schema.Builder clearAnyOf()
      Clears the value of anyOf field.
    • default_

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

      default_: Optional. Default value of the data.

    • clearDefault_

      @CanIgnoreReturnValue public Schema.Builder clearDefault_()
      Clears the value of default_ field.
    • description

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

      description: Optional. The description of the data.

    • clearDescription

      @CanIgnoreReturnValue public Schema.Builder clearDescription()
      Clears the value of description field.
    • 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_

      @CanIgnoreReturnValue 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"]}

    • clearEnum_

      @CanIgnoreReturnValue public Schema.Builder clearEnum_()
      Clears the value of enum_ field.
    • 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.

    • clearExample

      @CanIgnoreReturnValue public Schema.Builder clearExample()
      Clears the value of example field.
    • 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

    • clearFormat

      @CanIgnoreReturnValue public Schema.Builder clearFormat()
      Clears the value of format field.
    • 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

      @CanIgnoreReturnValue 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.

    • clearItems

      @CanIgnoreReturnValue public Schema.Builder clearItems()
      Clears the value of items field.
    • maxItems

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

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

    • clearMaxItems

      @CanIgnoreReturnValue public Schema.Builder clearMaxItems()
      Clears the value of maxItems field.
    • maxLength

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

      maxLength: Optional. Maximum length of the Type.STRING

    • clearMaxLength

      @CanIgnoreReturnValue public Schema.Builder clearMaxLength()
      Clears the value of maxLength field.
    • maxProperties

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

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

    • clearMaxProperties

      @CanIgnoreReturnValue public Schema.Builder clearMaxProperties()
      Clears the value of maxProperties field.
    • maximum

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

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

    • clearMaximum

      @CanIgnoreReturnValue public Schema.Builder clearMaximum()
      Clears the value of maximum field.
    • minItems

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

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

    • clearMinItems

      @CanIgnoreReturnValue public Schema.Builder clearMinItems()
      Clears the value of minItems field.
    • minLength

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

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

    • clearMinLength

      @CanIgnoreReturnValue public Schema.Builder clearMinLength()
      Clears the value of minLength field.
    • minProperties

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

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

    • clearMinProperties

      @CanIgnoreReturnValue public Schema.Builder clearMinProperties()
      Clears the value of minProperties field.
    • 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

    • clearMinimum

      @CanIgnoreReturnValue public Schema.Builder clearMinimum()
      Clears the value of minimum field.
    • nullable

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

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

    • clearNullable

      @CanIgnoreReturnValue public Schema.Builder clearNullable()
      Clears the value of nullable field.
    • 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.

    • clearPattern

      @CanIgnoreReturnValue public Schema.Builder clearPattern()
      Clears the value of pattern field.
    • properties

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

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

    • clearProperties

      @CanIgnoreReturnValue public Schema.Builder clearProperties()
      Clears the value of properties field.
    • 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

      @CanIgnoreReturnValue 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.

    • clearPropertyOrdering

      @CanIgnoreReturnValue public Schema.Builder clearPropertyOrdering()
      Clears the value of propertyOrdering field.
    • required

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

      required: Optional. Required properties of Type.OBJECT.

    • required

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

      required: Optional. Required properties of Type.OBJECT.

    • clearRequired

      @CanIgnoreReturnValue public Schema.Builder clearRequired()
      Clears the value of required field.
    • title

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

      title: Optional. The title of the Schema.

    • clearTitle

      @CanIgnoreReturnValue public Schema.Builder clearTitle()
      Clears the value of title field.
    • type

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

      type: Optional. The type of the data.

    • clearType

      @CanIgnoreReturnValue public Schema.Builder clearType()
      Clears the value of type field.
    • 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()