Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visit OperatorService methods in interceptor #182

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ test: copy-helpers

generatorcheck:
printf $(COLOR) "Check generated code is not stale..."
#(cd ./cmd/proxygenerator && go mod tidy && go run ./ -verifyOnly)
(cd ./cmd/proxygenerator && go mod tidy && go run ./ -verifyOnly)

check: generatorcheck

Expand Down
25 changes: 22 additions & 3 deletions cmd/proxygenerator/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,18 @@ func generateInterceptor(cfg config) error {

// UnimplementedWorkflowServiceServer is auto-generated via our API package
// The methods on this type refer to all possible Request/Response types so we can use this to walk through all of our protobuf types
serviceTypes, err := lookupTypes("go.temporal.io/api/workflowservice/v1", []string{"UnimplementedWorkflowServiceServer"})
workflowServiceTypes, err := lookupTypes("go.temporal.io/api/workflowservice/v1", []string{"UnimplementedWorkflowServiceServer"})
if err != nil {
return err
}
service := serviceTypes[0]
workflowService := workflowServiceTypes[0]

// UnimplementedOperatorServiceServer is auto-generated via our API package
operatorServiceTypes, err := lookupTypes("go.temporal.io/api/operatorservice/v1", []string{"UnimplementedOperatorServiceServer"})
if err != nil {
return err
}
operatorService := operatorServiceTypes[0]

exportTypes, err := lookupTypes("go.temporal.io/api/export/v1", []string{"WorkflowExecutions"})
if err != nil {
Expand All @@ -523,7 +530,19 @@ func generateInterceptor(cfg config) error {
payloadRecords := map[string]*TypeRecord{}
failureRecords := map[string]*TypeRecord{}

for _, meth := range typeutil.IntuitiveMethodSet(service, nil) {
for _, meth := range typeutil.IntuitiveMethodSet(workflowService, nil) {
if !meth.Obj().Exported() {
continue
}

sig := meth.Obj().Type().(*types.Signature)
walk(payloadTypes, sig.Params().At(1).Type(), &payloadRecords)
walk(failureTypes, sig.Params().At(1).Type(), &failureRecords)
walk(payloadTypes, sig.Results().At(0).Type(), &payloadRecords)
walk(failureTypes, sig.Results().At(0).Type(), &failureRecords)
}

for _, meth := range typeutil.IntuitiveMethodSet(operatorService, nil) {
if !meth.Obj().Exported() {
continue
}
Expand Down
120 changes: 120 additions & 0 deletions proxy/interceptor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading