3 ms·
Glad you like the idea! Actually, returning a Pydantic model directly isn't mandatory—it's just a recommended and convenient approach to ensure automatic data
by mr_Fatalyst 2y ago
Glad you like the idea!
Actually, returning a Pydantic model directly isn't mandatory—it's just a recommended and convenient approach to ensure automatic data validation and documentation.
If you prefer, you can keep your existing route handlers as-is, returning dictionaries or other JSON-serializable objects. FastOpenAPI will handle these just fine. But using Pydantic models provides type safety and cleaner docs out of the box.