Skip to content

fix(constraint): call constraint for map and array types#6

Merged
unera merged 1 commit intomasterfrom
constraints_map
Mar 27, 2026
Merged

fix(constraint): call constraint for map and array types#6
unera merged 1 commit intomasterfrom
constraints_map

Conversation

@unera
Copy link
Copy Markdown
Collaborator

@unera unera commented Mar 26, 2026

In the old validator (bench/validator.lua:897) constraint was called for all types from a single shared code path. In the C implementation it was only wired up in
cv_check_scalar, leaving map and array silently ignoring the constraint field.

Add constraint invocation in cv_check_map (step 3, before transform) and cv_check_array (before transform), matching the original behaviour: called only on success, value in details is the pre-transform value.

Add regression tests in test/compat_test.lua:
test_map_constraint and test_array_constraint.

In the old validator (bench/validator.lua:897) constraint
was called for all types from a single shared code path.
In the C implementation it was only wired up in
cv_check_scalar, leaving map and array silently ignoring
the constraint field.

Add constraint invocation in cv_check_map (step 3, before
transform) and cv_check_array (before transform), matching
the original behaviour: called only on success, value in
details is the pre-transform value.

Add regression tests in test/compat_test.lua:
test_map_constraint and test_array_constraint.
@unera unera requested a review from ImeevMA March 26, 2026 16:05
@unera unera merged commit 348ab5a into master Mar 27, 2026
1 check passed
@unera unera deleted the constraints_map branch March 27, 2026 09:16
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.

2 participants