Describe the bug
Trying to use an Optional Pydantic field with a primitive type (like str)
To Reproduce
Steps to reproduce the behavior:
class Foo(GraphQLQueryBaseModel):
name: Optional[str] = None
Foo.graphql_fields()
Exception:
AttributeError: type object 'str' has no attribute 'model_fields'
File graphql_query/base_model.py", line 27, in _get_fields
for f_name, f in model.model_fields.items():
^^^^^^^^^^^^^^^^^^
- Python: 3.12.8
- graphql-query: 1.4.0
- pydantic: 2.10.6