docs-devsite/ai.schema.md
Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
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.)
<b>Signature:</b>
export declare abstract class Schema implements SchemaInterface
<b>Implements:</b> SchemaInterface
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(schemaParams) | Constructs a new instance of the <code>Schema</code> class |
| 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: |
| Method | Modifiers | Description |
|---|---|---|
| anyOf(anyOfParams) | <code>static</code> | |
| array(arrayParams) | <code>static</code> | |
| boolean(booleanParams) | <code>static</code> | |
| enumString(stringParams) | <code>static</code> | |
| integer(integerParams) | <code>static</code> | |
| number(numberParams) | <code>static</code> | |
| object(objectParams) | <code>static</code> | |
| string(stringParams) | <code>static</code> |
Constructs a new instance of the Schema class
<b>Signature:</b>
constructor(schemaParams: SchemaInterface);
| Parameter | Type | Description |
|---|---|---|
| schemaParams | SchemaInterface |
Optional. The description of the property.
<b>Signature:</b>
description?: string;
Optional. The example of the property.
<b>Signature:</b>
example?: unknown;
Optional. The format of the property. Supported formats:
<ul> <li>for NUMBER type: "float", "double"</li> <li>for INTEGER type: "int32", "int64"</li> <li>for STRING type: "email", "byte", etc</li> </ul><b>Signature:</b>
format?: string;
Optional. The items of the property.
<b>Signature:</b>
items?: SchemaInterface;
The maximum number of items (elements) in a schema of SchemaType array<!-- -->.
<b>Signature:</b>
maxItems?: number;
The minimum number of items (elements) in a schema of SchemaType array<!-- -->.
<b>Signature:</b>
minItems?: number;
Optional. Whether the property is nullable. Defaults to false.
<b>Signature:</b>
nullable: boolean;
Optional. The type of the property. This can only be undefined when using anyOf schemas, which do not have an explicit type in the OpenAPI specification<!-- -->.
<b>Signature:</b>
type?: SchemaType;
<b>Signature:</b>
static anyOf(anyOfParams: SchemaParams & {
anyOf: TypedSchema[];
}): AnyOfSchema;
| Parameter | Type | Description |
|---|---|---|
| anyOfParams | SchemaParams & { anyOf: TypedSchema<!-- -->[]; } |
<b>Returns:</b>
<b>Signature:</b>
static array(arrayParams: SchemaParams & {
items: Schema;
}): ArraySchema;
| Parameter | Type | Description |
|---|---|---|
| arrayParams | SchemaParams & { items: Schema<!-- -->; } |
<b>Returns:</b>
<b>Signature:</b>
static boolean(booleanParams?: SchemaParams): BooleanSchema;
| Parameter | Type | Description |
|---|---|---|
| booleanParams | SchemaParams |
<b>Returns:</b>
<b>Signature:</b>
static enumString(stringParams: SchemaParams & {
enum: string[];
}): StringSchema;
| Parameter | Type | Description |
|---|---|---|
| stringParams | SchemaParams & { enum: string[]; } |
<b>Returns:</b>
<b>Signature:</b>
static integer(integerParams?: SchemaParams): IntegerSchema;
| Parameter | Type | Description |
|---|---|---|
| integerParams | SchemaParams |
<b>Returns:</b>
<b>Signature:</b>
static number(numberParams?: SchemaParams): NumberSchema;
| Parameter | Type | Description |
|---|---|---|
| numberParams | SchemaParams |
<b>Returns:</b>
<b>Signature:</b>
static object(objectParams: SchemaParams & {
properties: {
[k: string]: Schema;
};
optionalProperties?: string[];
}): ObjectSchema;
| Parameter | Type | Description |
|---|---|---|
| objectParams | SchemaParams & { properties: { [k: string]: Schema<!-- -->; }; optionalProperties?: string[]; } |
<b>Returns:</b>
<b>Signature:</b>
static string(stringParams?: SchemaParams): StringSchema;
| Parameter | Type | Description |
|---|---|---|
| stringParams | SchemaParams |
<b>Returns:</b>