Skip to content

Commit 6b4d577

Browse files
russellwheatleymikehardy
authored andcommitted
schema-builder.ts
1 parent 88da1a9 commit 6b4d577

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { VertexAIError } from '../errors';
19-
import { VertexAIErrorCode } from '../types';
18+
import { AIError } from '../errors';
19+
import { AIErrorCode } from '../types';
2020
import {
2121
SchemaInterface,
2222
SchemaType,
@@ -49,6 +49,12 @@ export abstract class Schema implements SchemaInterface {
4949
format?: string;
5050
/** Optional. The description of the property. */
5151
description?: string;
52+
/** Optional. The items of the property. */
53+
items?: SchemaInterface;
54+
/** The minimum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
55+
minItems?: number;
56+
/** The maximum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
57+
maxItems?: number;
5258
/** Optional. Whether the property is nullable. Defaults to false. */
5359
nullable: boolean;
5460
/** Optional. The example of the property. */
@@ -257,8 +263,8 @@ export class ObjectSchema extends Schema {
257263
if (this.optionalProperties) {
258264
for (const propertyKey of this.optionalProperties) {
259265
if (!this.properties.hasOwnProperty(propertyKey)) {
260-
throw new VertexAIError(
261-
VertexAIErrorCode.INVALID_SCHEMA,
266+
throw new AIError(
267+
AIErrorCode.INVALID_SCHEMA,
262268
`Property "${propertyKey}" specified in "optionalProperties" does not exist.`,
263269
);
264270
}

0 commit comments

Comments
 (0)