datamodel-codegen \
--input schema.graphql \
--input-file-type graphql \
--output models.py \
--output-model-type pydantic_v2.BaseModel \
--target-pydantic-version 2.11 \
--use-annotated \
--field-constraints \
--snake-case-field \
--use-serialization-alias \
--use-schema-description \
--graphql-no-typename \
--class-name-prefix Linear \
--enable-command-header \
--enable-faux-immutability \
--enable-version-header \
--use-generic-base-class \
--use-double-quotes
Traceback (most recent call last):
File "/Users/eimantas.gecas/git/hologen-core/infrastructure/hgctl/src/hgctl/types/linear/models.py", line 30252, in <module>
class LinearCustomerNeedNotification(LinearEntity, LinearNode, LinearNotification):
...<183 lines>...
]
File "/Users/eimantas.gecas/git/hologen-core/infrastructure/hgctl/.venv/lib/python3.13/site-packages/pydantic/_internal/_model_construction.py", line 155, in __new__
cls = cast('type[BaseModel]', super().__new__(mcs, cls_name, bases, namespace, **kwargs))
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen abc>", line 106, in __new__
TypeError: Cannot create a consistent method resolution order (MRO) for bases LinearEntity, LinearNode, LinearNotification
Using Linear's schema (https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference)
schema.json
Command:
Running:
Yields:
The problem can be fixed by restructuring the class from:
To: