Skip to content

Propagate isParameterType through input-only types #393

Draft
braeden wants to merge 3 commits into
developfrom
braedens/readonly-input-only-types
Draft

Propagate isParameterType through input-only types #393
braeden wants to merge 3 commits into
developfrom
braedens/readonly-input-only-types

Conversation

@braeden
Copy link
Copy Markdown
Contributor

@braeden braeden commented May 5, 2026

FLUP on #392

Apply the approach in #392 recursively to all types that are solely marked as inputs. Again, this is not an API break since it widens the contract for consumers interacting with TS clients.

This is still not as full-fledged as as the readonlyInterfaces gradle flag & requires another recursive pass through the types.

Testing

In the large service I ran this against (across 3x different modules), we converted ~25% of the array types emitted in the repo into ReadonlyArray, this is a big difference for the surface area of callers and the need to mutably cast.

  ┌────────┬───────────────┬────────────────┬──────────┐                                                                                                                                             
  │ Module │ Substitutions │ Total list/set │ Coverage │
  ├────────┼───────────────┼────────────────┼──────────┤                                                                                                                                             
  │ _      │           360 │           1435 │      25% │                                                                                                                                             
  ├────────┼───────────────┼────────────────┼──────────┤                                                                                                                                             
  │ _      │            52 │            201 │      26% │                                                                                                                                             
  ├────────┼───────────────┼────────────────┼──────────┤
  │ _      │             8 │             44 │      18% │                                                                                                                                             
  ├────────┼───────────────┼────────────────┼──────────┤    
  │ Total  │           420 │           1680 │      25% │
  └────────┴───────────────┴────────────────┴──────────┘

@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented May 5, 2026

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Propagate isParameterType through input-only types

Check the box to generate changelog(s)

  • Generate changelog entry

Walk all endpoints to classify each referenced type as input-position,
output-position, or both (transitively through fields/members/aliases).
Types reachable only from inputs are emitted with isParameterType=true,
so list/set fields become ReadonlyArray<T>. Types used in both
positions or output-only keep the existing shape.

Stacks on top of #392 (readonly endpoint params), which provides the
isParameterType -> ReadonlyArray<T> behaviour in resolveTsType.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@braeden braeden force-pushed the braedens/readonly-input-only-types branch from bbc12ff to 0286d2b Compare May 5, 2026 01:22
Braeden Smith and others added 2 commits May 4, 2026 21:25
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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