django-ninja-jsonapi¶
django-ninja-jsonapi is a Django Ninja extension for building JSON:API-style REST APIs.
Main concepts¶
- JSON:API semantics: resource objects, relationships, includes, sparse fieldsets, filtering, sorting, pagination, and standardized errors.
- Transparent wrapping:
NinjaJsonAPIautomatically wraps plain Pydantic responses in JSON:API documents and unwraps JSON:API request bodies. - Logical data abstraction: schemas can expose a resource view that differs from raw model structure.
Features¶
- Transparent JSON:API response wrapping and request body unwrapping
- Auto-detected relationships from schema type hints
- Query parsing for
filter,sort,include,fields, andpage - JSON:API error envelopes
- Content-type negotiation (415/406)
Documentation¶
Getting started¶
Usage¶
- Usage overview
- Configuration
- Logical data abstraction
- Model schema
- Include related objects
- Include many-to-many
- Filtering
- Sorting
- Sparse fieldsets
- Pagination
- Content negotiation
- Inflection
- Errors