You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature description:
protovalidate-go has an API for easily fetching field/message/oneof constraints in the resolver package. I propose that we add a similar API for getting predefined constraints in a similar way.
I see that there is code in the cache to fetch them but it seems like there’s not an exposed way to do something similar.
Problem it solves or use case:
It's useful for me to get protovalidate constraints in order to annotate generated OpenAPI specifications from protobuf. I suppose it may be useful for others as well.
Proposed implementation or solution:
ResolveFieldConstraints, ResolveMessageConstraints and ResolveOneofConstraints could be augmented to resolve the predefined constraints from extensions containing validate.E_Predefined.
Contribution:
protobuf extensions are pretty crazy to me, but I can help if there's no movement on this after a while.
Thinking about it a bit, at the moment, there's no particular reason for the StandardConstraintResolver interface to actually have a method for resolving the predefined constraint fields. However, maybe in spite of that, we could just provide a ResolvePredefinedConstraints method on DefaultResolver anyhow, just for convenience. If there's no objections, that's probably what I'll wind up doing.
Feature description:
protovalidate-go has an API for easily fetching field/message/oneof constraints in the resolver package. I propose that we add a similar API for getting predefined constraints in a similar way.
I see that there is code in the cache to fetch them but it seems like there’s not an exposed way to do something similar.
Problem it solves or use case:
It's useful for me to get protovalidate constraints in order to annotate generated OpenAPI specifications from protobuf. I suppose it may be useful for others as well.
Proposed implementation or solution:
ResolveFieldConstraints, ResolveMessageConstraints and ResolveOneofConstraints could be augmented to resolve the predefined constraints from extensions containing
validate.E_Predefined
.Contribution:
protobuf extensions are pretty crazy to me, but I can help if there's no movement on this after a while.
Examples or references:
https://pkg.go.dev/github.com/bufbuild/[email protected]/resolver
Additional context:
The text was updated successfully, but these errors were encountered: