Skip to content

Support generic protobuf models and oneofs in TypeScript - #239

Open
VegetarianOrc wants to merge 5 commits into
mainfrom
amazzeo/ts-notification-service
Open

VegetarianOrc wants to merge 5 commits into
mainfrom
amazzeo/ts-notification-service

Conversation

@VegetarianOrc

Copy link
Copy Markdown
Contributor

Summary

  • Support TypeScript protobuf oneofs using SDK discriminators, with required/optional handling and discriminator-preserving wire output.
  • Convert generic Payload and single-value Payloads carriers, preserve generic transfer-converter signatures, and export model-only APIs.
  • Enable and regenerate the notification-service, proto-generic, and proto-oneof samples; add generator, compile-time, and runtime regression coverage.

Validation

  • Full cargo validate passed against the staged changes before committing, covering Rust, Python, TypeScript, Go, Java, .NET, generated-file consistency, and cross-language conformance.
  • TypeScript typechecking and all 21 protobuf sample tests passed, including SDK binary round-trips for proto-generic and proto-oneof.

SDK follow-up

The notification sample includes a temporary, sample-only .d.ts augmentation because the current TypeScript SDK does not yet export notification-service protobuf models. Remove it when the SDK exports those models. Notification conversion is tested with structural wire objects; notification binary encoding remains untested until the SDK models are available.

The workflow-service generated diff preserves its existing workflow/signal generic parameters on transfer-converter methods; its runtime conversion logic is unchanged.

@VegetarianOrc
VegetarianOrc requested a review from a team as a code owner October 15, 2026 23:01
Comment thread src/generator/typescript.rs Outdated
let generated_field_name = typescript_generated_field_name(&field.name);
let wire_field_name = typescript_generated_field_name(field_name);
let wire_field_expr = format!("{WIRE_VALUE_EXPR}.{wire_field_name}");
if let Some(PlannedWireFieldBinding::VariantMembers { wire_name, members }) =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems proto specific

@VegetarianOrc VegetarianOrc Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, caused a bit of a refactor, but I aligned this to remove the proto specific and to align the way it works more closely with how the python generator structures it. LMK what you think!

This branch has not been deployed

No deployments
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.

2 participants