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

feat(validation.md): added custom validator documentation #1016

Merged
merged 10 commits into from
Jan 1, 2025

Conversation

WilliamFernsV3
Copy link
Contributor

@WilliamFernsV3 WilliamFernsV3 commented Dec 4, 2024

I created a PR earlier today, adding in a custom validator called Custom. This allows users to easily create custom validations, it is simpler to use and shorter in syntax compared to the current Custom Validators.

This PR also resolves this issue

Copy link
Contributor Author

@WilliamFernsV3 WilliamFernsV3 left a comment

Choose a reason for hiding this comment

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

Good overall.


static func validations(_ validations: inout Validations) {
validations.add(
"nameAndSurname",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks great overall.

@WilliamFernsV3
Copy link
Contributor Author

@0xTim here is a PR I made for the custom validator PR in the core repository. Feel free to merge this once the other one gets merged.

Thanks :)

@WilliamFernsV3
Copy link
Contributor Author

This PR also fixes this issue: #1015

@WilliamFernsV3
Copy link
Contributor Author

I think this is a small improvement in the documentation. Should we keep it or not?

Link: https://docs.vapor.codes/basics/validation/

Before:
Vapor's Validation API helps you validate incoming request before using the Content API to decode data.

After:
Vapor's Validation API helps you validate the body and query parameters of an incoming request before using the Content API to decode data.

Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

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

One change otherwise LGTM! Thanks!

Comment on lines 223 to 224
Validators can also be combined to build complex validations using operators.
More information on `.custom` validator at [[#Custom Validators]].
Copy link
Member

Choose a reason for hiding this comment

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

Lets keep the first one as well (so have both sentences)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Let me know if there is anything else.

@0xTim 0xTim merged commit 0946bf8 into vapor:main Jan 1, 2025
1 check passed
@penny-for-vapor penny-for-vapor bot mentioned this pull request Jan 1, 2025
9 tasks
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.

https://github.com/vapor/vapor/issues/3260
2 participants