-
Notifications
You must be signed in to change notification settings - Fork 37
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
[Feature Request] CIDR Validation #66
Comments
Thank you for the comprehensive feature request! The proposed implementations, Your willingness to contribute to the implementation is much appreciated. We'd be happy to guide you on how implementations are done. Leveraging the existing functions to make this a pure CEL constraint is a compelling idea. If we can achieve that, it'd be ideal as it would remove the need to complete language-specific implementations. |
Hi @Kryan90, |
This is functionally exactly what I had been looking for, thank you! The naming is slightly different, but I think |
Helps users to find the RPC interceptor implementation. https://github.com/connectrpc/validate-go
Feature description:
Add field validation for CIDR ranges, ie. support
string cidr = 1 [(buf.validate.field).string.cidr = true];
I found a similar request from the protoc-gen-validate repo that had been closed bufbuild/protoc-gen-validate#461
Problem it solves or use case:
Currently to get validation behavior I am using this pattern
however, this isn't particularly ergonomic when used with google.api.http routes since you end up having to do:
vs
Proposed implementation or solution:
I think doing a similar implementation as IP validators would make sense
protovalidate/proto/protovalidate/buf/validate/validate.proto
Lines 2683 to 2730 in 7e81586
Contribution:
I would be happy to try and implement this myself. I'm not sure how implementations in the language specific repos is done, but I could also help with the Go and Python implementations.
Examples or references:
https://github.com/go-playground/validator/blob/5bf55dc757cad229e8297d42640ec036e2360df7/baked_in.go#L375-L393
The text was updated successfully, but these errors were encountered: