Skip to content

fix(codegen): keep deprecated fields required in split response types - #225

Merged
antonzherdev merged 1 commit into
mainfrom
fix/split-types-keep-deprecated-required
Nov 6, 2026
Merged

antonzherdev merged 1 commit into
mainfrom
fix/split-types-keep-deprecated-required

Conversation

@antonzherdev

Copy link
Copy Markdown
Contributor

#218 relaxes deprecated fields of response-only types, and keeps them required in types also used in requests. A type whose request and response shapes differ is split by consolidation into a::input::X and a::output::X, and the output copy counted as response-only. It is still a type used in requests, though. Clients often read a value and send it back, and in TypeScript an output::X passed where input::X is expected stopped type-checking, because the deprecated field was ?: in one and required in the other. A large API built against 0.24.0-alpha.2 hit this when copying a business rule's schema from a read into an insert.

The transform now skips an output copy whose input twin is in the request types. It finds the twin by the naming consolidate_types uses. An output module without a twin is still an ordinary response type.

In the same API, all five other relaxed fields are on response-only types, so they stay relaxed.

The reflectapi_deprecation_dates snapshots go back to required fields, because that fixture's types are both Input and Output. The field-presence Profile fixture still covers relaxing in all four generators.

Testing: new unit test the_response_copy_of_a_split_type_keeps_deprecated_fields, the full workspace tests, the field-presence suites (Rust, TypeScript and Python) and the Python demo regen with no drift.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q7zEtTUpmxtYWDkuq6uwpY

A type whose request and response shapes differ is split into input::X
and output::X. The output copy is still a type used in requests, and
clients send back what they read, so relaxing its deprecated fields broke
code passing an output value where the input type is expected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7zEtTUpmxtYWDkuq6uwpY

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

📖 Documentation Preview: https://reflectapi-docs-preview-pr-225.partly.workers.dev

Updated automatically from commit 58cbd62

@antonzherdev
antonzherdev merged commit 9c379da into main Nov 6, 2026
11 checks passed
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