My code looks a bit like this:
class Error(BaseModel):
id: uuid.UUID
code: int
def __init__(self, code: int) -> None:
self.id = uuid.uuid4()
self.code = code
super().__init__(id=self.id, code=code)
This errors out with:
AttributeError: ‘Error’ object has no attribute ‘pydantic_fields_set‘
I just don’t want to have the boilerplate of generating the UUID each time I create a new Error(), plus… it should be the Error class’ responsibility to instantiate its own UUID.
I’m not sure what I’m doing wrong.