Skip to content

refactor: resolver node type#3907

Merged
mrlubos merged 1 commit into
mainfrom
refactor/types-resolver-nodes
May 18, 2026
Merged

refactor: resolver node type#3907
mrlubos merged 1 commit into
mainfrom
refactor/types-resolver-nodes

Conversation

@mrlubos
Copy link
Copy Markdown
Member

@mrlubos mrlubos commented May 18, 2026

No description provided.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@mrlubos mrlubos marked this pull request as ready for review May 18, 2026 15:55
@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment May 18, 2026 3:56pm

Request Review

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. internal ⚙️ Internal development work. labels May 18, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

🦋 Changeset detected

Latest commit: 3aabff2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hey-api/shared Patch
@hey-api/openapi-python Patch
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

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

Note

Type-only refactor. Structural shape of every resolver context is unchanged, so existing call sites that construct { nodes: { ... } } continue to satisfy the new interface inheritance without modification.

TL;DR — Extracts the duplicated nodes property from every *ResolverContext interface into a shared Plugin.ResolverNodes<T> wrapper exported from @hey-api/shared, so each resolver context now extends BaseContext, Plugin.ResolverNodes<{ ... }> instead of redeclaring the property inline.

Key changes

  • Add Plugin.ResolverNodes<T> to the shared Plugin namespace — single source of truth for the nodes shape used by validator/type/faker/pydantic resolvers, including the centralized JSDoc.
  • Convert resolver contexts to interface extensionpydantic, @hey-api/typescript, @faker-js/faker, valibot, and zod resolver context interfaces drop their inline nodes: { ... } in favor of Plugin.ResolverNodes<{ ... }>.
  • Changeset — patch bump on @hey-api/shared noting the new export.

Summary | 7 files | 1 commit | base: mainrefactor/types-resolver-nodes


Centralized nodes shape via Plugin.ResolverNodes<T>

Before: Every *ResolverContext redeclared nodes: { ... } inline with its own copy of the "Nodes used to build different parts of the result." JSDoc.
After: Plugin.ResolverNodes<T> carries the nodes: T field and its doc comment once; contexts express the shape by extending it.

Per-node JSDoc (Returns the base ..., Returns the literal type for const values., etc.) is preserved on each entry of the T map. Runtime semantics are unchanged — the produced type is structurally identical to the previous inline form, so consumers in */v{1,2,3,4}/toAst/*.ts and api.ts that build context objects with a nodes field continue to type-check without edits.

packages/shared/src/plugins/types.ts · packages/openapi-ts/src/plugins/zod/resolvers.ts · packages/openapi-ts/src/plugins/valibot/resolvers.ts · packages/openapi-python/src/plugins/pydantic/resolvers.ts

Pullfrog  | View workflow run | Using Claude Opus𝕏

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 18, 2026

Open in StackBlitz

@hey-api/codegen-core

npm i https://pkg.pr.new/@hey-api/codegen-core@3907

@hey-api/json-schema-ref-parser

npm i https://pkg.pr.new/@hey-api/json-schema-ref-parser@3907

@hey-api/nuxt

npm i https://pkg.pr.new/@hey-api/nuxt@3907

@hey-api/openapi-ts

npm i https://pkg.pr.new/@hey-api/openapi-ts@3907

@hey-api/shared

npm i https://pkg.pr.new/@hey-api/shared@3907

@hey-api/spec-types

npm i https://pkg.pr.new/@hey-api/spec-types@3907

@hey-api/types

npm i https://pkg.pr.new/@hey-api/types@3907

@hey-api/vite-plugin

npm i https://pkg.pr.new/@hey-api/vite-plugin@3907

commit: 3aabff2

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.73%. Comparing base (9634280) to head (3aabff2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3907   +/-   ##
=======================================
  Coverage   37.73%   37.73%           
=======================================
  Files         582      582           
  Lines       20837    20837           
  Branches     6059     6066    +7     
=======================================
  Hits         7862     7862           
  Misses      10567    10567           
  Partials     2408     2408           
Flag Coverage Δ
unittests 37.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrlubos mrlubos merged commit 216ed84 into main May 18, 2026
12 checks passed
@mrlubos mrlubos deleted the refactor/types-resolver-nodes branch May 18, 2026 15:59
@hey-api hey-api Bot mentioned this pull request May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal ⚙️ Internal development work. size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant