Skip to content

Reuse property patterns during object validation - #96

Merged
quinnj merged 2 commits into
masterfrom
maintenance/jsonschema-additional-patterns
Oct 4, 2026
Merged

quinnj merged 2 commits into
masterfrom
maintenance/jsonschema-additional-patterns

Conversation

@quinnj

@quinnj quinnj commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Objects validated with patternProperties and restrictive additionalProperties compiled the same regular expressions for each field and created match objects just to check coverage. Reuse compiled patterns during each validation call and use Boolean matching for both coverage checks and pattern-property validation.

Compilation starts only when a field is not covered by properties. The cache lasts for one call, so later schema changes do not require cache invalidation. Literal properties, overlapping and unanchored patterns, Unicode keys, nested schemas, and error locations keep their existing behavior.

Validation:

  • Full package suites: 5,688 assertions pass on Julia 1.9.4 and 1.13.1, with bounds checks.
  • 46 focused public/allocation assertions pass on both versions. The prior tree passes 44 and fails both allocation limits.
  • JuliaFormatter 2.14.0 and git diff --check pass. An independent private review covered the complete change and its callers.
  • Local benchmark: one thread, 10,000 fields, five patterns, additionalProperties=false, seven warmed median samples. This measures wide objects with a small pattern set; it is not a universal speed claim.
Julia Before After Allocations before Allocations after
1.9.4 47.02 ms 4.56 ms 5,121,312 B 321,600 B
1.13.1 55.37 ms 5.12 ms 4,160,400 B 320,688 B

Empty objects retain the same measured allocations. Objects covered by literal properties and patterns also avoid unnecessary match allocations. All seven hosted checks pass at d4516f6f5cc87e0f50bff11bbddf8223298e0a94. Each of the six native jobs passed its suite and accepted a coverage upload for the correct repository and commit; all six reports finished processing, with aggregate coverage at 96.46%. The ordinary squash merge is 38a74fd1026bdc1e7f7936a5b3b3d5ca74d20133, whose tree equals the tested head. Both main workflows and all seven jobs pass; all six main uploads were also accepted and processed at 96.46%.

Co-authored by Codex

AI disclosure: This work was prepared with assistance from OpenAI Codex.

quinnj added 2 commits October 4, 2026 11:55
Compile pattern coverage once per validation call after the first field without a literal property, and check coverage without materializing match objects. Preserve public matching and error-path behavior and bound allocations on wide objects.

AI disclosure: This work was prepared with assistance from OpenAI Codex.
Use the Boolean regex predicate in the remaining pattern-property existence check; nested validation does not use captures. All public and full-package tests pass on the minimum and current Julia versions.

AI disclosure: This work was prepared with assistance from OpenAI Codex.
@quinnj
quinnj merged commit 38a74fd into master Oct 4, 2026
7 checks passed
@quinnj

quinnj commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

Merged as 38a74fd1026bdc1e7f7936a5b3b3d5ca74d20133 after all seven head checks passed. The merged tree equals the reviewed and locally tested head. Both main workflows now pass all seven jobs, and all six main coverage uploads were accepted for the correct repository/commit and finished processing (96.46%). Local full suites passed 5,688 assertions on Julia 1.9.4 and 1.13.1. The timing results in the description measure the specified wide-object case.

AI disclosure: This work was prepared with assistance from OpenAI Codex.

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.

1 participant