Description
Hi, thanks for the fantastic library!
I'd like to know about the following use case.
Assuming I have an application that uses a query similar to the listUser
example where users are queried that have a specific type.
query listUsers {
users {
id
type
}
}
In the application, I generated code with ariadne-codegen that looks roughly like this.
class ListUsers(BaseModel):
users: Optional[List["ListUsersUsers"]]
class ListUsersUsers(BaseModel):
id: str
type: UserType
UserType
is an enum with, for example, an INTERNAL
and ADMIN
member.
When a new user type is added to the schema, like EXTERNAL
, and the application fetches users with the latest type, the application will error since the enum does not know the new enum member.
To allow my app to work until support for EXTERNAL
is added, it would be great if I could omit those new users.
pydantic allows that with OnErrorOmit
class ListUsers(BaseModel):
users: Optional[List[OnErrorOmit["ListUsersUsers"]]]
Unfortunately, I couldn't figure out how to create this customization with ariadne-codegen. Using mixins, I could only manipulate ListUsersUsers
but not ListUsers
.
How can I achieve this or something similar with ariadne-codegen? Thanks for your help in advance!