github wemake-services/django-modern-rest 0.7.0
Version 0.7.0

12 hours ago

Breaking changes

  1. Removed public OpenAPIView.dumps customization hook, #847
    If you customized schema output for OpenAPIJsonView, subclass
    the concrete view and override .get() instead.
    For JSON output, use dmr.openapi.core.dump.json_dump
    if you need the framework's default serializer
  2. Breaking: get_jwt is renamed to request_jwt, #868
  3. Breaking: ResponseSpecProvider.provide_response_specs is now
    an instance method, #877
  4. Breaking: new required router parameter added
    to Endpoint.get_schema and Controller.get_path_item, #879

Migration Prompt

Apply this change to the code that uses `django-modern-rest`:
1. Replace `OpenAPIView.dumps` usage with `dmr.openapi.core.dump.json_dump`
   usage
2. Change `dmr.security.jwt.auth.get_jwt` function
   to use `dmr.security.jwt.auth.request_jwt` instead, if user expects
   to always get a token back, add `strict=True` argument
3. Change `provide_response_specs` class method to be instance method,
   replace all `cls` usage with `self`
4. Add `router: Router` parameter to `Endpoint.get_schema`
   and `Controller.get_path_item` methods

Features

  • Added official PyPy 3.11+ support, #870
  • Added dmr.throttling package, #877
  • Added request.__drm_auth__ on all successful auth workflows, #868
  • Added request_auth helper function, #868
  • Added AuthenticatedHttpRequest type for better
    request: AuthenticatedHttpRequest[User]
    type annotations in controllers, #888
  • Added strict parameter to request_renderer and request_parser,
    added @overloads to both of these functions, #869
  • Added ResponseSpecMetadata type to represent
    headers and cookies with annotations, useful for error models, #882
  • Allow individual OpenAPI views to skip schema validation, #867
  • Added endpoint validator to prevent sync
    and async generator HTTP endpoints, #843
  • Added CSP-friendly templates for shipped OpenAPI UI views, #847
    SwaggerView, RedocView, ScalarView, and StoplightView
    now avoid inline scripts in DMR-managed templates.
    Final CSP compatibility still depends on the upstream renderer bundle.
  • Added tags and deprecated parameters to Router for OpenAPI metadata,
    #872. All operations in a router can now be grouped and marked as deprecated.

Fixes

  • Fixed that OpenAPI was revalidated on every .convert call, #867
  • Fixed missing request.auser() after JWTAsyncAuth, #884
  • Fixed ParameterMetadata missing __slots__, #890
  • Fixed SSEvent missing __slots__, #901
  • Fixed SSE protocol typing, #894
  • Fixed a bug when we were treating controllers with
    no api_endpoints as non-abstract, #894
  • Fixed a bug when you were not able to subclass
    a controller with a serializer, #873

Misc

  • Added dmr skill for agents to write better django-modern-rest code, #886
  • Switched from Make to just
    as a command runner

New Contributors

Full Changelog: 0.6.0...0.7.0

Don't miss a new django-modern-rest release

NewReleases is sending notifications on new releases.