You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The generated IssueFieldsAuthor type includes a required __typename field that is not included in the generated query, causing a validation error.
The generated IssueFields type contains an author field of type Optional["IssueFieldsAuthor"] that somehow seems to be undefined at instantiation, yielding the following error:
pydantic.errors.PydanticUserError: `GetIssue` is not fully defined; you should define `GetIssueNodeNode`, then call `GetIssue.model_rebuild()`
The first issue disappears when including __typename in the generated query (in the client get_issue method).
The second issue disappears when defining IssueFieldsAuthor before IssueFields in fragments.py.
It Looks like we omit artificially added __typename in all fragment strings.
In the latest release we removed all model_rebuild calls. I tested this change with fragments, but it seems that the issue only occurs for nested fragments. We need to restore some of the removed model_rebuild calls.
I will create a separate issue with a more accurate description for the 1. issue and let's keep the current one for 2.
Description
Pydantic types are incorrectly defined when fragments contain nested nodes.
Example:
There are two issues in the last case.
IssueFieldsAuthor
type includes a required__typename
field that is not included in the generated query, causing a validation error.IssueFields
type contains anauthor
field of typeOptional["IssueFieldsAuthor"]
that somehow seems to be undefined at instantiation, yielding the following error:The first issue disappears when including
__typename
in the generated query (in the clientget_issue
method).The second issue disappears when defining
IssueFieldsAuthor
beforeIssueFields
infragments.py
.Reproduction
Use the GitHub schema.
Generate the types with
ariadne-codegen
.Run the following:
Environment
Python 3.11.6
The text was updated successfully, but these errors were encountered: