Package com.google.genai.types
Class Schema
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.Schema
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionanyOf()
Optional.static Schema.Builder
builder()
Instantiates a builder for Schema.default_()
Optional.Optional.enum_()
Optional.example()
Optional.format()
Optional.static Schema
Deserializes a JSON string to a Schema object.items()
Optional.maximum()
Optional.maxItems()
Optional.Optional.Optional.minimum()
Optional.minItems()
Optional.Optional.Optional.nullable()
Optional.pattern()
Optional.Optional.Optional.required()
Optional.title()
Optional.abstract Schema.Builder
Creates a builder with the same values as this instance.type()
Optional.Methods inherited from class com.google.genai.JsonSerializable
fromJsonString, toJson
-
Constructor Details
-
Schema
public Schema()
-
-
Method Details
-
anyOf
Optional. The value should be validated against any (one or more) of the subschemas in the list. -
default_
Optional. Default value of the data. -
description
Optional. The description of the data. -
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
Optional. Example of the object. Will only populated when the object is the root. -
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
Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY. -
maxItems
Optional. Maximum number of the elements for Type.ARRAY. -
maxLength
Optional. Maximum length of the Type.STRING -
maxProperties
Optional. Maximum number of the properties for Type.OBJECT. -
maximum
Optional. Maximum value of the Type.INTEGER and Type.NUMBER -
minItems
Optional. Minimum number of the elements for Type.ARRAY. -
minLength
Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING -
minProperties
Optional. Minimum number of the properties for Type.OBJECT. -
minimum
Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER -
nullable
Optional. Indicates if the value may be null. -
pattern
Optional. Pattern of the Type.STRING to restrict a string to a regular expression. -
properties
Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT. -
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
Optional. Required properties of Type.OBJECT. -
title
Optional. The title of the Schema. -
type
Optional. The type of the data. -
builder
Instantiates a builder for Schema. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a Schema object.
-