Send feedback
Schema class
Stay organized with collections
Save and categorize content based on your preferences.
Parent class encompassing all Schema types, with static methods that allow building specific Schema types. This class can be converted with JSON.stringify()
into a JSON string accepted by Vertex AI REST endpoints. (This string conversion is automatically done when calling SDK methods.)
Signature:
export declare abstract class Schema implements SchemaInterface
Implements: SchemaInterface
Constructors
Properties
Property
Modifiers
Type
Description
description
string
Optional. The description of the property.
example
unknown
Optional. The example of the property.
format
string
Optional. The format of the property. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc
nullable
boolean
Optional. Whether the property is nullable. Defaults to false.
type
SchemaType
Optional. The type of the property. SchemaType .
Methods
Schema.(constructor)
Constructs a new instance of the Schema
class
Signature:
constructor ( schemaParams : SchemaInterface );
Parameters
Schema.description
Optional. The description of the property.
Signature:
description? : string ;
Schema.example
Optional. The example of the property.
Signature:
example? : unknown ;
Optional. The format of the property. Supported formats:
for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc
Signature:
format? : string ;
Schema.nullable
Optional. Whether the property is nullable. Defaults to false.
Signature:
nullable : boolean ;
Schema.type
Optional. The type of the property. SchemaType .
Signature:
type : SchemaType ;
Schema.array()
Signature:
static array ( arrayParams : SchemaParams & {
items : Schema ;
}) : ArraySchema ;
Parameters
Returns:
ArraySchema
Schema.boolean()
Signature:
static boolean ( booleanParams? : SchemaParams ) : BooleanSchema ;
Parameters
Returns:
BooleanSchema
Schema.enumString()
Signature:
static enumString ( stringParams : SchemaParams & {
enum : string [];
}) : StringSchema ;
Parameters
Parameter
Type
Description
stringParams
SchemaParams & { enum: string[]; }
Returns:
StringSchema
Schema.integer()
Signature:
static integer ( integerParams? : SchemaParams ) : IntegerSchema ;
Parameters
Returns:
IntegerSchema
Schema.number()
Signature:
static number ( numberParams? : SchemaParams ) : NumberSchema ;
Parameters
Returns:
NumberSchema
Schema.object()
Signature:
static object ( objectParams : SchemaParams & {
properties : {
[ k : string ] : Schema ;
};
optionalProperties? : string [];
}) : ObjectSchema ;
Parameters
Parameter
Type
Description
objectParams
SchemaParams & { properties: { [k: string]: Schema ; }; optionalProperties?: string[]; }
Returns:
ObjectSchema
Schema.string()
Signature:
static string ( stringParams? : SchemaParams ) : StringSchema ;
Parameters
Returns:
StringSchema
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-22 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-22 UTC."],[],[],null,["# Schema class\n\nParent class encompassing all Schema types, with static methods that allow building specific Schema types. This class can be converted with `JSON.stringify()` into a JSON string accepted by Vertex AI REST endpoints. (This string conversion is automatically done when calling SDK methods.)\n\n**Signature:** \n\n export declare abstract class Schema implements SchemaInterface \n\n**Implements:** [SchemaInterface](./vertexai.schemainterface.md#schemainterface_interface)\n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|-----------------------------------------------------------------------|-----------|-------------------------------------------------|\n| [(constructor)(schemaParams)](./vertexai.schema.md#schemaconstructor) | | Constructs a new instance of the `Schema` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-------------------------------------------------------|-----------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [description](./vertexai.schema.md#schemadescription) | | string | Optional. The description of the property. |\n| [example](./vertexai.schema.md#schemaexample) | | unknown | Optional. The example of the property. |\n| [format](./vertexai.schema.md#schemaformat) | | string | Optional. The format of the property. Supported formats: - for NUMBER type: \"float\", \"double\" - for INTEGER type: \"int32\", \"int64\" - for STRING type: \"email\", \"byte\", etc |\n| [nullable](./vertexai.schema.md#schemanullable) | | boolean | Optional. Whether the property is nullable. Defaults to false. |\n| [type](./vertexai.schema.md#schematype) | | [SchemaType](./vertexai.md#schematype) | Optional. The type of the property. [SchemaType](./vertexai.md#schematype). |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|-------------------------------------------------------------------|-----------|-------------|\n| [array(arrayParams)](./vertexai.schema.md#schemaarray) | `static` | |\n| [boolean(booleanParams)](./vertexai.schema.md#schemaboolean) | `static` | |\n| [enumString(stringParams)](./vertexai.schema.md#schemaenumstring) | `static` | |\n| [integer(integerParams)](./vertexai.schema.md#schemainteger) | `static` | |\n| [number(numberParams)](./vertexai.schema.md#schemanumber) | `static` | |\n| [object(objectParams)](./vertexai.schema.md#schemaobject) | `static` | |\n| [string(stringParams)](./vertexai.schema.md#schemastring) | `static` | |\n\nSchema.(constructor)\n--------------------\n\nConstructs a new instance of the `Schema` class\n\n**Signature:** \n\n constructor(schemaParams: SchemaInterface);\n\n#### Parameters\n\n| Parameter | Type | Description |\n|--------------|----------------------------------------------------------------------------|-------------|\n| schemaParams | [SchemaInterface](./vertexai.schemainterface.md#schemainterface_interface) | |\n\nSchema.description\n------------------\n\nOptional. The description of the property.\n\n**Signature:** \n\n description?: string;\n\nSchema.example\n--------------\n\nOptional. The example of the property.\n\n**Signature:** \n\n example?: unknown;\n\nSchema.format\n-------------\n\nOptional. The format of the property. Supported formats: \n\n- for NUMBER type: \"float\", \"double\"\n- for INTEGER type: \"int32\", \"int64\"\n- for STRING type: \"email\", \"byte\", etc\n\n\u003cbr /\u003e\n\n**Signature:** \n\n format?: string;\n\nSchema.nullable\n---------------\n\nOptional. Whether the property is nullable. Defaults to false.\n\n**Signature:** \n\n nullable: boolean;\n\nSchema.type\n-----------\n\nOptional. The type of the property. [SchemaType](./vertexai.md#schematype).\n\n**Signature:** \n\n type: SchemaType;\n\nSchema.array()\n--------------\n\n**Signature:** \n\n static array(arrayParams: SchemaParams & {\n items: Schema;\n }): ArraySchema;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-------------|------------------------------------------------------------------------------------------------------------------------------|-------------|\n| arrayParams | [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) \\& { items: [Schema](./vertexai.schema.md#schema_class); } | |\n\n**Returns:**\n\n[ArraySchema](./vertexai.arrayschema.md#arrayschema_class)\n\nSchema.boolean()\n----------------\n\n**Signature:** \n\n static boolean(booleanParams?: SchemaParams): BooleanSchema;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|---------------|-------------------------------------------------------------------|-------------|\n| booleanParams | [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) | |\n\n**Returns:**\n\n[BooleanSchema](./vertexai.booleanschema.md#booleanschema_class)\n\nSchema.enumString()\n-------------------\n\n**Signature:** \n\n static enumString(stringParams: SchemaParams & {\n enum: string[];\n }): StringSchema;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|--------------|--------------------------------------------------------------------------------------------|-------------|\n| stringParams | [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) \\& { enum: string\\[\\]; } | |\n\n**Returns:**\n\n[StringSchema](./vertexai.stringschema.md#stringschema_class)\n\nSchema.integer()\n----------------\n\n**Signature:** \n\n static integer(integerParams?: SchemaParams): IntegerSchema;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|---------------|-------------------------------------------------------------------|-------------|\n| integerParams | [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) | |\n\n**Returns:**\n\n[IntegerSchema](./vertexai.integerschema.md#integerschema_class)\n\nSchema.number()\n---------------\n\n**Signature:** \n\n static number(numberParams?: SchemaParams): NumberSchema;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|--------------|-------------------------------------------------------------------|-------------|\n| numberParams | [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) | |\n\n**Returns:**\n\n[NumberSchema](./vertexai.numberschema.md#numberschema_class)\n\nSchema.object()\n---------------\n\n**Signature:** \n\n static object(objectParams: SchemaParams & {\n properties: {\n [k: string]: Schema;\n };\n optionalProperties?: string[];\n }): ObjectSchema;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|\n| objectParams | [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) \\& { properties: { \\[k: string\\]: [Schema](./vertexai.schema.md#schema_class); }; optionalProperties?: string\\[\\]; } | |\n\n**Returns:**\n\n[ObjectSchema](./vertexai.objectschema.md#objectschema_class)\n\nSchema.string()\n---------------\n\n**Signature:** \n\n static string(stringParams?: SchemaParams): StringSchema;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|--------------|-------------------------------------------------------------------|-------------|\n| stringParams | [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) | |\n\n**Returns:**\n\n[StringSchema](./vertexai.stringschema.md#stringschema_class)"]]