20 lines
705 B
Python
20 lines
705 B
Python
"""Shared error response schemas for the public Secretary API contract."""
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class ApiErrorResponse(BaseModel):
|
|
"""Stable error shape shared with the NestJS API."""
|
|
|
|
model_config = ConfigDict(populate_by_name=True)
|
|
|
|
code: str = Field(description="Machine-readable error code", examples=["NOT_FOUND"])
|
|
message: str | list[str] = Field(description="Human-readable error message")
|
|
error: str = Field(description="Error category")
|
|
status_code: int = Field(
|
|
alias="statusCode",
|
|
description="HTTP status code",
|
|
examples=[404],
|
|
)
|
|
path: str = Field(description="Request path", examples=["/api/tickets/1"])
|