Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| - **A shared runtime validator.** One validator per type, used when a value is parsed off the wire and again when it is serialized onto the wire, so a payload cannot enter or leave your service in a shape the contract forbids. | ||
| - **A [Nexus Service Contract](/glossary#nexus-service-contract) definition.** The generated Service and Operation declarations you register on a Worker and call from a caller Workflow. | ||
|
|
||
| Constraint failures do not surface one at a time. |
There was a problem hiding this comment.
This is an interesting placement because it is not what the generator produces but is a behavior of the generator.
There was a problem hiding this comment.
True. Tweaked the wording, see if you like this better.
| ```bash | ||
| git clone https://github.com/temporalio/nex-gen.git | ||
| cd nex-gen | ||
| cargo build --release |
There was a problem hiding this comment.
what is cargo, and how do I get it if I want to use this project.
There was a problem hiding this comment.
Somewhat clarified - but didn't go into depth. I can, but ... this should be easy to figure out, and if it's not then I'm not sure that person should be trying to build this!
| - `string` (the default) keeps every temporal field as the RFC 3339 string that appears on the wire. | ||
| It has no runtime dependency and round-trips losslessly, but you parse and compare the strings yourself. | ||
| - `date` maps `date-time` fields to a JavaScript `Date`. | ||
| This is lossy: a `Date` is a UTC instant, so the original offset is folded away and precision is capped at milliseconds. |
There was a problem hiding this comment.
We're not using ISO-8601? https://en.wikipedia.org/wiki/ISO_8601
I thought the whole world uses ISO-8601... ?
There was a problem hiding this comment.
Checked and hopefully clarified ... but yeah, RFC 3339. See this comment in nex-gen:
https://github.com/temporalio/nexgen/blob/main/src/json_schema/format.rs#L38
There was a problem hiding this comment.
Also search for the string "because the stdlib emitters disagree" in https://github.com/temporalio/nexgen/blob/main/specs/json-schema/features/format.md, that's why he used the RFC I think
| This is lossy: a `Date` is a UTC instant, so the original offset is folded away and precision is capped at milliseconds. | ||
| - `temporal` maps to the TC39 Temporal API, preserving offset and sub-second precision, and requires the `Temporal` global or a polyfill. | ||
|
|
||
| ## Use the generated code |
There was a problem hiding this comment.
This is strange use generate code talks about how the validation works, and then jumps into the generated code samples. It should do one or the other, either explain how the generated code was generated, or deep dive into a sample. Not both.
There was a problem hiding this comment.
See if you like this better?
|
|
||
| ## Supported schema features | ||
|
|
||
| The generator implements a curated subset of JSON Schema 2020-12 chosen so that every accepted construct lowers identically into all four languages. |
There was a problem hiding this comment.
Why are we so in love with writing out: JSON Schema 2020-12. Is that meaningful to folks rather than just say Json Schema.
There was a problem hiding this comment.
Also, don't say all four languages.
There was a problem hiding this comment.
JSON Schema 2020-12 is now in two places ... I think it's OK, seems to make sense to me, but ... I can easily modify this. See how it reads this time.
📖 Docs PR preview links |
There was a problem hiding this comment.
Pull request overview
Documents the pre-release Nexus Client Code Generator and adds it to Nexus navigation.
Changes:
- Explains schema generation, validation, installation, and language-specific usage.
- Adds guidance for contract changes, defaults, and supported schema features.
- Adds the page to the Temporal Nexus sidebar.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
sidebars.js |
Adds the generator guide to Nexus navigation. |
docs/encyclopedia/nexus/nexus-client-code-generator.mdx |
Introduces the generator documentation and examples. |
Suppressed comments (1)
docs/encyclopedia/nexus/nexus-client-code-generator.mdx:458
fromIntermediatethrowsValidationError, but this handler lets it escape without converting it to a NexusHandlerErrorof typeBAD_REQUEST. Therefore the sample does not implement theBAD_REQUESTbehavior promised on line 38 and described on line 475. Catch the validation error here and throw the SDK's explicit non-retryableBAD_REQUESThandler error while preserving the violations.
const handler = nexus.serviceHandler(chatService, {
async sendMessage(_ctx, input) {
const request = new SendMessageInputMapper().fromIntermediate(input);
const output = { messageId: await store(request) };
return new SendMessageOutputMapper().toIntermediate(output) as SendMessageOutput;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This is documentation for pre-release code, do not merge yet!
┆Attachments: EDU-6905 Adding documentation for Nexus Client library code generation