Releases: vitalik/django-ninja
0.22.1
0.22.0
What's Changed
- ModelSchema now support config.model_fields_optional to mark some or specific fields to be not required in schema
- Implement rudimentary support for async auth by @kjagiello in #735
- Allow to extend additional info key, value to OpenAPI Info section by @chenatlas in #715
- fix typo by @quique in #706
- api_operation is better described as a decorator by @quique in #707
- Added a section detailing how to reverse a url for the api docs page. by @SunsetOrange in #714
- Fix missing openapi endpoints by @rednaks in #731
- Add Django 4.2 support in
pyproject.toml
by @baseplate-admin in #736 - Added missing space by @TheHippo in #737
- fix: allow default example to be included in pagination output in generated API docs. by @jkeyes in #728
- Fix kwargs typing by @SmileyChris in #745
- Only title-case fields in schema if all lowercase verbose name by @SmileyChris in #748
- fix: paginate typo by @MrEcho92 in #752
- feat: add JSON encoding support for IPv4Address and IPv6Address by @jkeyes in #729
- Enable exception_handler to handle Pyright's strict mode by @paulzakin in #762
- Make optional field of UploadedFile optional by @karlosss in #766
New Contributors
- @quique made their first contribution in #706
- @SunsetOrange made their first contribution in #714
- @rednaks made their first contribution in #731
- @TheHippo made their first contribution in #737
- @jkeyes made their first contribution in #728
- @MrEcho92 made their first contribution in #752
- @paulzakin made their first contribution in #762
- @karlosss made their first contribution in #766
- @andZibralabs made their first contribution in #695
- @kjagiello made their first contribution in #735
- @chenatlas made their first contribution in #715
Full Changelog: v.0.21.0...v0.22.0
0.21.0
What's Changed
- Somewhat advanced filtering with FilterSchema by @l1b3r in #673
- Support both new and old style Union/Optional by @gvangool in #687
- Allow reversing URLs with multiple operations. by @strange in #638
- feat: openapi schema improvements by @aliereno in #504
- Fix #666: Support auth inheritance for routers by @aasiffaizal in #667
- improve error message in export_openapi_schema by @taobojlen in #653
- Add source maps for Redoc and Swagger UI by @chris-mcdo in #676
- Include information about Django 4.1 async ORM by @geeshta in #578
- Update crud.md by @Trystanr in #688
- Add a recipe for handling the file uploads by @barseghyanartur in #663
- [Docs] remove broken link by @GTorreil in #647
- Fix links to favicon in CDN templates by @stephane in #636
New Contributors
- @geeshta made their first contribution in #578
- @GTorreil made their first contribution in #647
- @barseghyanartur made their first contribution in #663
- @aasiffaizal made their first contribution in #667
- @taobojlen made their first contribution in #653
- @l1b3r made their first contribution in #673
- @strange made their first contribution in #638
- @chris-mcdo made their first contribution in #676
- @Trystanr made their first contribution in #688
- @gvangool made their first contribution in #687
- @aliereno made their first contribution in #504
Full Changelog: v0.20.0...v.0.21.0
0.20.0
What's Changed
- Speedup code reload by @hiaselhans in #624
- Added a support for openapi ServerObject by @Vaiders in #574
- Fix url_namespace -> urls_namespace msg by @SmileyChris in #519
- add --sorted flag to export_openapi_schema by @hiaselhans in #571
- Set correct media type in docs for custom renderer by @Svenito in #598
- Update swagger UI to 4.14.0 by @kabell in #553
Documentation
- Shuffle doc files around by @vpoulailleau in #543
- Fix README link to "async support" by @denizdogan in #545
- Add repository url in
pyproject.toml
by @baseplate-admin in #563 - Set up doc search by @tssujt in #572
Misc
- remove python 3.6 by @hiaselhans in #625
- Bump actions/checkout from 2 to 3 by @dependabot in #411
- Bump actions/setup-python from 2 to 4 by @dependabot in #493
- Fix failing
flit
build by @baseplate-admin in #564
New Contributors
- @vpoulailleau made their first contribution in #543
- @denizdogan made their first contribution in #545
- @baseplate-admin made their first contribution in #563
- @hiaselhans made their first contribution in #571
- @Svenito made their first contribution in #598
- @Vaiders made their first contribution in #574
- @kabell made their first contribution in #553
Full Changelog: v0.19.1...v0.20.0
0.19.1
What's Changed
- Declare the AuthenticationError exception class in all by @duducp in #489
- Small fix for many2many payloads to allow passing primary keys for model fields
Documentation
- Docs restructure by @SmileyChris in #334
- Add documentation on the
.from_orm
method by @cltrudeau in #503 - Added mutiple items example by @ihelmer07 in #509
New Contributors
- @cltrudeau made their first contribution in #503
- @ihelmer07 made their first contribution in #509
Full Changelog: v.0.19.0...v0.19.1
0.19.0
What's Changed
- docs decorator by @vitalik in #488
- Allow arbitrary Pagination Output ( alternative #464 @rafonseca ) by @vitalik in #483
- Update Redoc related documents by @tssujt in #462
- Improves authentication validation to throw an exception by @duducp in #454
- Add TestClient note to multiple APIs warning by @srcreigh in #416
- Implement implicit reverse url name generation by @SmileyChris in #361
- Also pass the router to
get_operation_url_name
by @SmileyChris in #486
- Also pass the router to
- [feat] add superuser session authentication only by @areski in #351
New Contributors
- @tssujt made their first contribution in #462
- @duducp made their first contribution in #454
- @srcreigh made their first contribution in #416
- @areski made their first contribution in #351
Full Changelog: v.0.18.0...v.0.19.0
0.18.0
Hello
Please welcome the new Django Ninja version
it has lot of fixes and improvements
Most notable a HttpResponse typed argument by @SmileyChris
Now you can manage response behaviour (cookies, headers, streaming) flixible:
@api.post("/boop")
def boop(request, response: HttpResponse): # !
response.set_cookie("beep", "boop") # !
return True
All changes
- Provide a temporal HttpResponse typed argument to views by @SmileyChris in #336
- UploadedFile inherit from Django's UploadedFile by @OtherBarry in #400
- Allow path parameters to be specified at router level by @kaschnit in #369
- Added support for postgress specific fields to Model Schema #353
- Fixed openapi/pydantic versions compatibility #418
- pre-commit config by @SmileyChris in #364
- Access to test response attributes by @stephane in #402
- Small optimization and typing improvements by @SmileyChris in #367
- Minor typo in tutorial by @stephane in #387
- Specify mypy in CONTRIBUTING.md by @OtherBarry in #401
- ConfigError: ModelSchema classes requires a 'Config' subclass by @sebastian-philipp in #382
- Fix a typing issue by @HoJin9622 in #404
- Fix a few typos by @dy3l in #426
- Add Redoc support by @kxxoling in #427
- Fix typo in docs by @sho918 in #432
- Handle class instances in
signature.details.is_collection_type
by @flaeppe in #434 - Upgrade versions of pre-commit hooks by @flaeppe in #435
New Contributors
- @kaschnit made their first contribution in #369
- @stephane made their first contribution in #387
- @OtherBarry made their first contribution in #400
- @sebastian-philipp made their first contribution in #382
- @HoJin9622 made their first contribution in #404
- @dy3l made their first contribution in #426
- @kxxoling made their first contribution in #427
- @sho918 made their first contribution in #432
- @flaeppe made their first contribution in #434
Full Changelog: v0.17.0...v0.18.0
0.17.0
This release brings few long awaited features:
Smarter schema
Now you can access orm instance attributes inside schema with resolvers:
class TaskSchema(Schema):
title: str
is_completed: bool
owner: Optional[str]
lower_title: str
@staticmethod
def resolve_owner(obj): # <------- !!!!!!
if not obj.owner:
return
return f"{obj.owner.first_name} {obj.owner.last_name}"
def resolve_lower_title(self, obj): # <-------- !!!!!!
return self.title.lower()
Field aliases now support django template variables dotted syntax:
class TaskSchema(Schema):
...
last_comment: str = Field(..., alias="comment_set.0.text")
Thanks to @SmileyChris
Pagination output
Now default paginated output returns a dict with items
and count
You can now override both input and output schemas for custom pagination:
class CustomPagination(PaginationBase):
class Input(Schema):
page: int
class Output(Schema):
items: List[Any]
total_pages: int
current_page: int
def paginate_queryset(self, queryset, pagination: Input, **params):
return {
'items': ...,
'total_pages': ...,
'current_page': ...,
}
All updates:
- Improved pagination by @vitalik
- Smarter schema that handles dotted aliases and resolver methods by @SmileyChris #317
- Add support for union type in payload by @AkeemMcLennon #301
- Export OpenAPI schema management cmd by @stefanitsky #288
- First key derivation optimization by @mom1 #344
**kwargs
not required anymore for pagination by @mom1 #285
New Contributors
Full Changelog: v0.16.2...v0.17.0
0.16.2
- Pydantic 1.9.0 support #310 by @antonrh
- Fix params descriptions visualization in swagger ui #331 by @ldbenitez
- Improve TestClient json argument-serialization #315 by @johnbergvall
- Add python 3.10 to test matrix #273 by @jairhenrique
- Automate github actions update. #274 by @jairhenrique
Many documentaion fixes and improvements by:
0.16.1
- Resolve #229 & #240 reporting dev errors under django dev-server (#242 by @stephenrauch)
- Allow NOT_SET to survive copy.deepcopy() (#241 by @stephenrauch)