Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ValidateMap and field references #1219

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jippi
Copy link

@jippi jippi commented Feb 1, 2024

Fixes Or Enhances

Implement support for ValidateMap using Field references

Fixes #893
Fixes #876
Fixes #943

Make sure that you've checked the boxes below before you submit PR:

  • Tests exist or have been written that cover this particular change.

@go-playground/validator-maintainers

@jippi jippi requested a review from a team as a code owner February 1, 2024 23:14
return v.validateMapCtx(ctx, data, data, rules)
}

// validateMapCtx will track the original "root" map (in case of nesting) which will allow for Field reference validation
Copy link
Author

@jippi jippi Feb 1, 2024

Choose a reason for hiding this comment

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

I was not sure how y'all prefer naming this, so I just lowercased the "inner loop" func here.

I also made this new func for the implementation, since the signature of the exported one would otherwise change - and it made said signature clunky having to pass in same var as root and data

validator_instance.go Outdated Show resolved Hide resolved
@jippi jippi force-pushed the fix-ValidateMap-field-references branch from ac59f8b to 48ccdec Compare February 1, 2024 23:23
@coveralls
Copy link

coveralls commented Feb 1, 2024

Coverage Status

coverage: 74.208% (+0.04%) from 74.172%
when pulling be965b8 on jippi:fix-ValidateMap-field-references
into 55313db on go-playground:master.

@jippi jippi force-pushed the fix-ValidateMap-field-references branch from 48ccdec to 0b97b35 Compare February 1, 2024 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants