File tree Expand file tree Collapse file tree
packages/opencode/src/provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,13 +275,13 @@ export namespace ProviderTransform {
275275
276276 // Convert integer enums to string enums for Google/Gemini
277277 if ( providerID === "google" || modelID . includes ( "gemini" ) ) {
278- const convertIntEnumsToStrings = ( obj : any ) : any => {
278+ const sanitizeGemini = ( obj : any ) : any => {
279279 if ( obj === null || typeof obj !== "object" ) {
280280 return obj
281281 }
282282
283283 if ( Array . isArray ( obj ) ) {
284- return obj . map ( convertIntEnumsToStrings )
284+ return obj . map ( sanitizeGemini )
285285 }
286286
287287 const result : any = { }
@@ -294,15 +294,21 @@ export namespace ProviderTransform {
294294 result . type = "string"
295295 }
296296 } else if ( typeof value === "object" && value !== null ) {
297- result [ key ] = convertIntEnumsToStrings ( value )
297+ result [ key ] = sanitizeGemini ( value )
298298 } else {
299299 result [ key ] = value
300300 }
301301 }
302+
303+ // Filter required array to only include fields that exist in properties
304+ if ( result . type === "object" && result . properties && Array . isArray ( result . required ) ) {
305+ result . required = result . required . filter ( ( field : any ) => field in result . properties )
306+ }
307+
302308 return result
303309 }
304310
305- schema = convertIntEnumsToStrings ( schema )
311+ schema = sanitizeGemini ( schema )
306312 }
307313
308314 return schema
You can’t perform that action at this time.
0 commit comments