Skip to content

fix: resolve inter-fragment ref dependencies in object type building#12

Open
trezy wants to merge 1 commit intobigmoves:mainfrom
gamesgamesgamesgamesgames:fix/inter-fragment-ref-deps
Open

fix: resolve inter-fragment ref dependencies in object type building#12
trezy wants to merge 1 commit intobigmoves:mainfrom
gamesgamesgamesgamesgames:fix/inter-fragment-ref-deps

Conversation

@trezy
Copy link
Contributor

@trezy trezy commented Feb 8, 2026

Summary

  • Fragment refs (e.g., defs#release and defs#releaseDate) were built in a single pass sorted alphabetically. When one fragment depended on another that came later alphabetically, the ref lookup failed and fell back to [String!] instead of the correct object type.
  • Replaced the single-pass fold with a multi-pass build so that types built in earlier passes are available for resolution in subsequent passes.
  • Added a regression test reproducing the exact scenario.

Test plan

  • All 258 existing + new tests pass (gleam test)
  • Create a lexicon with a defs file containing two object types where one references the other via an array of refs (e.g., parent with children: { type: "array", items: { type: "ref", ref: "com.example.defs#child" } } and child with string properties). The dependent type must sort alphabetically before its dependency (e.g., parent before parentDetail). Query the nested field with a selection set and confirm it resolves to the object type rather than erroring with type "[String!]" has no subfields.

Fragment refs (e.g., defs#release and defs#releaseDate) were built in a
single pass sorted alphabetically. When one fragment depended on another
that came later alphabetically, the ref lookup failed and fell back to
[String!]. Use multiple passes so types built in earlier passes are
available for subsequent ones.
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.

1 participant