app-sre / qenerate

Code Generator for GraphQL Query and Fragment Data Classes
Apache License 2.0
10 stars 7 forks source link

Reduce boilerplate #75

Closed fishi0x01 closed 1 year ago

fishi0x01 commented 1 year ago

Use a common base class for all generated classes, thus removing the need to declare the pydantic config in every class.

class ConfiguredBaseModel(BaseModel):
    class Config:
        smart_union=True
        extra=Extra.forbid

class GeneratedClass(ConfiguredBaseModel):
    ...