utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
289 stars 39 forks source link

Implement Validator interface #44

Closed eaglemoor closed 6 years ago

eaglemoor commented 6 years ago

We need add Validator interface for Request struct. When request struct fetch data from request and if it implement Validator interface, we can validate data in request and return error before handler.

type Validator interface {
    Valid() bool
}
utrack commented 6 years ago

You can use middleware for that - it has access to the message struct. Set it up via desc.Apply(), passing transport.WithUnaryServerInterceptor()