Warning: This is a pre-release of Django Ninja V1
This is the last change before 1.x release
This version introduces a new cleaner way to mark requests parameters
f.e.
def some_form(request, data: Form[SomeSchema]):
...
instead of
def some_form(request, data: SomeSchema = Form(...)):
...
This syntax looks cleaner/short and has the same code completion hints in popular editors.
On the other hand the old syntax is still supported so you can easy port your project to a newer django-ninja version
Bug changes and improvements
- Forbid extra by @nofalx in #863
- Add a test for list query params by @marius-mather in #852
- (docs) Fix typo in path-params.md by @dipbazz in #854
- (docs) Fix note to be admonitions in query-params.md by @dipbazz in #855
What's new in 1.x
- async authentication fully supported on all layers
- CSRF is now automatic on Cookie based authentication ( now you should be able to combine multiple cookie/header/etc authenticators and play around with csrf logic)
- Pydantic2 - which has a core re-written in Rust and includes a lot of improvements and features like:
- Safer types.
- Better extensibility.
- Better performance - so far on few projects that I tested getting average 10% speed improvements (some particular views which do lot of validations should get pretty good bumps)
- schema validators/resolvers now have extra context (like request)
- Pagination class accepts a request object
- Support for
Annotated[]
syntax - allow adding routers by string path instead of explicit import
Unfortunately Django ninja integrates very deep into pydantic core with Schema class, so it is not possible to keep both pydantic v1 and v2 supported - and that is why ninja now bumps to version 1 which might have few deprecations or breaking changes on pydantic level
From Django ninja side I'm trying to make this upgrade as smooth as possible, if you use standard APIs without lot of magic - most likely upgrade should be without any code change
New Contributors
- @marius-mather made their first contribution in #852
- @dipbazz made their first contribution in #854
- @nofalx made their first contribution in #863
Full Changelog: v1.0b1...v1.0b2