Skip to content

Fix decoding when argument-derived aliases change - #222

Open
keilogic wants to merge 1 commit into
maticzav:mainfrom
keilogic:fix-argument-alias-decode
Open

Fix decoding when argument-derived aliases change#222
keilogic wants to merge 1 commit into
maticzav:mainfrom
keilogic:fix-argument-alias-decode

Conversation

@keilogic

Copy link
Copy Markdown

Summary

  • fall back to a unique field-signature alias when the exact argument-derived alias is missing during decoding
  • add a regression test for selections whose argument value changes between query construction and response decoding

Why

SwiftGraphQL computes field aliases from argument values. A selection closure can be evaluated once to build the query and again to decode the response. If an argument value is dynamic, such as Meeting.nowString(), the second evaluation can produce a different alias and make decoding miss the server response even though the response matches the sent query.

The fallback only applies when exactly one response key has the same field signature, so existing exact alias decoding and ambiguous same-field selections keep their current behavior.

Fixes #197.

Verification

  • git diff --check
  • Not run: swift test because Swift is not installed in this Windows environment.

Suggested release type: patch.

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.

using args causes error in response

1 participant