Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(js/core): fix ValidationResponse type and cache ajv validators#5201

Merged
ssbushi merged 2 commits into
genkit-ai:mainfrom
7hokerz:7hokerz/fix-validate-schema-type
May 6, 2026
Merged

fix(js/core): fix ValidationResponse type and cache ajv validators#5201
ssbushi merged 2 commits into
genkit-ai:mainfrom
7hokerz:7hokerz/fix-validate-schema-type

Conversation

@7hokerz

@7hokerz 7hokerz commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Description here... Help the reviewer by:

  • Fixed validateSchema function to return ValidationResponse instead of using the previously unused type.
  • Enabled caching via ajvValidators in the validation process.
  • This changes Improve type safety by repurposing the previously unused ValidationResponse as the fixed return type for validateSchema

Checklist (if applicable):

@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 refactors the schema validation logic in js/core/src/schema.ts, including renaming the AJV validator cache and error mapping functions, and updating the ValidationResponse type for improved clarity. The validateSchema function was updated to better handle caching and return structures. Feedback highlights a potential TypeError when using boolean schemas as WeakMap keys, the need for safer handling of optional error messages in AJV, and the importance of maintaining safety checks when processing validation errors.

Comment thread js/core/src/schema.ts
Comment thread js/core/src/schema.ts
Comment thread js/core/src/schema.ts
@MichaelDoyle MichaelDoyle requested review from ifielker and pavelgj May 6, 2026 15:25
@ssbushi ssbushi merged commit 120d420 into genkit-ai:main May 6, 2026
8 checks passed
@7hokerz 7hokerz deleted the 7hokerz/fix-validate-schema-type branch May 6, 2026 23:31
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