Skip to content

Conversation

mammothb
Copy link

@mammothb mammothb commented Feb 1, 2025

Description

Currently, if a model is defined as

class Hero(GraphQLQueryBaseModel):
    name: str
    friends: List[str]

calling graphql_fields crashes with

AttributeError: type object 'str' has no attribute 'model_fields'

because the _get_fields is recursively called on the element type which is a primitive and does not have the model_fields attribute.

Changes

  • Check that the list element type is a custom type before recursively calling _get_fields

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