Skip to content

Add data model payload conversion hooks#1655

Open
tconley1428 wants to merge 4 commits into
mainfrom
nexus-generated-model-wire-converter
Open

Add data model payload conversion hooks#1655
tconley1428 wants to merge 4 commits into
mainfrom
nexus-generated-model-wire-converter

Conversation

@tconley1428

@tconley1428 tconley1428 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Adds SDK payload-converter support for values and type hints that expose _temporal_to_data_model / _temporal_from_data_model hooks.

The hooks let a type provide the data-model value that should be handed to the configured payload converter, and reconstruct the original type after the converter decodes that representation. This keeps normal SDK payload-converter behavior in one place, including codec handling and serialization-context propagation, while allowing generated or user-defined wrapper types to model wire shapes that contain nested payload fields.

This matters for signal-with-start and similar workflow-targeted requests because nested user payloads are consumed by a workflow. The hook path lets those payload fields be serialized through the target workflow payload converter context instead of leaking the surrounding Nexus operation context.

This change:

  • wraps configured payload converters with an internal data-model adapter when DataConverter creates them
  • keeps the adapter internal instead of exporting it as public converter API
  • applies the hooks for both encode values and decode type hints before delegating to the configured payload converter
  • routes hook-aware outer-envelope conversion through the active payload converter so nested user payload fields preserve SDK serialization behavior
  • passes a payload-converter factory into workflow instance details so workflow instances receive already-wrapped converters rather than re-instantiating raw converter classes

@tconley1428
tconley1428 force-pushed the nexus-generated-model-wire-converter branch from 041bb17 to 844deb0 Compare July 21, 2026 15:50
@tconley1428 tconley1428 changed the title Add intermediate model payload conversion hooks Add data model payload conversion hooks Jul 21, 2026
@tconley1428
tconley1428 marked this pull request as ready for review July 21, 2026 18:12
@tconley1428
tconley1428 requested a review from a team as a code owner July 21, 2026 18:12
@tconley1428
tconley1428 force-pushed the nexus-generated-model-wire-converter branch from 5cf9231 to 51825ac Compare July 21, 2026 18:31
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