pydantic-response-models¶
Standard API response DTOs using Pydantic. Framework-agnostic.
Installation¶
pip install pydantic-response-models
Public API¶
Class |
Purpose |
|---|---|
|
Generic success wrapper ( |
|
Error detail model ( |
|
Standard error response ( |
|
Pagination wrapper ( |
|
Simple message DTO |
Field factories¶
Function |
Purpose |
|---|---|
|
Pydantic |
|
Pydantic |
Usage¶
from pydantic_response_models import SuccessResponse, PaginatedResponse
response = SuccessResponse(data={"id": 1}, message="created")
paginated = PaginatedResponse(items=[...], total=50, page=1, page_size=10)