Skip to content

fix(go): implement recursive schema reference resolution#5667

Open
MichaelDoyle wants to merge 1 commit into
mainfrom
md/go-schema-refs
Open

fix(go): implement recursive schema reference resolution#5667
MichaelDoyle wants to merge 1 commit into
mainfrom
md/go-schema-refs

Conversation

@MichaelDoyle

Copy link
Copy Markdown
Contributor

This change fixes "Reference must be canonical" validation errors when running actions through the JSON path (e.g., via the Dev UI).

The Go framework now:

  1. Recursively resolves 'genkit:' schema references within nested objects and arrays in ResolveSchema.
  2. Ensures schema resolution is performed in runJSONWithTelemetry before input validation.

This ensures that strict JSON schema validators see fully-resolved definitions rather than internal Genkit reference strings.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates schema resolution in go/core/core.go to recursively resolve nested maps and arrays, and integrates this resolved schema in runJSONWithTelemetry within go/core/action.go. Feedback highlights that the test suite is missing coverage for a missing schema (which was removed) and circular references (which could cause a stack overflow). A code suggestion is provided to restore and add these tests.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread go/core/core_test.go
@MichaelDoyle MichaelDoyle changed the base branch from md/go-telemetry-labels to main July 1, 2026 15:17
@MichaelDoyle MichaelDoyle force-pushed the md/go-schema-refs branch 2 times, most recently from 4cb92c7 to b37163c Compare July 1, 2026 15:35
Comment thread go/core/core.go Outdated
@apascal07

Copy link
Copy Markdown
Collaborator

@cabljac this is somewhat related to your work supporting the new JSON schema field in the Gemini plugin (and conversely allowing recursion/references in schema generation) I think, can we validate both pieces of work and make sure they work well together?

Comment thread go/core/core.go
@MichaelDoyle

Copy link
Copy Markdown
Contributor Author

@cabljac this is somewhat related to your work supporting the new JSON schema field in the Gemini plugin (and conversely allowing recursion/references in schema generation) I think, can we validate both pieces of work and make sure they work well together?

lemme know @cabljac @apascal07 -- I am also happy to back off from the slop cannon on this one. Right now, prompts with input schemas don't work on the dev-ui from what I can tell, so that's what I am aiming to fix.

@MichaelDoyle MichaelDoyle force-pushed the md/go-schema-refs branch 3 times, most recently from 1e8945a to cf5b17c Compare July 1, 2026 17:24
This change fixes "Reference must be canonical" validation errors when
running actions through the JSON path (e.g., via the Dev UI).

The Go framework now:
1. Recursively resolves 'genkit:' schema references within nested
   objects and arrays in ResolveSchema.
2. Ensures schema resolution is performed in runJSONWithTelemetry
   before input validation.

This ensures that strict JSON schema validators see fully-resolved
definitions rather than internal Genkit reference strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants