Skip to content
Open
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
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ http-api-docs:
--openapiv2_out=openapi \
--openapiv2_opt=allow_merge=true,merge_file_name=openapiv2,simple_operation_ids=true \
temporal/api/workflowservice/v1/* \
temporal/api/operatorservice/v1/*
temporal/api/operatorservice/v1/* \
temporal/api/activityservice/v1/*

jq --rawfile desc $(OAPI_OUT)/payload_description.txt < $(OAPI_OUT)/openapiv2.swagger.json '.definitions.v1Payload={description: $$desc}' > $(OAPI_OUT)/v2.tmp
mv -f $(OAPI_OUT)/v2.tmp $(OAPI_OUT)/openapiv2.json
Expand Down Expand Up @@ -147,7 +148,8 @@ nexus-rpc-yaml: nexus-rpc-yaml-install
--nexus-rpc-yaml_opt=include_operation_tags=exposed \
--nexus-rpc-yaml_out=. \
temporal/api/workflowservice/v1/* \
temporal/api/operatorservice/v1/*
temporal/api/operatorservice/v1/* \
temporal/api/activityservice/v1/*

nexus-rpc-yaml-install:
printf $(COLOR) "Build and install protoc-gen-nexus-rpc-yaml..."
Expand All @@ -170,7 +172,13 @@ system-nexus-wit: system-nexus-wit-install nex-gen-install
--file temporal/api/notificationservice/v1/request_response.proto \
--input nexus/notification-service.wit \
--input nexus/deps \
--output nexus/notification-service.wit
--output nexus/notification-service.wit && \
protoc -I $(PROTO_ROOT) \
--system-nexus-wit_opt=output=nexus/activity-service.wit \
--system-nexus-wit_opt=nex_gen=$(NEX_GEN) \
--system-nexus-wit_opt=linked_input=nexus/deps \
--system-nexus-wit_out=. \
temporal/api/activityservice/v1/service.proto

system-nexus-wit-install:
printf $(COLOR) "Build and install protoc-gen-system-nexus-wit..."
Expand Down
7 changes: 7 additions & 0 deletions api-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- included_paths:
- "**/workflowservice/v1/request_response.proto"
- "**/operatorservice/v1/request_response.proto"
- "**/activityservice/v1/request_response.proto"
disabled_rules:
- "core::0131::request-name-behavior" # We don't add non-HTTP annotations -- https://linter.aip.dev/131/request-name-behavior
- "core::0131::request-name-reference" # We don't add non-HTTP annotations -- https://linter.aip.dev/131/request-name-reference
Expand Down Expand Up @@ -43,6 +44,7 @@
- included_paths:
- "**/workflowservice/v1/service.proto"
- "**/operatorservice/v1/service.proto"
- "**/activityservice/v1/service.proto"
disabled_rules:
- "core::0127::resource-name-extraction" # We extract specific fields in URL since the gRPC API predates the HTTP API -- https://linter.aip.dev/127/resource-name-extraction

Expand All @@ -60,6 +62,11 @@
disabled_rules:
- "core::0127::http-annotation" # Do not require HTTP annotations on OperatorService calls at this time -- https://linter.aip.dev/127/http-annotation

- included_paths:
- "**/activityservice/v1/service.proto"
disabled_rules:
- "core::0127::http-annotation" # ActivityService is a Nexus service, not served over gRPC or HTTP -- https://linter.aip.dev/127/http-annotation

- included_paths:
- "google/**/*.proto"
disabled_rules:
Expand Down
5 changes: 5 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ lint:
ignore:
- cmd
- google
ignore_only:
# Nexus operation outputs aren't necessarily messages defined for the operation. ActivityService.GetResult outputs
# the activity's result payload.
RPC_RESPONSE_STANDARD_NAME:
- temporal/api/activityservice/v1/service.proto
disallow_comment_ignores: true
breaking:
use:
Expand Down
10 changes: 5 additions & 5 deletions cmd/protoc-gen-nexus-rpc-yaml/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ func generate(gen *protogen.Plugin) error {
methodName := string(m.Desc.Name())
hasOps = true
addOperation(langsDoc, svcName, methodName,
langRefs(p, f.Desc, m.Input.Desc),
langRefs(p, f.Desc, m.Output.Desc),
langRefs(p, m.Input.Desc),
langRefs(p, m.Output.Desc),
)
}
}
Expand All @@ -140,12 +140,12 @@ func generate(gen *protogen.Plugin) error {

// langRefs builds the map of language-specific type refs for a message.
//
// Go, Java, dotnet, and Ruby refs are derived from proto file-level package options.
// Go, Java, dotnet, and Ruby refs are derived from the package options of the file that defines the message.
// Python and TypeScript refs require the corresponding prefix params to be set; if
// empty they are omitted. Both use the last two path segments of go_package
// ({service}/v{n}), dropping any intermediate grouping directory.
func langRefs(p params, file protoreflect.FileDescriptor, msg protoreflect.MessageDescriptor) map[string]string {
opts, ok := file.Options().(*descriptorpb.FileOptions)
func langRefs(p params, msg protoreflect.MessageDescriptor) map[string]string {
opts, ok := msg.ParentFile().Options().(*descriptorpb.FileOptions)
if !ok || opts == nil {
return nil
}
Expand Down
8 changes: 8 additions & 0 deletions cmd/protoc-gen-resource-id-lint/exemptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ var exemptions = map[string]struct{}{

"WorkflowService.ShutdownWorker": {},

// Direct Nexus calls have no resource in the request itself. The target is derived from the operation input.
"WorkflowService.StartNexusOperation": {},
"WorkflowService.CancelNexusOperation": {},

"WorkflowService.GetWorkerTaskReachability": {},

"WorkflowService.DescribeDeployment": {},
Expand All @@ -63,4 +67,8 @@ var exemptions = map[string]struct{}{
"OperatorService.UpdateNexusEndpoint": {},
"OperatorService.DeleteNexusEndpoint": {},
"OperatorService.ListNexusEndpoints": {},

// ActivityService is a Nexus service, not served over gRPC. Direct calls go through
// WorkflowService.StartNexusOperation.
"ActivityService.GetResult": {},
}
37 changes: 37 additions & 0 deletions nexus/activity-service.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package temporal:nexus@1.0.0;

world system {
export activity-service;
}

/// @nexus.endpoint "__temporal_system"
/// @nexus.service-name "temporal.api.activityservice.v1.ActivityService"
/// @nexus.namespace dotnet="Temporalio.Workflows" go="go.temporal.io/sdk/internal"
/// @nexus.facade go="go.temporal.io/sdk/workflow"
/// @nexus.operations-class dotnet="Workflow"
/// @nexus.delay-load-temporalio-workflow
/// @nexus.experimental
interface activity-service {
use nexus:temporal-types/model@1.0.0.{
payload,
};

/// @nexus.doc "Request fields for getting the result of a standalone activity."
/// @nexus.experimental
/// @nexus.proto "temporal.api.activityservice.v1.GetResultRequest" typescript-import="@temporalio/proto"
record get-result-request {
/// @nexus.doc "ID of the standalone activity."
activity-id: string,
/// @nexus.doc "Run ID of the activity. Defaults to the latest run."
run-id: option<string>,
}

/// @nexus.doc
/// "Wait for a standalone activity to complete and return its result."
/// returns="The activity's result. Fails with the activity's failure if the activity doesn't complete successfully."
/// @nexus.operation name="GetResult"
/// @nexus.experimental
get-activity-result: func(
request: get-result-request,
) -> payload;
}
17 changes: 17 additions & 0 deletions nexus/temporal-proto-models-nexusrpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,20 @@ services:
$pythonRef: temporalio.api.workflowservice.v1.SignalWithStartWorkflowExecutionResponse
$rubyRef: Temporalio::Api::WorkflowService::V1::SignalWithStartWorkflowExecutionResponse
$typescriptRef: '@temporalio/api/workflowservice/v1.SignalWithStartWorkflowExecutionResponse'
temporal.api.activityservice.v1.ActivityService:
operations:
GetResult:
input:
$dotnetRef: Temporalio.Api.ActivityService.V1.GetResultRequest
$goRef: go.temporal.io/api/activityservice/v1.GetResultRequest
$javaRef: io.temporal.api.activityservice.v1.GetResultRequest
$pythonRef: temporalio.api.activityservice.v1.GetResultRequest
$rubyRef: Temporalio::Api::ActivityService::V1::GetResultRequest
$typescriptRef: '@temporalio/api/activityservice/v1.GetResultRequest'
output:
$dotnetRef: Temporalio.Api.Common.V1.Payload
$goRef: go.temporal.io/api/common/v1.Payload
$javaRef: io.temporal.api.common.v1.Payload
$pythonRef: temporalio.api.common.v1.Payload
$rubyRef: Temporalio::Api::Common::V1::Payload
$typescriptRef: '@temporalio/api/common/v1.Payload'
Loading