Conversation
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 290c14f The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
There was a problem hiding this comment.
This is a draft PR with zero file changes — there is nothing to review yet. The branch has a single empty "Initial plan" commit identical to main.
The linked issue (#3779) describes operations being dropped when using tag/operation filters on specs with diamond-shaped $ref targets (e.g. PaginatedListItems<ClientResponse>). The angle brackets in the schema name likely cause a lookup failure during $ref resolution in the filtering pass.
Will re-review once code is pushed.
|
TL;DR — Fixes the root cause of URI-encoded Key changes
Summary | 158 files | 3 commits | base: Decode at the source in
|
| File | Removed call |
|---|---|
ref.ts — refToName |
decodeURI(name) → name |
ref.ts — resolveRef |
decodeURI($ref) before path parsing |
path.ts — pathToName |
decodeURI(names.join('-')) → names.join('-') |
2.0.x/parser/schema.ts |
decodeURI(schema.$ref) in parseRef |
3.0.x/parser/schema.ts |
decodeURI(schema.$ref) in parseRef |
3.1.x/parser/schema.ts |
decodeURI(schema.$ref) in parseRef |
schemas/plugin.ts |
Three decodeURI(schema.$ref) calls across draft-04, draft-05, and 2020-12 converters |
ref.ts · path.ts · schemas/plugin.ts
Snapshot updates across types, schemas, and Zod validators
Before:
OneOfAllOfIssueWritablereferenced un-suffixed generic schema types (e.g.GenericSchemaDuplicateIssue1SystemBoolean) and the ZodzOneOfAllOfIssueWritableschema was emitted before its dependencies.
After: References correctly resolve to...Writablevariants, and Zod output reorders declarations sozOneOfAllOfIssueWritableappears after its dependencies.
~150 snapshot files updated with identical one-line $ref and type reference corrections across all client/plugin/Zod snapshot configurations for both 3.0.x and 3.1.x.
New ref-parser tests for generic and unicode names
Before: No test coverage for component names containing
<>or unicode characters through the bundle pipeline.
After: Four new test cases verifyPointerround-tripping and end-to-end bundling for names likePaginatedListItems<ClientResponse>andÜberschrift.
bundle.test.ts · pointer.test.ts
@hey-api/codegen-core
@hey-api/json-schema-ref-parser
@hey-api/nuxt
@hey-api/openapi-ts
@hey-api/shared
@hey-api/spec-types
@hey-api/types
@hey-api/vite-plugin
commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3782 +/- ##
==========================================
- Coverage 40.08% 40.07% -0.02%
==========================================
Files 522 522
Lines 19323 19311 -12
Branches 5767 5766 -1
==========================================
- Hits 7746 7738 -8
+ Misses 9374 9371 -3
+ Partials 2203 2202 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c3a1063 to
290c14f
Compare
There was a problem hiding this comment.
Important
The core fix is correct and well-tested at the ref-parser level, but the PR description is stale (describes the first commit's approach, not the final one) and there are unrelated stylistic changes bundled in.
Summary: The second commit correctly moves URI decoding to the source — the three points in json-schema-ref-parser where entry.hash, entry.pathFromRoot, and pathFromRoot are written into $ref values. This eliminates the need for decodeURI() workarounds scattered across the downstream codebase (schema parsers, refToName, pathToName, resolveRef, schemas plugin). The new ref-parser tests cover both internal refs with generic names (<>) and external refs with unicode names. Snapshot changes are consistent and correct — the OneOfAllOfIssueWritable refs now properly resolve to the ...Writable variants.
One latent edge case to note (not blocking): decodeURI() does not decode URI-reserved characters (#, &, +, =). If a schema name contained any of these, Pointer.join() would encode them via encodeURIComponent() but decodeURI() would leave them encoded. decodeURIComponent() cannot be used here since it would break # in the path. This is acceptable for now since such schema names are extremely rare.
Task list (9/9 completed)
- Read diff TOC and identify key areas of change
- Review core logic changes (ref.ts, path.ts, schema parsers)
- Review json-schema-ref-parser changes (bundle.ts, dereference.ts, tests)
- Review schemas plugin changes
- Review snapshot changes for correctness
- Review changeset
- Verify decodeURI vs decodeURIComponent concern
- Self-critique and finalize review
- Submit review

When filtering by tags or operations, operations whose response schemas had names containing URL-unsafe characters (e.g. generic types like
PaginatedList<ClientItem>) were silently dropped from the output.Root cause
The JSON schema ref-parser's
url.resolve()uses theURLconstructor, which percent-encodes characters like<and>in hash fragments. A$refof#/components/schemas/PaginatedList<ClientItem>becomes#/components/schemas/PaginatedList%3CClientItem%3Ein the bundled spec.buildGraphstores the encoded form as the dependency pointer, butbuildResourceMetadatabuilds schema keys from direct object traversal (no encoding). IngetDependencies, the encoded name producedschema/PaginatedList%3CClientItem%3E— which never matchedschema/PaginatedList<ClientItem>inresourceMetadata.schemas.collectOperationsthen saw an unresolvable dependency and skipped the operation entirely.Without filters,
filterSpecis never called, so this mismatch was invisible.Changes
packages/shared/src/openApi/shared/graph/meta.ts— applydecodeURI()to the name extracted from each transitive dependency pointer before constructing the namespace key, consistent with howrefToName()works elsewhere.packages/shared/src/openApi/shared/graph/__tests__/meta.test.ts— new tests covering:getDependenciesproducing decoded keys when the graph contains URL-encoded$refpointers