Skip to content

feat: Compiled JSON Schema type#98

Merged
imor merged 5 commits into
supabase:masterfrom
Stranger6667:dd/compiled-schema
Apr 15, 2026
Merged

feat: Compiled JSON Schema type#98
imor merged 5 commits into
supabase:masterfrom
Stranger6667:dd/compiled-schema

Conversation

@Stranger6667
Copy link
Copy Markdown
Contributor

@Stranger6667 Stranger6667 commented Apr 13, 2026

What kind of change does this PR introduce?

This PR introduces a two-level cache for JSON Schema validators including a few public functions + jsonschema cast

What is the current behavior?

Currently, validators are re-compiled on every call.

What is the new behavior?

Compiled validators are stored in a per-process LRU cache + per callsite cache

Resolves #88

Some time ago I've read https://www.enterprisedb.com/blog/validating-shape-your-json-data which inspired me to make this PR. Also, it seems like in that comparison they use the debug build :(

Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com>
Copy link
Copy Markdown
Contributor

@imor imor left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Stranger6667. Left a few comments.

Comment thread src/lib.rs Outdated
Comment thread src/compiled/mod.rs Outdated
Comment thread src/compiled/callsite.rs Outdated
Comment thread src/compiled/callsite.rs Outdated
Stranger6667 and others added 4 commits April 15, 2026 11:10
Co-authored-by: Raminder Singh <romi_ssk@yahoo.co.in>
Co-authored-by: Raminder Singh <romi_ssk@yahoo.co.in>
Co-authored-by: Raminder Singh <romi_ssk@yahoo.co.in>
Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com>
@Stranger6667 Stranger6667 requested a review from imor April 15, 2026 09:21
@imor imor merged commit a5a6306 into supabase:master Apr 15, 2026
3 checks passed
@Stranger6667 Stranger6667 deleted the dd/compiled-schema branch April 15, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add caching to JSON schema builder

2 participants