Repository navigation
fix: transform falsy scalars and resolve root and nested fragment aliases - #272
Merged
Merged
Conversation
…ases - Apply custom scalar transforms to 0, false and empty strings, not only truthy values - Resolve aliased root query and mutation fields instead of throwing - Resolve aliases from fragments spread before their definition and from fragments spread on the root type - Remove leftover eslint-disable comments and import from graphql directly
Root fields now resolve aliases, so with one alias map shared by all operations a root alias in one operation renamed an unaliased root field of the same name in another one. Keep an alias map per named operation, pass the operation name from getSdkWrapper, and keep root fields of the schema unchanged when no operation name is given.
gastrobot
pushed a commit
that referenced
this pull request
Nov 14, 2026
# [2.3.0](v2.2.0...v2.3.0) (2026-11-14) ### Features * transform falsy scalars and resolve root and nested fragment aliases ([#272](#272)) ([4070479](4070479))
|
🎉 This PR is included in version 2.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three bugs in the response transform. Each has a regression test in
test/transform.test.ts, and all of them fail on the currentmain.Falsy scalar values were not transformed.
transform()skipped any falsy value, so a custom scalar with0,falseor""came back raw. For example,prices: [0, 5]returned[0, { cents: 5 }]. Now onlynullandundefinedare passed through.Aliased root fields threw.
query { myItem: item { … } }failed withQuery myItem not found. Root query and mutation fields now resolve their alias, using the shared mapping.Fragment aliases depended on document order. A fragment that spreads another fragment defined later lost that fragment's aliases (
Field cost not found in type Item). Fragments now resolve on first use. A fragment spread on the root type also built a broken.aliaspath; that is fixed too.Aliases are resolved per operation. Since root fields now go through the alias map, a root alias in one operation (
mutation { item: updateItem }) would otherwise rename an unaliaseditemin another operation.getSdkWrappernow passes the operation name, andaddCustomScalarstakes it as an optional third argument. Without a name, the merged map is used as before, and root fields that exist in the schema are kept as they are. This also fixes nested alias collisions between operations when the name is passed.README: notes that union and interface selections need
__typename.Cleanup: removes the leftover
eslint-disablecomments and imports fromgraphqlinstead ofgraphql/typeandgraphql/index.This is the first release through npm trusted publishing (#270).
🤖 Generated with Claude Code