Skip to content

feat: leave a resource method out of one target with @nexus.api-omit - #116

Closed
moetemp wants to merge 5 commits into
moe/client-import-cyclefrom
moe/method-omit-target
Closed

moetemp wants to merge 5 commits into
moe/client-import-cyclefrom
moe/method-omit-target

Conversation

@moetemp

@moetemp moetemp commented Nov 13, 2026

Copy link
Copy Markdown
Owner

This PR lets @nexus.api-omit targets="workflow" or targets="client" leave a resource method out
of one target.

In this release Workflow code can't append to a Stream or close it, but client code can. The
directive worked on a field or a function, not on a resource method.

/// @nexus.operation "close-stream"
/// @nexus.close
/// @nexus.api-omit targets="workflow"
close: func(producer: option<producer>);

The stream sample omits append and close this way. Its Workflow Stream then has no append
and no close in Python, TypeScript and .NET. The Python Workflow Stream also loses __aenter__
and __aexit__, so create_stream no longer works in async with there. The client Stream is
unchanged.

Notes for the review.

  • The operation stays in the service. Only the method and the helpers that only it used go.
  • A bare @nexus.api-omit on a method, or one with both targets, is refused. Remove the method
    instead.
  • Go refuses a method omitted for workflow. Java generates no resource methods.
  • TypeScript keeps the operation module, and .NET the internal options overload, of an api-omitted
    operation. Should they go too?
  • The Python and TypeScript Workflow tests no longer check the sourced producer, since that
    Stream can't append.

moetemp and others added 5 commits November 13, 2026 01:36
A resource method could not be left out of one target, and the stream sample needs a Workflow
`Stream` with no `append` and no `close`. Without its close method, a target's resource is not a
context manager, and a method that no target keeps is refused.
A TypeScript resource method calls the Workflow API, so a method omitted for `workflow` goes from
the class. Its request helper goes too when no other method used it.
A .NET resource method calls the Workflow API, so a method omitted for `workflow` goes from the
class. The request overload that only it called becomes private.
Go has no sample that would show its output without the method, so it refuses the directive as it
refuses `@nexus.varargs`. A method omitted only for `client` changes nothing in Go.
In this release Workflow code can't append to a Stream or close it, so the Workflow target omits
both methods. The client `Stream` keeps them, and the Workflow `create_stream` is a plain call.

Co-authored-by: Tim Conley <timothy.conley@temporal.io>
@moetemp

moetemp commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

Replaced by temporalio#410.

@moetemp moetemp closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant