diff --git a/src/models/request.py b/src/models/request.py new file mode 100644 index 0000000..9f68359 --- /dev/null +++ b/src/models/request.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict, Any, List +from pydantic import BaseModel, Field + + +class RequestValidation(BaseModel): + body: Optional[Dict[str, Any]] = Field( + default=None, + description="JSON Schema for request body validation" + ) + query: Optional[Dict[str, Any]] = Field( + default=None, + description="Query parameter validation rules" + ) + headers: Optional[Dict[str, Any]] = Field( + default=None, + description="Header validation rules" + ) + path: Optional[Dict[str, Any]] = Field( + default=None, + description="Path parameter validation rules" + ) + + class Config: + json_schema_extra = { + "example": { + "body": { + "type": "object", + "required": ["name", "email"], + "properties": { + "name": {"type": "string", "minLength": 1}, + "email": {"type": "string", "format": "email"} + } + }, + "query": { + "type": "object", + "properties": { + "page": {"type": "integer", "minimum": 1}, + "limit": {"type": "integer", "minimum": 1, "maximum": 100} + } + } + } + }