chore(deps): bump protovalidate to v1.0.0

bump version v0.4.1 (`e097f827e65240ac9fd4b1158849a8fc`) to v1.0.0 (`52f32327d4b045a79293a6ad4e7e1236`)

refactor: endpoint from `github.com/bufbuild/protovalidate-go` to `buf.build/go/protovalidate`

chore(deps): bump other dependencies
This commit is contained in:
2025-09-29 20:33:31 +01:00
parent 1ef41aeb26
commit 85019cf428
12 changed files with 214 additions and 83 deletions

View File

@@ -18,7 +18,7 @@ package auth
import (
"context"
"github.com/bufbuild/protovalidate-go"
"buf.build/go/protovalidate"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/emptypb"
@@ -68,7 +68,7 @@ func NewAuthService(cfg *ServiceConfig, store StorageController) *AuthService {
svc := &AuthService{
cfg: cfg,
store: store,
pbVal: pbVal,
pbVal: &pbVal,
}
return svc
@@ -84,7 +84,7 @@ func (svc AuthService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInf
func (svc AuthService) LoginPassword(ctx context.Context, req *pb.LoginPasswordRequest) (*pb.LoginPasswordResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// provide validation err context to user
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}
@@ -121,7 +121,7 @@ func (svc AuthService) SetPassword(ctx context.Context, req *pb.SetPasswordReque
}
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// provide validation err context to user
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}
@@ -137,7 +137,7 @@ func (svc AuthService) SetPassword(ctx context.Context, req *pb.SetPasswordReque
func (svc AuthService) ProcessUserDeletedEvent(ctx context.Context, req *eventpb.UserDeletedEvent) (*emptypb.Empty, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// provide validation err context to user
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}

View File

@@ -18,7 +18,7 @@ package order
import (
"context"
"github.com/bufbuild/protovalidate-go"
"buf.build/go/protovalidate"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/emptypb"
@@ -70,7 +70,7 @@ func NewOrderService(cfg *ServiceConfig, store StorageController) *OrderService
// Initialise the service
return &OrderService{
store: store,
pbVal: pbVal,
pbVal: &pbVal,
}
}
@@ -84,7 +84,7 @@ func (svc OrderService) ServiceInfo(ctx context.Context, req *commonpb.ServiceIn
func (svc OrderService) ViewOrder(ctx context.Context, req *pb.ViewOrderRequest) (*pb.ViewOrderResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}
@@ -100,7 +100,7 @@ func (svc OrderService) ViewOrder(ctx context.Context, req *pb.ViewOrderRequest)
func (svc OrderService) ViewOrders(ctx context.Context, req *pb.ViewOrdersRequest) (*pb.ViewOrdersResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// provide validation err context to user
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}
@@ -128,7 +128,7 @@ func (svc OrderService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReques
}
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// provide validation err context to user
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}

View File

@@ -18,7 +18,7 @@ package payment
import (
"context"
"github.com/bufbuild/protovalidate-go"
"buf.build/go/protovalidate"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/emptypb"
@@ -70,7 +70,7 @@ func NewPaymentService(cfg *ServiceConfig, store StorageController) *PaymentServ
// Initialise the service
return &PaymentService{
store: store,
pbVal: pbVal,
pbVal: &pbVal,
}
}

View File

@@ -18,7 +18,7 @@ package product
import (
"context"
"github.com/bufbuild/protovalidate-go"
"buf.build/go/protovalidate"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/emptypb"
@@ -68,7 +68,7 @@ func NewProductService(cfg *ServiceConfig, store StorageController) *ProductServ
// Initialise the service
return &ProductService{
store: store,
pbVal: pbVal,
pbVal: &pbVal,
}
}
@@ -82,7 +82,7 @@ func (svc ProductService) ServiceInfo(ctx context.Context, req *commonpb.Service
func (svc ProductService) ViewProduct(ctx context.Context, req *pb.ViewProductRequest) (*pb.ViewProductResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}

View File

@@ -18,7 +18,7 @@ package shipping
import (
"context"
"github.com/bufbuild/protovalidate-go"
"buf.build/go/protovalidate"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/emptypb"
@@ -66,7 +66,7 @@ func NewShippingService(cfg *ServiceConfig, store StorageController) *ShippingSe
// Initialise the service
return &ShippingService{
store: store,
pbVal: pbVal,
pbVal: &pbVal,
}
}
@@ -80,7 +80,7 @@ func (svc ShippingService) ServiceInfo(ctx context.Context, req *commonpb.Servic
func (svc ShippingService) ViewShipment(ctx context.Context, req *pb.ViewShipmentRequest) (*pb.ViewShipmentResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}
@@ -98,7 +98,7 @@ func (svc ShippingService) ViewShipment(ctx context.Context, req *pb.ViewShipmen
func (svc ShippingService) ViewShipmentManifest(ctx context.Context, req *pb.ViewShipmentManifestRequest) (*pb.ViewShipmentManifestResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}

View File

@@ -18,7 +18,7 @@ package user
import (
"context"
"github.com/bufbuild/protovalidate-go"
"buf.build/go/protovalidate"
"github.com/rs/zerolog/log"
"github.com/hexolan/stocklet/internal/pkg/errors"
@@ -65,7 +65,7 @@ func NewUserService(cfg *ServiceConfig, store StorageController) *UserService {
// Initialise the service
return &UserService{
store: store,
pbVal: pbVal,
pbVal: &pbVal,
}
}
@@ -79,7 +79,7 @@ func (svc UserService) ServiceInfo(ctx context.Context, req *commonpb.ServiceInf
func (svc UserService) ViewUser(ctx context.Context, req *pb.ViewUserRequest) (*pb.ViewUserResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}
@@ -95,7 +95,7 @@ func (svc UserService) ViewUser(ctx context.Context, req *pb.ViewUserRequest) (*
func (svc UserService) RegisterUser(ctx context.Context, req *pb.RegisterUserRequest) (*pb.RegisterUserResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}

View File

@@ -18,7 +18,7 @@ package warehouse
import (
"context"
"github.com/bufbuild/protovalidate-go"
"buf.build/go/protovalidate"
"github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/emptypb"
@@ -69,7 +69,7 @@ func NewWarehouseService(cfg *ServiceConfig, store StorageController) *Warehouse
// Initialise the service
return &WarehouseService{
store: store,
pbVal: pbVal,
pbVal: &pbVal,
}
}
@@ -83,7 +83,7 @@ func (svc WarehouseService) ServiceInfo(ctx context.Context, req *commonpb.Servi
func (svc WarehouseService) ViewProductStock(ctx context.Context, req *pb.ViewProductStockRequest) (*pb.ViewProductStockResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}
@@ -99,7 +99,7 @@ func (svc WarehouseService) ViewProductStock(ctx context.Context, req *pb.ViewPr
func (svc WarehouseService) ViewReservation(ctx context.Context, req *pb.ViewReservationRequest) (*pb.ViewReservationResponse, error) {
// Validate the request args
if err := svc.pbVal.Validate(req); err != nil {
if err := (*svc.pbVal).Validate(req); err != nil {
// Provide the validation error to the user.
return nil, errors.NewServiceError(errors.ErrCodeInvalidArgument, "invalid request: "+err.Error())
}