Skip to content

feat: add @nexus.varargs, @nexus.unwrap and @nexus.result-field - #89

Closed
moetemp wants to merge 1 commit into
moe/up/resource-factoryfrom
moe/up/varargs-unwrap-result-field
Closed

moetemp wants to merge 1 commit into
moe/up/resource-factoryfrom
moe/up/varargs-unwrap-result-field

Conversation

@moetemp

@moetemp moetemp commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR adds @nexus.varargs, @nexus.unwrap and @nexus.result-field. Together they make the Stream's publish(records) -> append-records-response into publish(*values) -> int.

/// @nexus.unwrap
record append-record { body: body-t }

resource %stream {
  /// @nexus.operation "append-records"
  /// @nexus.varargs name="values"
  /// @nexus.result-field "last-offset"
  publish: func(records: list<append-record>) -> append-records-response;
}
  • @nexus.unwrap on a record with one field makes a resource method take that field's type, and wrap each value. The model and the wire keep the record.
  • @nexus.varargs makes the last list parameter of a resource method variadic.
  • @nexus.result-field makes a resource method return one field of the response. An unset option field of a proto with no presence gives its zero value, so an empty publish returns 0.

Python generates all three, and TypeScript and .NET get them with their client targets in follow-up PRs. Go refuses them.

Why?

The proposal has publish(*values: T) -> int, and the WIT keeps the request and the response of the proto. Each directive is general, not only for Streams.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

The Python stream tests check the wrapped values and the result field. A fixture checks that Go refuses them.

@moetemp
moetemp force-pushed the moe/up/varargs-unwrap-result-field branch from bb29c8a to 56d99e2 Compare October 29, 2026 04:00
@moetemp
moetemp force-pushed the moe/up/resource-factory branch 2 times, most recently from 3e97846 to ff120ff Compare October 31, 2026 13:08
@moetemp
moetemp force-pushed the moe/up/varargs-unwrap-result-field branch from 56d99e2 to e082b61 Compare October 31, 2026 13:08
@moetemp
moetemp force-pushed the moe/up/resource-factory branch from ff120ff to c0e998f Compare November 3, 2026 15:22
@moetemp
moetemp force-pushed the moe/up/varargs-unwrap-result-field branch 2 times, most recently from 9d48475 to 00292fd Compare November 4, 2026 09:34
@moetemp
moetemp force-pushed the moe/up/resource-factory branch from c0e998f to 242c137 Compare November 4, 2026 09:34
@moetemp
moetemp force-pushed the moe/up/varargs-unwrap-result-field branch from 00292fd to e3ee76c Compare November 5, 2026 05:19
@moetemp
moetemp force-pushed the moe/up/resource-factory branch from 801829b to de23557 Compare November 5, 2026 07:27
@moetemp
moetemp force-pushed the moe/up/varargs-unwrap-result-field branch from e3ee76c to 08c1907 Compare November 5, 2026 07:27
A resource method can take the items of its last list as arguments, take a one-field record as its
field, and return one field of the response. The Stream's publish takes values and returns the
last offset.
@moetemp
moetemp force-pushed the moe/up/varargs-unwrap-result-field branch from 08c1907 to 6b54092 Compare November 5, 2026 22:22
@moetemp

moetemp commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Replaced by temporalio#372.

@moetemp moetemp closed this Nov 6, 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