diff --git a/pkg/service/v0/service.go b/pkg/service/v0/service.go index 5d6a934939..93ba6f9034 100644 --- a/pkg/service/v0/service.go +++ b/pkg/service/v0/service.go @@ -216,8 +216,11 @@ func (g Service) GetValue(c context.Context, req *proto.GetValueRequest, res *pr } // GetValueByUniqueIdentifiers implements the ValueService interface -func (g Service) GetValueByUniqueIdentifiers(ctx context.Context, in *proto.GetValueByUniqueIdentifiersRequest, res *proto.GetValueResponse) error { - v, err := g.manager.ReadValueByUniqueIdentifiers(in.AccountUuid, in.SettingId) +func (g Service) GetValueByUniqueIdentifiers(ctx context.Context, req *proto.GetValueByUniqueIdentifiersRequest, res *proto.GetValueResponse) error { + if validationError := validateGetValueByUniqueIdentifiers(req); validationError != nil { + return merrors.BadRequest(g.id, "%s", validationError) + } + v, err := g.manager.ReadValueByUniqueIdentifiers(req.AccountUuid, req.SettingId) if err != nil { return merrors.NotFound(g.id, "%s", err) } diff --git a/pkg/service/v0/validator.go b/pkg/service/v0/validator.go index 67e2d16425..923fffbbd5 100644 --- a/pkg/service/v0/validator.go +++ b/pkg/service/v0/validator.go @@ -91,6 +91,14 @@ func validateGetValue(req *proto.GetValueRequest) error { return validation.Validate(req.Id, is.UUID) } +func validateGetValueByUniqueIdentifiers(req *proto.GetValueByUniqueIdentifiersRequest) error { + return validation.ValidateStruct( + req, + validation.Field(&req.SettingId, is.UUID), + validation.Field(&req.AccountUuid, requireAccountID...), + ) +} + func validateListValues(req *proto.ListValuesRequest) error { return validation.ValidateStruct( req,