I have the following models:
class BaseMessage(BaseModel):
"""
Base schema for returning a ACK/NACK response.
"""
origin: str = settings.APP_ORIGIN_NAME
message: str
class Success(BaseMessage):
"""
API schema for returning a Success response.
"""
id: str
temp_password: Optional[str] | None
class ACK(BaseModel):
"""
API schema for returning an ACK response.
"""
ACK: Success
and in my endpoint, I have this:
ack_message = ACK(
message=success_text,
id=domain_id,
temp_password=instance.domain_hashed_password,
)
return JSONResponse(
status_code=status.HTTP_201_CREATED,
content=jsonable_encoder(ack_message),
)
I keep getting an
ACK
field required (type=value_error.missing)
message, which is not clear to me why as I am providing all the fields. Well at least I think I am.