Skip to content

Commit c5089e2

Browse files
committed
update docs and format
1 parent 2481d44 commit c5089e2

File tree

4 files changed

+57
-2
lines changed

4 files changed

+57
-2
lines changed

docs-devsite/ai.schema.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export declare abstract class Schema implements SchemaInterface
3232
| [description](./ai.schema.md#schemadescription) | | string | Optional. The description of the property. |
3333
| [example](./ai.schema.md#schemaexample) | | unknown | Optional. The example of the property. |
3434
| [format](./ai.schema.md#schemaformat) | | string | Optional. The format of the property. Supported formats:<br/> <ul> <li>for NUMBER type: "float", "double"</li> <li>for INTEGER type: "int32", "int64"</li> <li>for STRING type: "email", "byte", etc</li> </ul> |
35+
| [items](./ai.schema.md#schemaitems) | | [SchemaInterface](./ai.schemainterface.md#schemainterface_interface) | Optional. The items of the property. |
36+
| [maxItems](./ai.schema.md#schemamaxitems) | | number | The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
37+
| [minItems](./ai.schema.md#schemaminitems) | | number | The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
3538
| [nullable](./ai.schema.md#schemanullable) | | boolean | Optional. Whether the property is nullable. Defaults to false. |
3639
| [type](./ai.schema.md#schematype) | | [SchemaType](./ai.md#schematype) | Optional. The type of the property. [SchemaType](./ai.md#schematype)<!-- -->. |
3740
@@ -93,6 +96,36 @@ Optional. The format of the property. Supported formats:<br/> <ul> <li>for NUMBE
9396
format?: string;
9497
```
9598
99+
## Schema.items
100+
101+
Optional. The items of the property.
102+
103+
<b>Signature:</b>
104+
105+
```typescript
106+
items?: SchemaInterface;
107+
```
108+
109+
## Schema.maxItems
110+
111+
The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
112+
113+
<b>Signature:</b>
114+
115+
```typescript
116+
maxItems?: number;
117+
```
118+
119+
## Schema.minItems
120+
121+
The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
122+
123+
<b>Signature:</b>
124+
125+
```typescript
126+
minItems?: number;
127+
```
128+
96129
## Schema.nullable
97130
98131
Optional. Whether the property is nullable. Defaults to false.

docs-devsite/ai.schemashared.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export interface SchemaShared<T>
2727
| [example](./ai.schemashared.md#schemasharedexample) | unknown | Optional. The example of the property. |
2828
| [format](./ai.schemashared.md#schemasharedformat) | string | Optional. The format of the property. When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this must be either <code>'enum'</code> or <code>'date-time'</code>, otherwise requests will fail. |
2929
| [items](./ai.schemashared.md#schemashareditems) | T | Optional. The items of the property. |
30+
| [maxItems](./ai.schemashared.md#schemasharedmaxitems) | number | The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
31+
| [minItems](./ai.schemashared.md#schemasharedminitems) | number | The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
3032
| [nullable](./ai.schemashared.md#schemasharednullable) | boolean | Optional. Whether the property is nullable. |
3133
| [properties](./ai.schemashared.md#schemasharedproperties) | { \[k: string\]: T; } | Optional. Map of <code>Schema</code> objects. |
3234

@@ -80,6 +82,26 @@ Optional. The items of the property.
8082
items?: T;
8183
```
8284

85+
## SchemaShared.maxItems
86+
87+
The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
88+
89+
<b>Signature:</b>
90+
91+
```typescript
92+
maxItems?: number;
93+
```
94+
95+
## SchemaShared.minItems
96+
97+
The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
98+
99+
<b>Signature:</b>
100+
101+
```typescript
102+
minItems?: number;
103+
```
104+
83105
## SchemaShared.nullable
84106

85107
Optional. Whether the property is nullable.

packages/ai/src/requests/schema-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export abstract class Schema implements SchemaInterface {
8383
* @internal
8484
*/
8585
toJSON(): SchemaRequest {
86-
const obj: { type: SchemaType;[key: string]: unknown } = {
86+
const obj: { type: SchemaType; [key: string]: unknown } = {
8787
type: this.type
8888
};
8989
for (const prop in this) {

packages/ai/src/types/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export interface SchemaShared<T> {
7373
* {@link Schema} classes.
7474
* @public
7575
*/
76-
export interface SchemaParams extends SchemaShared<SchemaInterface> { }
76+
export interface SchemaParams extends SchemaShared<SchemaInterface> {}
7777

7878
/**
7979
* Final format for {@link Schema} params passed to backend requests.

0 commit comments

Comments
 (0)