Skip to content

Commit

Permalink
Add support for editions, proto3 optional
Browse files Browse the repository at this point in the history
closes: #81
  • Loading branch information
cludden committed Jan 29, 2025
1 parent 3d95ea2 commit 7bd479b
Show file tree
Hide file tree
Showing 81 changed files with 6,291 additions and 6,245 deletions.
2 changes: 2 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
issue-845-fix: true
resolve-type-alias: false
with-expecter: true
packages:
github.com/cludden/protoc-gen-go-temporal/gen/example/v1:
Expand Down
9 changes: 7 additions & 2 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ managed:
- file_option: go_package_prefix
value: github.com/cludden/protoc-gen-go-temporal/gen
plugins:
- local: protoc-gen-go-patch
- local: protoc-gen-go
out: gen
opt:
- paths=source_relative
- plugin=go
- local: protoc-gen-go_temporal
out: gen
opt:
Expand All @@ -23,3 +22,9 @@ plugins:
- paths=source_relative
- workflow-update-enabled=true
strategy: all
inputs:
- directory: examples
- directory: proto
- directory: test
exclude_paths:
- test/patch/proto/test/patch
12 changes: 9 additions & 3 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/googleapis/googleapis
commit: cc916c31859748a68fd229a3c8d7a2e8
digest: b5:3b4e241d18fbebc6b30ff28968527af2cdd618026930d2a9666bbad2868b1aa164d20229477464691bdfd053a77b5c727468039bd1d2b550cb4151ee4c1499fe
- name: buf.build/alta/protopatch
commit: cf22509f2c224a358bb5e749aa029444
digest: b5:4d31fce06011dd4996c55de9ef8a9352770bdff014b102cd8aeee1df67536112f4f2df142172bc0927b3b1c9ca5dcb3d1c8974b900958dc21b2aa6d4ab931f47
- name: buf.build/cludden/protoc-gen-go-temporal
commit: 81eb66e24ea5484ab4eb3564700e0b56
digest: b5:0e11fa3310835d17d6ebdee90647163a1549ba669f54506a79a8f4c13a923bf051040032452b427b5e77266aa8481ea9df5bca268bc0b04f6c4861af4e5833d0
- name: buf.build/envoyproxy/protoc-gen-validate
commit: daf171c6cdb54629b5f51e345a79e4dd
digest: b5:c745e1521879f43740230b1df673d0729f55704efefdcfc489d4a0a2d40c92a26cacfeab62813403040a8b180142d53b398c7ca784a065e43823605ee49681de
34 changes: 34 additions & 0 deletions buf.patch.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: v2
managed:
enabled: true
override:
- file_option: go_package_prefix
value: github.com/cludden/protoc-gen-go-temporal/gen
disable:
- file_option: go_package
module: buf.build/alta/protopatch
- file_option: go_package
module: buf.build/cludden/protoc-gen-go-temporal
plugins:
- local: protoc-gen-go-patch
out: gen
opt:
- paths=source_relative
- plugin=go
- local: protoc-gen-go_temporal
out: gen
opt:
- cli-categories=true
- cli-enabled=true
- docs-out=./proto/README.md
- enable-codec=true
- enable-patch-support=true
- enable-xns=true
- patches=64_ENABLED
- paths=source_relative
- workflow-update-enabled=true
strategy: all
inputs:
- directory: test
paths:
- test/patch/proto/test/patch
6 changes: 5 additions & 1 deletion buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ modules:
- path: examples/xns/proto
- path: proto
name: buf.build/cludden/protoc-gen-go-temporal
- path: test/editions/proto
- path: test/expression/proto
- path: test/option/proto
- path: test/patch/proto
- path: test/proto3optional/proto
- path: test/simple/proto
- path: test/xnserr/proto
deps:
- buf.build/cludden/protoc-gen-go-temporal-example
- buf.build/alta/protopatch
- buf.build/cludden/protoc-gen-go-temporal
lint:
use:
- BASIC
Expand Down
29 changes: 13 additions & 16 deletions examples/example/proto/example/v1/example.proto
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
syntax="proto3";
syntax = "proto3";

package example.v1;

import "google/protobuf/empty.proto";
import "temporal/v1/temporal.proto";

service Example {
option (temporal.v1.service) = {
task_queue: "example-v1"
};
option (temporal.v1.service) = {task_queue: "example-v1"};

// CreateFoo creates a new foo operation
rpc CreateFoo(CreateFooRequest) returns (CreateFooResponse) {
option (temporal.v1.workflow) = {
execution_timeout: { seconds: 3600 }
execution_timeout: {seconds: 3600}
id: 'create-foo/${! name.slug() }'
id_reuse_policy: WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE
query: { ref: "GetFooProgress" }
signal: { ref: "SetFooProgress", start: true }
update: { ref: "UpdateFooProgress" }
query: {ref: "GetFooProgress"}
signal: {
ref: "SetFooProgress"
start: true
}
update: {ref: "UpdateFooProgress"}
};
}

Expand All @@ -30,10 +31,8 @@ service Example {
// Notify sends a notification
rpc Notify(NotifyRequest) returns (google.protobuf.Empty) {
option (temporal.v1.activity) = {
start_to_close_timeout: { seconds: 30 }
retry_policy: {
max_attempts: 3
}
start_to_close_timeout: {seconds: 30}
retry_policy: {max_attempts: 3}
};
}

Expand All @@ -44,9 +43,7 @@ service Example {

// UpdateFooProgress sets the current status of a CreateFoo operation
rpc UpdateFooProgress(SetFooProgressRequest) returns (GetFooProgressResponse) {
option (temporal.v1.update) = {
id: 'update-progress/${! progress.string() }'
};
option (temporal.v1.update) = {id: 'update-progress/${! progress.string() }'};
}
}

Expand All @@ -58,7 +55,7 @@ message CreateFooRequest {

// SampleWorkflowWithMutexResponse describes the output from a CreateFoo workflow
message CreateFooResponse {
Foo foo = 1;
Foo foo = 1;
}

// Foo describes an illustrative foo resource
Expand Down
98 changes: 0 additions & 98 deletions examples/example/proto/patch/go.proto

This file was deleted.

8 changes: 3 additions & 5 deletions examples/helloworld/proto/example/helloworld/v1/example.proto
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
syntax="proto3";
syntax = "proto3";

package example.helloworld.v1;

import "google/protobuf/empty.proto";
import "temporal/v1/temporal.proto";

service Example {
option (temporal.v1.service) = {
task_queue: "hello-world"
};
option (temporal.v1.service) = {task_queue: "hello-world"};

// Hello prints a friendly greeting and waits for goodbye
rpc Hello(HelloRequest) returns (HelloResponse) {
option (temporal.v1.workflow) = {
name: "example.v1.Hello"
id: 'hello/${! name.or("World") }'
signal: { ref: "Goodbye" }
signal: {ref: "Goodbye"}
};
}

Expand Down
21 changes: 11 additions & 10 deletions examples/mutex/proto/example/mutex/v1/mutex.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
syntax="proto3";
syntax = "proto3";

package example.mutex.v1;

Expand All @@ -7,9 +7,7 @@ import "google/protobuf/empty.proto";
import "temporal/v1/temporal.proto";

service Example {
option (temporal.v1.service) = {
task_queue: "mutex"
};
option (temporal.v1.service) = {task_queue: "mutex"};

rpc AcquireLock(AcquireLockInput) returns (google.protobuf.Empty) {
option (temporal.v1.signal) = {};
Expand All @@ -23,16 +21,19 @@ service Example {
option (temporal.v1.workflow) = {
id: 'mutex:${! resourceId }'
retry_policy: {
initial_interval: { seconds: 1 }
initial_interval: {seconds: 1}
backoff_coefficient: 2.0
max_interval: { seconds: 60 }
max_interval: {seconds: 60}
max_attempts: 5
}
signal: { ref: 'AcquireLock', start: true }
signal: { ref: 'ReleaseLock' }
signal: {
ref: 'AcquireLock'
start: true
}
signal: {ref: 'ReleaseLock'}
};
option (temporal.v1.activity) = {
start_to_close_timeout: { seconds: 10 }
start_to_close_timeout: {seconds: 10}
};
}

Expand All @@ -43,7 +44,7 @@ service Example {
rpc SampleWorkflowWithMutex(SampleWorkflowWithMutexInput) returns (google.protobuf.Empty) {
option (temporal.v1.workflow) = {
id: 'SampleWorkflow1WithMutex_${! uuid_v4() }'
signal: { ref: 'LockAcquired' }
signal: {ref: 'LockAcquired'}
};
}
}
Expand Down
6 changes: 2 additions & 4 deletions examples/schedule/proto/example/schedule/v1/schedule.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import "temporal/v1/temporal.proto";

service Example {
option (temporal.v1.service).task_queue = "schedule-v1";

rpc Schedule(ScheduleInput) returns (ScheduleOutput) {
option (temporal.v1.workflow) = {
name: "example.schedule.v1.Schedule"
};
option (temporal.v1.workflow) = {name: "example.schedule.v1.Schedule"};
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
syntax="proto3";
syntax = "proto3";

package example.searchattributes.v1;

Expand All @@ -7,9 +7,7 @@ import "google/protobuf/timestamp.proto";
import "temporal/v1/temporal.proto";

service Example {
option (temporal.v1.service) = {
task_queue: "searchattributes"
};
option (temporal.v1.service) = {task_queue: "searchattributes"};

rpc SearchAttributes(SearchAttributesInput) returns (google.protobuf.Empty) {
option (temporal.v1.workflow) = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
syntax="proto3";
syntax = "proto3";

package example.updatabletimer.v1;

Expand All @@ -7,9 +7,7 @@ import "google/protobuf/timestamp.proto";
import "temporal/v1/temporal.proto";

service Example {
option (temporal.v1.service) = {
task_queue: "updatable-timer"
};
option (temporal.v1.service) = {task_queue: "updatable-timer"};

// GetWakeUpTime retrieves the current timer expiration timestamp
rpc GetWakeUpTime(google.protobuf.Empty) returns (GetWakeUpTimeOutput) {
Expand All @@ -21,8 +19,8 @@ service Example {
option (temporal.v1.workflow) = {
name: "UpdatableTimer"
id: 'updatable-timer/${! name.or(uuid_v4()) }'
query: { ref: "GetWakeUpTime" }
signal: { ref: "UpdateWakeUpTime" }
query: {ref: "GetWakeUpTime"}
signal: {ref: "UpdateWakeUpTime"}
};
}

Expand Down
Loading

0 comments on commit 7bd479b

Please sign in to comment.