Ninja Extra Schema
The integration of Django-Ninja with Pydantic is one of the best features of Django-Ninja. With Pydantic, you can validate the data flowing in and out of your API, and it is very fast. It can partially replace DRF serializers.
But if you want to completely replace DRF serializers, then what you need is Ninja-Schema.
Ninja Schema
Ninja Schema converts your Django ORM models into Pydantic schemas that support more Pydantic features.
Inspiration: django-ninja and djantic
Key Features:
- Custom Field Support: Ninja Schema converts Django models to native Pydantic types, which allows you to get fast field validation directly. Examples include enums, emails, IP addresses, URLs, JSON, etc.
- Field Validators: Fields can be validated using model_validator just like Pydantic's validator or root_validator.
Info
Visit Ninja Schema for more information
Accessing the Request Object in Schemas
Django Ninja Extra provides a RouteContext object that is available during the request lifecycle.
Comments
本文总阅读量次
