@ai-sdk/google 3.0.137 → 3.0.138

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "3.0.137",
3
+ "version": "3.0.138",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -109,8 +109,18 @@ function convertJSONSchemaDefinition(
109
109
  if (nonNullTypes.length === 0) {
110
110
  // Only null type
111
111
  result.type = 'null';
112
+ } else if (nonNullTypes.length === 1) {
113
+ // A single type stays a plain node so sibling keywords (items,
114
+ // format, ...) remain valid: Gemini rejects fields beside anyOf and
115
+ // items on a non-array node.
116
+ result.type = nonNullTypes[0];
117
+ if (hasNull) {
118
+ result.nullable = true;
119
+ }
112
120
  } else {
113
- // One or more non-null types: always use anyOf
121
+ // Multiple non-null types: use anyOf. Type-specific keywords
122
+ // (items, format, ...) still land beside it, which Gemini rejects;
123
+ // splitting them per branch is not handled yet.
114
124
  result.anyOf = nonNullTypes.map(t => ({ type: t }));
115
125
  if (hasNull) {
116
126
  result.nullable = true;