IFC-2536: Update generate return types to inject typename into schema#997
Open
solababs wants to merge 1 commit intoinfrahub-developfrom
Open
IFC-2536: Update generate return types to inject typename into schema#997solababs wants to merge 1 commit intoinfrahub-developfrom
solababs wants to merge 1 commit intoinfrahub-developfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## infrahub-develop #997 +/- ##
=================================================
Coverage 81.43% 81.44%
=================================================
Files 134 134
Lines 11359 11365 +6
Branches 1703 1705 +2
=================================================
+ Hits 9250 9256 +6
Misses 1566 1566
Partials 543 543
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
ogenstad
reviewed
May 7, 2026
Contributor
ogenstad
left a comment
There was a problem hiding this comment.
Good find! Is this a bug that should be reported to ariadne-codegen? I'm wondering if it might be fixed in a later version since the one we've pinned is a bit old.
Could be worth to upgrade to see if it resolves the issue, other than that based on the added code can we have some test that would fail if we removed this inject_typename?
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.
Why
infrahubctl generate return-typesfails with aTypeErrorwhen the schema contains interface or union types. The root cause is inariadne-codegen: it automatically injects__typenamewhen generating models for abstract-typed fields, then looks up__typenameinschema.type_map. Since__typenameis a built-in meta-field and not a schema-defined field, the lookup misses and the codegen fallback tries to create a newGraphQLScalarType("String")— which raisesTypeErrorbecause"String"is a reserved built-in scalar name ingraphql-core.This makes
generate return-typesunusable for any Infrahub schema that uses interfaces (which most real schemas do).What changed
infrahubctl generate return-typesnow succeeds on schemas with interface or union types. Previously it raisedTypeError: Duplicate type "String".