Skip to content

Commit c93f93f

Browse files
Enhancement: Introduce Option Interface for Future Interceptor Customization (#615)
* checkpoint * checkpoint
1 parent eef4b06 commit c93f93f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

interceptors/protovalidate/protovalidate.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ import (
1414
"google.golang.org/protobuf/proto"
1515
)
1616

17+
// Option interface is currently empty and serves as a placeholder for potential future implementations.
18+
// It allows adding new options without breaking existing code.
19+
type Option interface {
20+
unimplemented()
21+
}
22+
1723
// UnaryServerInterceptor returns a new unary server interceptor that validates incoming messages.
18-
func UnaryServerInterceptor(validator *protovalidate.Validator) grpc.UnaryServerInterceptor {
24+
func UnaryServerInterceptor(validator *protovalidate.Validator, opts ...Option) grpc.UnaryServerInterceptor {
1925
return func(
2026
ctx context.Context,
2127
req interface{},
@@ -36,7 +42,7 @@ func UnaryServerInterceptor(validator *protovalidate.Validator) grpc.UnaryServer
3642
}
3743

3844
// StreamServerInterceptor returns a new streaming server interceptor that validates incoming messages.
39-
func StreamServerInterceptor(validator *protovalidate.Validator) grpc.StreamServerInterceptor {
45+
func StreamServerInterceptor(validator *protovalidate.Validator, opts ...Option) grpc.StreamServerInterceptor {
4046
return func(
4147
srv interface{},
4248
stream grpc.ServerStream,

0 commit comments

Comments
 (0)