@@ -10,10 +10,9 @@ import (
1010 "go.temporal.io/api/workflowservice/v1"
1111 "go.temporal.io/server/chasm"
1212 nexusoperationpb "go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1"
13- "go.temporal.io/server/common/log"
1413 "go.temporal.io/server/common/namespace"
1514 commonnexus "go.temporal.io/server/common/nexus"
16- "go.temporal.io/server/common/searchattribute "
15+ "go.temporal.io/server/common/validation "
1716 "google.golang.org/protobuf/types/known/durationpb"
1817 "google.golang.org/protobuf/types/known/emptypb"
1918 "google.golang.org/protobuf/types/known/timestamppb"
@@ -36,30 +35,24 @@ var ErrStandaloneNexusOperationDisabled = serviceerror.NewUnimplemented("Standal
3635type frontendHandler struct {
3736 client nexusoperationpb.NexusOperationServiceClient
3837 config * Config
39- logger log.Logger
4038 namespaceRegistry namespace.Registry
4139 endpointRegistry commonnexus.EndpointRegistry
42- saMapperProvider searchattribute.MapperProvider
43- saValidator * searchattribute.Validator
40+ validatorRegistry * validation.ValidatorRegistry
4441}
4542
4643func NewFrontendHandler (
4744 client nexusoperationpb.NexusOperationServiceClient ,
4845 config * Config ,
49- logger log.Logger ,
5046 namespaceRegistry namespace.Registry ,
5147 endpointRegistry commonnexus.EndpointRegistry ,
52- saMapperProvider searchattribute.MapperProvider ,
53- saValidator * searchattribute.Validator ,
48+ validatorRegistry * validation.ValidatorRegistry ,
5449) FrontendHandler {
5550 return & frontendHandler {
5651 client : client ,
5752 config : config ,
58- logger : logger ,
5953 namespaceRegistry : namespaceRegistry ,
6054 endpointRegistry : endpointRegistry ,
61- saMapperProvider : saMapperProvider ,
62- saValidator : saValidator ,
55+ validatorRegistry : validatorRegistry ,
6356 }
6457}
6558
@@ -76,7 +69,7 @@ func (h *frontendHandler) StartNexusOperationExecution(
7669 return nil , err
7770 }
7871
79- if err := validateAndNormalizeStartRequest ( req , h . config , h . logger , h . saMapperProvider , h . saValidator ); err != nil {
72+ if err := validation . ValidateAndNormalize ( h . validatorRegistry , req ); err != nil {
8073 return nil , err
8174 }
8275
@@ -107,7 +100,7 @@ func (h *frontendHandler) DescribeNexusOperationExecution(
107100 return nil , err
108101 }
109102
110- if err := validateAndNormalizeDescribeRequest ( req , namespaceID .String (), h . config ); err != nil {
103+ if err := newDescribeNexusOperationExecutionRequestValidator ( h . config , namespaceID .String ()). ValidateAndNormalize ( req ); err != nil {
111104 return nil , err
112105 }
113106
@@ -127,7 +120,7 @@ func (h *frontendHandler) PollNexusOperationExecution(
127120 return nil , ErrStandaloneNexusOperationDisabled
128121 }
129122
130- if err := validateAndNormalizePollRequest ( req , h . config ); err != nil {
123+ if err := validation . ValidateAndNormalize ( h . validatorRegistry , req ); err != nil {
131124 return nil , err
132125 }
133126
@@ -248,7 +241,7 @@ func (h *frontendHandler) RequestCancelNexusOperationExecution(
248241 return nil , err
249242 }
250243
251- if err := validateAndNormalizeCancelRequest ( req , h . config ); err != nil {
244+ if err := validation . ValidateAndNormalize ( h . validatorRegistry , req ); err != nil {
252245 return nil , err
253246 }
254247
@@ -276,7 +269,7 @@ func (h *frontendHandler) TerminateNexusOperationExecution(
276269 return nil , err
277270 }
278271
279- if err := validateAndNormalizeTerminateRequest ( req , h . config ); err != nil {
272+ if err := validation . ValidateAndNormalize ( h . validatorRegistry , req ); err != nil {
280273 return nil , err
281274 }
282275
@@ -304,7 +297,7 @@ func (h *frontendHandler) DeleteNexusOperationExecution(
304297 return nil , err
305298 }
306299
307- if err := validateAndNormalizeDeleteRequest ( req , h . config ); err != nil {
300+ if err := validation . ValidateAndNormalize ( h . validatorRegistry , req ); err != nil {
308301 return nil , err
309302 }
310303
0 commit comments