@ai-sdk/google 2.0.49 → 2.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "2.0.49" : "0.0.0-test";
10
+ var VERSION = true ? "2.0.50" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -210,10 +210,16 @@ import {
210
210
  import { z as z5 } from "zod/v4";
211
211
 
212
212
  // src/convert-json-schema-to-openapi-schema.ts
213
- function convertJSONSchemaToOpenAPISchema(jsonSchema) {
214
- if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {
213
+ function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
214
+ if (jsonSchema == null) {
215
215
  return void 0;
216
216
  }
217
+ if (isEmptyObjectSchema(jsonSchema)) {
218
+ if (isRoot) {
219
+ return void 0;
220
+ }
221
+ return { type: "object" };
222
+ }
217
223
  if (typeof jsonSchema === "boolean") {
218
224
  return { type: "boolean", properties: {} };
219
225
  }
@@ -260,17 +266,19 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
260
266
  if (properties != null) {
261
267
  result.properties = Object.entries(properties).reduce(
262
268
  (acc, [key, value]) => {
263
- acc[key] = convertJSONSchemaToOpenAPISchema(value);
269
+ acc[key] = convertJSONSchemaToOpenAPISchema(value, false);
264
270
  return acc;
265
271
  },
266
272
  {}
267
273
  );
268
274
  }
269
275
  if (items) {
270
- result.items = Array.isArray(items) ? items.map(convertJSONSchemaToOpenAPISchema) : convertJSONSchemaToOpenAPISchema(items);
276
+ result.items = Array.isArray(items) ? items.map((item) => convertJSONSchemaToOpenAPISchema(item, false)) : convertJSONSchemaToOpenAPISchema(items, false);
271
277
  }
272
278
  if (allOf) {
273
- result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);
279
+ result.allOf = allOf.map(
280
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
281
+ );
274
282
  }
275
283
  if (anyOf) {
276
284
  if (anyOf.some(
@@ -280,21 +288,30 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
280
288
  (schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
281
289
  );
282
290
  if (nonNullSchemas.length === 1) {
283
- const converted = convertJSONSchemaToOpenAPISchema(nonNullSchemas[0]);
291
+ const converted = convertJSONSchemaToOpenAPISchema(
292
+ nonNullSchemas[0],
293
+ false
294
+ );
284
295
  if (typeof converted === "object") {
285
296
  result.nullable = true;
286
297
  Object.assign(result, converted);
287
298
  }
288
299
  } else {
289
- result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);
300
+ result.anyOf = nonNullSchemas.map(
301
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
302
+ );
290
303
  result.nullable = true;
291
304
  }
292
305
  } else {
293
- result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);
306
+ result.anyOf = anyOf.map(
307
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
308
+ );
294
309
  }
295
310
  }
296
311
  if (oneOf) {
297
- result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);
312
+ result.oneOf = oneOf.map(
313
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
314
+ );
298
315
  }
299
316
  if (minLength !== void 0) {
300
317
  result.minLength = minLength;