Skip to content

feat: flatten some fields of one request field - #85

Closed
moetemp wants to merge 1 commit into
moe/up/source-targetsfrom
moe/up/field-flatten
Closed

moetemp wants to merge 1 commit into
moe/up/source-targetsfrom
moe/up/field-flatten

Conversation

@moetemp

@moetemp moetemp commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR lets @nexus.flatten-in-api apply to a field, so a call takes only some fields of that field's record.

record create-stream-request {
  /// @nexus.flatten-in-api fields="id backend"
  stream-ref: stream-ref,
}
  • fields lists the fields of the record that become parameters of the call, and the call builds the record from them.
  • Each required field of the record must be in fields. The field can't also have a source, a default, an api-omit or @nexus.omit.
  • Python, TypeScript and .NET generate it in each target. Go refuses a field-level flatten, and Java doesn't generate proto-backed models.

Why?

The proposal has client.create_stream[T](id, *, backend=None), and the create request has the id and the backend in its stream_ref. A record-level flatten would promote every field of StreamRef in every request that has one.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

The Python, TypeScript and .NET tests check the ref of a Stream create. Fixtures cover the refused flattens.

@moetemp
moetemp force-pushed the moe/up/field-flatten branch from 427d8be to e185234 Compare October 29, 2026 04:00
@moetemp
moetemp force-pushed the moe/up/source-targets branch from 4ad0591 to 0b8405f Compare October 29, 2026 04:00
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from e185234 to f4435b6 Compare October 31, 2026 13:08
@moetemp
moetemp force-pushed the moe/up/source-targets branch from 0b8405f to f76c7e1 Compare October 31, 2026 13:08
@moetemp
moetemp force-pushed the moe/up/source-targets branch from f76c7e1 to b020739 Compare November 3, 2026 15:22
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from f4435b6 to 3bbac1d Compare November 3, 2026 15:22
@moetemp
moetemp force-pushed the moe/up/source-targets branch from b020739 to bf06cd9 Compare November 4, 2026 09:34
@moetemp
moetemp force-pushed the moe/up/field-flatten branch 2 times, most recently from 7731e40 to 751ad5b Compare November 5, 2026 05:19
@moetemp
moetemp force-pushed the moe/up/source-targets branch from bf06cd9 to 41d2f1d Compare November 5, 2026 05:19
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from 751ad5b to b5dafd5 Compare November 5, 2026 07:27
@moetemp
moetemp force-pushed the moe/up/source-targets branch from 41d2f1d to 2ece8b5 Compare November 5, 2026 07:27
`@nexus.flatten-in-api fields="..."` on a field makes the call take those fields of its
record. The Stream create takes the id and the backend of its ref this way.
@moetemp
moetemp force-pushed the moe/up/source-targets branch from 2ece8b5 to d7b69f0 Compare November 5, 2026 22:22
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from b5dafd5 to 6c9b2f1 Compare November 5, 2026 22:22
@moetemp

moetemp commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Moved to temporalio#368, on main. It flattens the whole record of one request field, so the fields="..." subset is gone.

@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