Fix TypeScript Fetch tagged oneOf union member conversion - #145
Merged
adamcavendish merged 1 commit intoAug 19, 2026
Merged
Conversation
Plain inline oneOf members with the discriminator alongside two or more content properties were not recognized by TaggedEnumPattern. They fell back to an untagged Union, so TypeScript camelCase mode emitted cast-through union converters and skipped member field conversion. Add detection for required single-value string enum tag fields on plain object oneOf members with more than two properties, for OAS 3.0, 3.1, and 3.2, and add a nested-request TypeScript camelCase golden test that exercises the generated union converters.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
adamcavendish
deleted the
fix/typescript-fetch-tagged-union-member-conversion
branch
August 19, 2026 08:25
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.
Problem
typescript-fetchgenerated correct camelCase-to-wire converters for each member of a taggedoneOf, but the union converter itself used an unchecked cast. This happened when the taggedoneOfmembers were plain inline objects whose discriminator is a required single-value string enum alongside two or more content properties.TaggedEnumPatternonly recognized internally taggedoneOfmembers wrapped inallOf, so these plain inline members fell back to an untaggedUnion. TypeScript camelCase mode emits cast-through converters for untagged unions, so nested request and response models kept the wrong property spelling.Fix
oneOfvariants for OAS 3.0, 3.1, and 3.2:allOfValidation
cargo fmt --checkpassescargo clippy --libpassescargo test --libpasses (665 tests)cargo test --test golden_tests_typescript_fetch test_property_naming_camel_case_tagged_union_plain_internal_goldenpasses