Spaces:
No application file
No application file
File size: 1,323 Bytes
b12da69 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime
class ItemCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=200, description="Item name")
description: Optional[str] = Field(None, max_length=2000)
category: Optional[str] = Field(None, max_length=100)
tags: list[str] = Field(default_factory=list)
metadata: dict = Field(default_factory=dict)
model_config = {"json_schema_extra": {"example": {
"name": "Sample Item",
"description": "A sample devops_infra item",
"category": "default",
"tags": ["devops_infra"],
"metadata": {},
}}}
class ItemUpdate(BaseModel):
name: Optional[str] = Field(None, min_length=1, max_length=200)
description: Optional[str] = Field(None, max_length=2000)
category: Optional[str] = None
tags: Optional[list[str]] = None
metadata: Optional[dict] = None
class ItemResponse(BaseModel):
id: str
name: str
description: Optional[str]
category: Optional[str]
tags: list[str]
metadata: dict
created_by: str
created_at: str
updated_at: str
class HealthResponse(BaseModel):
status: str
service: str
version: str
timestamp: str
items_count: int
|