Skip to content

fix: preserve pattern property helper scope - #46

Open
jdalton wants to merge 1 commit into
ata-core:masterfrom
jdalton:fix/pattern-properties-helper-scope
Open

jdalton wants to merge 1 commit into
ata-core:masterfrom
jdalton:fix/pattern-properties-helper-scope

Conversation

@jdalton

@jdalton jdalton commented Sep 17, 2026

Copy link
Copy Markdown

Nested patternProperties validators can reference regex or format helpers from their child schemas. The runtime compiler constructed those children with new Function, which discarded the helper scope and caused a ReferenceError.

The fix - child checks execute inside the parent validator

The generated child checks now remain inside the parent validator. They can use the same regex, set, and format helper bindings as other generated checks.

This behavior also applies to an additionalProperties schema when the compiler combines it with patternProperties.

Validation - runtime and schema suites pass

The regression test covers helper bindings in both generated child paths.

Ran npm test. The complete test command passed.

Ran npm run test:suite. All 3,365 official cases passed.

Ran npm run release:check. All release checks passed.

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