Skip to content

feat(typescript): add toggles to disable generated request/response/error/client options#3837

Open
SM-OliLegg wants to merge 8107 commits into
hey-api:mainfrom
SM-OliLegg:feature/disable-parser-features
Open

feat(typescript): add toggles to disable generated request/response/error/client options#3837
SM-OliLegg wants to merge 8107 commits into
hey-api:mainfrom
SM-OliLegg:feature/disable-parser-features

Conversation

@SM-OliLegg

@SM-OliLegg SM-OliLegg commented Apr 28, 2026

Copy link
Copy Markdown

Ref: #3850

Hi! I want to make @hey-api/typescript output more configurable for teams that prefer minimal generated artifacts. This PR adds controls to reduce generated TypeScript artifacts when needed.

What’s added

  • @hey-api/typescript plugin toggles:
    • requests: false
    • responses: false
    • errors: false
    • clientOptions: false

Why

Some teams only want core schema/definition types. These changes make that output mode configurable.

Included in this PR

  • parser read/write transform updates (readWrite, plus per-variant requests / responses controls)
  • @hey-api/typescript plugin toggles for requests, responses, errors, and clientOptions
  • docs updates for parser and TypeScript plugin configuration
  • a regression test covering the minimal-output configuration end-to-end
plugins: [
  {
    name: "@hey-api/typescript",
    requests: false,
    responses: false,
    errors: false,
    clientOptions: false,
  },
],

SukkaW and others added 30 commits April 22, 2026 00:40
… intersections

When discriminated union members have allOf schemas, they generate ZodIntersection
which does not support .extend(). Detect this case by storing isIntersection: true
in the symbol meta and fall back to z.union() in tryBuildDiscriminatedUnion.

- Add isIntersection field to ZodMeta type
- Set isIntersection: true in intersection() handler of all three walkers
- Set isIntersection: false in union() handler (manual meta) of all three walkers
- Merge ctx.meta with isIntersection flag in processor exportAst calls
- Check querySymbol meta for isIntersection in tryBuildDiscriminatedUnion
- Add test specs and snapshots for the discriminator-allof-member scenario

Agent-Logs-Url: https://github.com/hey-api/openapi-ts/sessions/1c6f992d-8feb-49c9-9cc6-7830259cfe5c
response/request object may become undefined after the changes, but in
our test case we can always assert they do exists.
@SM-OliLegg SM-OliLegg force-pushed the feature/disable-parser-features branch 2 times, most recently from f2e533c to 97fd860 Compare May 20, 2026 08:57
@SM-OliLegg SM-OliLegg force-pushed the feature/disable-parser-features branch from 8afdb97 to 4522ef8 Compare May 20, 2026 08:58

@mrlubos mrlubos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@SM-OliLegg this looks like #3870 on steroids. I can get behind the enabled changes, but not clientOptions. What would happen if you disable it and add a client plugin? Btw I'm pretty sure you can disable ANY output through hooks today, so this pull request is more of a syntax sugar on top of that (which is valid)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 Feature request. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants