Repository navigation
[typescript-operations] test: reproduce @oneOf input emitted as interface with declarationKind 'interface' (failing) (#10996) - #10998
Merged
Conversation
|
4 tasks done
eddeee888
added this pull request to stack #11002
September 29, 2026 12:53
eddeee888
force-pushed
the
claude/magical-ptolemy-47ugru
branch
from
September 29, 2026 12:54
3e35329 to
e59347b
Compare
eddeee888
marked this pull request as ready for review
September 29, 2026 13:10
…rationKind 'interface' With `declarationKind: 'interface'`, typescript-operations emits a multi-field @OneOf input as `export interface FooInput { ... } | { ... }`, which is invalid TypeScript. The test asserts the expected type alias and currently fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TsaydotU8AFHMT1P4MEfra eddeee888:oss:issue-verify
eddeee888
force-pushed
the
claude/magical-ptolemy-47ugru
branch
from
September 29, 2026 13:17
e59347b to
86f763e
Compare
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.
Description
This PR adds a failing test that reproduces the bug reported in #10996, as a checkpoint before the fix. It adds only the test, not a fix.
With
declarationKind: 'interface'and noimportSchemaTypesFrom,typescript-operationsemits a multi-field@oneOfinput as aninterfacefollowed by a union. That isn't valid TypeScript. The shared base types visitor invisitor-plugin-common, which thetypescriptplugin uses, already forces a type alias in this case (#8586). The operations visitor has its own copy of the oneOf branch without that fallback (packages/plugins/typescript/operations/src/visitor.ts,InputObjectTypeDefinition).The new test,
generates @oneOf input as a type alias when declarationKind is interfaceinpackages/plugins/typescript/operations/tests/ts-documents.standalone.input.spec.ts, expects the type alias. It currently fails on the inline snapshot:The fix will be built directly on top of this commit. This PR doesn't need to merge, or go green, first.
Related #10996
Type of change
Screenshots/Sandbox (if appropriate/relevant):
Reporter's repro: https://stackblitz.com/github/jakubwawrzyczek/codegen-oneof-repro
How Has This Been Tested?
master)🤖 Generated with Claude Code
https://claude.ai/code/session_01TsaydotU8AFHMT1P4MEfra