-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add validating interceptor #4
Conversation
interceptor_test.go
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package validate_test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this to perform a user-centric test strategy. This is not a pattern I usually employ but I see it throughout the connectrpc org
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pinched this from connect-go. Have we considered a connecttest
sdk for users?
Rather than using whatever plugin version is latest in the BSR, build `protoc-gen-go` and `protoc-gen-connect-go` locally. This guarantees that we're using versions compatible with the Protobuf and Connect runtimes in go.mod.
Switch to using a user service as our example. It offers a little more space for complex validation, and using it in tests gives us confidence that the README code snippet is correct.
Relates to #2
This PR introduces an interceptor for Connect to validate incoming protobuf messages using
protovalidate-go
. Supports both unary and streaming RPCs.📝 Default Behaviors:
🧪 Testing:
testserver
package to create in-memory servers for testing client-server interactions without the need for actual networking.❓ Open Questions:
exhaustruct
rule is very annoying, particularly when dealing with functional option pattern as this requires an initialized and empty struct to be defined. I have turned it off but I feel we have a reason to be using it so I'm open to hearing what this reason may be.