fix: handle TypeScript Fetch tagged union payloads#127
Merged
adamcavendish merged 1 commit intoJun 22, 2026
Merged
Conversation
- Promote object-shaped tagged payloads before TypeScript Fetch emission - Preserve camelCase ergonomic keys, wire keys, nullable guards, and simplified unions - Add VP camelCase tagged nullable union goldens for masked schemas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes TypeScript Fetch generation for tagged union payloads and nullable/union-heavy model shapes exposed by a VP-generated client.
What changed
property_naming = "camelCase".fromJSONandtoJSON, including array/map/union wrappers around named models.additionalPropertiesremain contentful.Root cause
Tagged-union payload emission assumed payloads were directly named object schemas and could not consistently distinguish closed discriminator-only variants from object-shaped content after lowering. The TypeScript converter path also only applied named-model conversion at the top level, so wrapped named payloads could bypass conversion.
Validation
UPDATE_GOLDEN=1 cargo test --test golden_tests_typescript_fetch test_toolchain_vp_camel_case_tagged_nullable_unions_golden -- --nocapturecargo fmt --all -- --checkcargo test --test golden_tests_typescript_fetch -- --nocapture./scripts/golden-build-typescript.sh vpcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --quietopenapi-nexusbinary:VP_NODE_VERSION=24.15.0 vp check --no-fmtpassed with no warnings, lint errors, or type errors in 869 files.