Skip to content

Releases: vitalik/django-ninja

0.22.1

28 May 07:16
Compare
Choose a tag to compare

Fixes a swagger ui error

0.22.0

27 May 18:42
9c6f136
Compare
Choose a tag to compare

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

Full Changelog: v.0.21.0...v0.22.0

0.21.0

24 Feb 14:16
41e9bbf
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.20.0...v.0.21.0

0.20.0

17 Dec 15:27
432ab53
Compare
Choose a tag to compare

What's Changed

Documentation

Misc

New Contributors

Full Changelog: v0.19.1...v0.20.0

0.19.1

20 Jul 15:41
97a83b8
Compare
Choose a tag to compare

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

New Contributors

Full Changelog: v.0.19.0...v0.19.1

0.19.0

29 Jun 08:46
7b134f3
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v.0.18.0...v.0.19.0

0.18.0

03 Jun 09:01
4e3a838
Compare
Choose a tag to compare

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

New Contributors

Full Changelog: v0.17.0...v0.18.0

0.17.0

03 Feb 22:03
Compare
Choose a tag to compare

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:

New Contributors

Full Changelog: v0.16.2...v0.17.0

0.16.2

20 Jan 14:15
37f6da9
Compare
Choose a tag to compare

Many documentaion fixes and improvements by:

0.16.1

12 Oct 09:21
170fc58
Compare
Choose a tag to compare