Skip to content

Releases

v0.17.0

Choose a tag to compare

@github-actions github-actions released this 24 Nov 13:34
bb7e3bc

Added

  • SerializerValidator states a CharField's lengths. A CharField, or any subclass
    such as EmailField, with max_length or min_length compiles to a parameter whose
    json_schema_extra holds maxLength and minLength. The value comes from the kernel's
    string_lengths, so the spelling matches every other Validator. This applies at every
    depth the walk reaches, including a nested serializer's fields and a many=True list's
    rows. A field with allow_blank=True states no minLength, because DRF accepts a blank
    before its length validator runs. A page built from the spec, such as django-spec-html's,
    can now compare its form's lengths with the spec's. The lengths are advertised: DRF
    measures a value after trim_whitespace, so a padded value it takes can exceed the stated
    maxLength. A ListField's scalar element and a field a field schema rule answers state
    no lengths. The OpenAPI document states the same lengths, except that drf-spectacular
    0.27 also states minLength on an allow_blank field.
  • A recipe for serving a spec on a spec-html page. It covers one spec served by a
    viewset and by django-spec-html's SpecFormView, and what a call carries on the page.
    view is the page, with the URL's captures as its kwargs. A DRF permission class is
    asked a DRF Request around a copy of the page's request, its method POST and its
    data empty. So a class reading request.user or view.kwargs works on both mounts,
    and one calling a DRF view's method does not. The recipe shows a mixin that answers such
    methods on the page, and a spec that needs none: route captures as declared reads, the
    scope as a pool seed on both mounts, and a check reading the seed. It also lists what
    stays REST-only. Each example is tested on both mounts. See
    serving a spec on a spec-html page.

Changed

  • The kernel floor is django-service-specs>=0.38.0, the release that adds
    string_lengths.

v0.16.0

Choose a tag to compare

@github-actions github-actions released this 24 Nov 07:57
907062c

Added

  • The project's field schema rules reach the DRF seats. SerializerValidator and
    SerializerPresenter ask the kernel's registered_fragment for each field's class, so the
    registry the kernel's SERVICE_SPECS_FIELD_SCHEMA_REGISTRY setting names answers behind the
    seat's own json_schema_registry=, at every depth. An IntegerField subclass that keeps a
    string, ruled {"type": "string"} there, is a string parameter and output field, and a
    JSON body's "AB-12" reaches the serializer instead of the shape check's
    400 "Expected an integer.". The setting is read on every declaration, so
    override_settings reaches a spec compiled before it. project_registry=False opts a seat
    out; the partial and lenient variants a request dispatches keep it. See
    field schema rules.

Changed

  • A route capture named like a Validator field is no longer an argument;
    the field is the caller's.
    A nested-route host whose serializer has a
    field of a capture's name (orgs/<org>/members/ over a serializer with
    org) had the route's value written over the body. That value is the URL
    converter's to_python() output while the field reads wire input, so a
    converter that changes the value (a hashid) answered every call with the
    field's 400, whether or not the caller sent the key. Now the capture is the
    kernel's namesake, by its route_captures: the serializer binds what the
    caller sent, a PATCH without the key is a 2xx, and OPTIONS and the
    OpenAPI request body offer the field as a body key. A host that relied on
    the route filling the field declares the capture as a read (and drops the
    field), or fills the field from input_data=lambda view: {"org": view.kwargs["org"]}; a target selector reads it through its kwargs
    provider. Captures declared as reads, or as a target selector's reads, are
    arguments as before. A capture named like a many spec's many_argument
    (the caller's list, items by default) is refused as
    ImproperlyConfigured: at as_view() for a router-mounted detail route's
    lookup capture, and on the request that carries it for a route mounted by
    hand, whose captures as_view() cannot see.
  • JsonSchemaRegistry is the kernel's, re-exported from
    django_spec_rest.types.json_schema_registry and the package root, and its rules are matched
    through the field class's MRO: the most specific class with a rule wins, in either
    registry, and for one class the seat's rule beats the project's. A seat registry listing a
    rule for a base before one for its subclass answered the subclass with the base's rule; the
    subclass's own rule answers it now. A rule keyed on a tuple of classes matches nothing:
    write one rule per class. DEFAULT_JSON_SCHEMA_REGISTRY is the kernel's empty registry.
  • Selector routes layer the view's output serializer context hooks, as
    mutations do.
    A viewset's list and retrieve, a @selector_action, and
    SelectorListView / SelectorRetrieveView now layer
    get_output_serializer_context and get_<action>_output_serializer_context
    over DRF's context, with or without a SerializerPresenter, whose own
    serializer_context stays outermost. The hooks are offered page and
    result on a list (the rows served) and instance and result on a
    retrieve. A ServiceViewSet's view-wide get_output_serializer_context
    override, written for its writes, now adds its keys to list and retrieve
    responses too. get_service_kwargs and the input hooks still never reach a
    selector.
  • The OpenAPI document follows the field schema rules. ServiceAutoSchema types a field
    the seat's or the project's rules type (the same lookup, precedence and
    project_registry=False opt-out as the compiled spec) by that rule, in the request and the
    response components, at every depth, so the IntegerField subclass ruled a string is a
    string in the document as well as in the spec. The field's own meta (readOnly,
    nullable, description) stands beside the fragment, a [t, "null"] type is stated as
    nullable under OAS 3.0 and keeps one null under 3.1, and a $ref the document has no
    component for is dropped with a warning naming it. An unregistered field keeps
    drf-spectacular's mapping. A rule wins over @extend_schema_field and an OpenApiSerializerFieldExtension on the same
    field class. A serializer documented by two seats with different rules is one component,
    typed by the first operation that maps it. See
    the OpenAPI document.
  • The django-service-specs floor is 0.36.0, the release that adds
    route_captures and the project field schema registry.

v0.15.1

Choose a tag to compare

@github-actions github-actions released this 23 Nov 16:01
3f1bf57

Changed

  • A kwargs key named like a validator field is the kernel's namesake, no
    longer refused.
    Every HTTP call to a spec over a SerializerValidator
    whose kwargs provider answered such a key was a 500 (ImproperlyConfigured),
    though the kernel serves it: the field stays the caller's, asked for and
    validated into data, and the provider's value is the service's keyword of
    that name, unvalidated. A body's team_id=5 beside a provider's 999 now
    hands the service team_id=999 and data["team_id"] == 5, typed provider or
    untyped; a many spec's rows keep their own field the same way. What the
    kernel still refuses (a typed provider filling a target selector's read, a
    shape, a many spec's list) is refused when the spec is built, as before. To
    have the serializer validate a server value, return it from input_data=.
  • The django-service-specs floor is 0.35.0, the release that makes a
    provider's key named like a field a namesake.

v0.15.0

Choose a tag to compare

@github-actions github-actions released this 20 Nov 11:48
66489cb

Changed

  • A JSON null for a file field clears the file on a dataclass input too.
    Behind a DataclassSerializer (a frozen dataclass included), a nested one, or
    a validate() returning a dataclass, the instance in the service's data and
    the parameter named like the field hold "" where the client sent null, as
    a mapping's already did, so PUT {"upload": null} clears the file. A service
    that read the dataclass's None there as "keep the file" now gets "", "no
    file". A key the client left out keeps the file, the instance's None default
    and a DRF default=None field included (a mapping input's PUT omitting such
    a field still clears): the clear reads what was sent, at each nesting level
    and each row. Dataclass rows a parent validate() reshaped (a count unlike the
    list sent) are kept as built, none cleared; a mapping's rows still clear. The
    changed instance is a shallow copy with only the cleared fields set, so
    __post_init__ does not run again.

v0.14.0

Choose a tag to compare

@github-actions github-actions released this 17 Nov 14:25
804842f

Added

  • An affordance entry says where and how to call it. SelectorListView,
    SelectorRetrieveView, SelectorListMixin and SelectorRetrieveMixin (so
    ServiceViewSet, SelectorViewSet and a @selector_action) take
    link_routes, a kernel SpecRegistry whose names are URL pattern names. Each
    presented row's affordances entry whose target it names gains href, DRF's
    reverse of that name run per response with the link's required reads (the
    target selector's reads a caller must supply, never a body field), and
    method, the first of POST, PUT, PATCH, DELETE the route's view
    serves the target under. A target it does not name, a name that does not
    reverse for the row, a view serving it under no method, or a row lacking a
    field a declared output binds leaves the entry its availability answer; with
    no declared output, that missing field raises ImproperlyConfigured. None,
    the default, changes no body; as_view() refuses a value that is not a
    SpecRegistry, and reverses nothing, so the registry may be declared before
    the URLconf loads.
  • OpenAPI documents a selector's affordances. A selector spec whose
    presenter declares its rows documents each row as that schema plus the
    affordances object the kernel's affordance_schema describes, with optional
    href (format: uri) and method on each entry link_routes names.

Changed

  • A selector declaring affordances documents its rows differently. Each
    row is allOf the serializer's component (or the presenter's output) and the
    affordances object, with or without link_routes, where it was the
    component alone; a client generated from the document sees a composed type.
  • The django-service-specs floor is 0.34.1, for row_links and the
    required reads on each of its links, link_bindings and
    SpecRegistry.name_of.

v0.13.0

Choose a tag to compare

@github-actions github-actions released this 14 Nov 15:44
f5dfee6

Added

  • A spec presenting a file answers the file. Where the kernel's FilePresenter
    presents the result (a service spec over a write view, viewset action or
    @service_action; a retrieve selector spec over SelectorRetrieveView, a viewset's
    retrieve or a detail @selector_action), the response is Django's FileResponse,
    or a StreamingHttpResponse for an iterable of bytes, with Content-Type,
    Content-Disposition: attachment naming the file and Content-Length where the
    size is known; a view or viewset whose new as_attachment attribute is False
    answers inline, and an Accept naming the file's type is served, not a 406. A
    response_finalizer receives that FileResponse, so its annotation, and the write views' and viewset handlers' return types, widen to
    Django's HttpResponseBase. The OpenAPI success is the presenter's content type
    carrying {"type": "string", "format": "binary"}. A LIST selector, a many or
    returns_many service, or presented affordances with a file presenter is refused at
    as_view(), and a LIST @selector_action where it decorates.

Changed

  • The kernel floor is django-service-specs>=0.33.0, the release carrying
    FilePresenter, file_output and a many spec's collection_selector_spec. A
    presenter whose output() answers None, which it now may, is documented as any value.
  • A many spec with a collection_selector_spec is pinned over HTTP: its rows validate as one list serializer bound with no instance, however the kernel's collection target reaches validated_many.
  • The bulk body's refusal of a row that is not an object is documented as kept: concepts.md gives its shape, the same index nesting as any failing row.
  • Guides and a docs fix: the serializer-context, extra-kwargs, selector-filtering,
    concepts and OpenAPI pages state what the code does where they were silent (a spec's
    context callable over the view's keys, the progress reporter, HiddenField and
    call_context in hooks, the update that answers 200 on a None result, a write's
    target outside filter_backends, the 422's schema as raised, a registry fragment's
    keywords); the DRF seats page names the three helpers the root exports, and the off-HTTP
    note says self.context["request"] is None there, not a KeyError.

v0.12.0

Choose a tag to compare

@github-actions github-actions released this 09 Nov 19:18
06f6aee

Added

  • lenient_json_body on a view or viewset, also an as_view() and
    @service_action keyword, and the SPEC_REST_LENIENT_JSON_BODY setting: a JSON
    body is answered by the serializer alone, as a form body is, a many spec's rows
    included, with every field's refusal in DRF's words (a body that is no object is
    still refused as {"detail": "The body must be an object; got list."}). The view's
    value beats the setting and the default is off. The spec's schema, its tool schema
    and every other transport stay typed. The kernel's array cap no longer judges a
    ListField or a nested many=True serializer under the switch, so give those a
    max_length.
  • The off-HTTP recipe gains a DRF request seed built with
    build_offline_context, for a selector that keeps reading
    request.query_params over MCP, and says what a view resource needs from
    django-spec-mcp first.
  • The codemod follows a spec's answers into a view in another module. A kernel
    spec has no seat for success_status or response_finalizer, and
    tools/drfs_codemod moved them only to views in the spec's own module, so a
    specs/ plus views/ layout was left with comments. The files of one run are
    now read together: an answer follows the spec's import, relative or absolute, by
    name or through a module, onto the view that serves it, bringing the import a
    name in its value needs. It moves only when that is certain. A spec two modules
    import, or one imported under an alias, keeps its comment, as does a value that
    would not resolve in the view, and the comment ends in why. So does a spec another
    file star-imports, a package's re-export included, a name another answer already
    brought into that view from elsewhere, a name a star import in the view may bind,
    and one object carried both with and without an alias. A registration on a
    module-level SpecRegistry is no second use; any other use, such as
    admin.site.register(x), is. A view that already declares the answer is marked
    and the spec keeps the value. A file that cannot be parsed now stops the run with
    exit 2 before anything is written, and --root, the directory absolute imports
    start from, is documented.

Changed

  • The django-service-specs floor is 0.31.0. It writes a choice filter's labels
    into the schema, an OrderingFilter's included, which the document fix below
    lowers under OpenAPI 3.0.

Fixed

  • A JSON null for a file field declaring allow_null clears the file, where
    it answered 200 and kept it; without allow_null it is refused.
    SerializerValidator hands data and the values "" on every transport, so a
    service reading the value itself sees "". It is what the model field stores
    for no file, so setattr then save(), create(**data) and update(**data)
    take it and clear the file, and the kernel's update_from_input reads it as a
    clear. The bound serializer keeps None, so serializer.save() still clears.
    A form body is unchanged. A PUT omitting a FileField(allow_null=True, default=None) is filled with that None by DRF and clears the file the same
    way; a PATCH fills no default and keeps it.
  • A form body's checked checkbox, on, is read as True for a boolean
    parameter.
    A kernel FormValidator over a form body went through the kernel's
    coerce_flat, which spells a boolean true, false, 1 or 0 alone, so a
    forms.BooleanField and the <name>-clear boolean an optional file field's
    clearable input declares were refused for the on a browser sends. The edge now
    reads on as True for a parameter declared boolean, or an array of them, in a
    form body only; a query string's ?flag=on and a JSON body's "on" are refused
    as before, and no other truthy string is widened to. A SerializerValidator was
    never affected.
  • A nullable or labelled schema no longer makes an OpenAPI 3.0 document
    invalid.
    The kernel writes JSON Schema: a nullable field's type is
    [t, "null"], a labelled parameter choice an anyOf of {"const", "title"},
    and a labelled output choice a oneOf of the same. 3.0, drf-spectacular's
    default OAS_VERSION, has neither a type list nor const, so
    validate_schema refused the whole document. Under 3.0 such a schema is now
    written as nullable and enum wherever the kernel's schema enters the
    document: a request body, a response body, a route capture a spec reads and a
    filter_set's query parameter, nested under properties and items as
    deep as they go. A choice and a null are one enum listing null, beside
    nullable: true only where the field admits null: a plain type with a null
    choice stays non-nullable, as the server answers 400 for a null there. The
    titles are dropped, since 3.0 has no place for them. A route capture's enum
    lists no null under any version, since a segment is always present. Inside a
    named component (a DiscriminatedAction's request), drf-spectacular's enum hook moves the values
    to *Enum components, as it does for a serializer's choice field, which can
    rename a component they collide with. What an author writes in
    json_schema_extra reaches the document as written, so under 3.0 it must be
    valid 3.0. Under 3.1 and later the schema is kept as the kernel writes it.
    What OPTIONS answers is unchanged. On the kernel floor below, every labelled
    filter and every OrderingFilter is such a schema.
  • The codemod no longer sets an answer a subclass would inherit. A class of the
    run that subclasses the serving view and binds its own spec or action_specs
    would have answered with the other spec's status, so the answer stays on the spec
    with its reason. A subclass the run cannot resolve is not seen, as the README says.
    A class-level name that is annotated or conditional now counts as declared, so an
    annotated success_status is marked rather than given a second, losing line above
    or below it.
  • The codemod's writes are staged. Every changed file goes to a temporary file
    beside its target and moves into place only when all are staged, so a failure while
    staging changes no file and leaves no temporary file; a failure among the moves can
    still leave some written. Either stops the run with exit 2, naming the file and
    how many were written before it, and a file that cannot be written is found
    before any is. A file's mode, a symlink and CRLF line ends are kept; its owner
    and group become the runner's, and a hard link to it no longer shares it.

v0.11.0

Choose a tag to compare

@github-actions github-actions released this 09 Nov 09:39
0e2332e

Added

  • OPTIONS and the OpenAPI body read a spec under the rest stamp. Each asks
    spec_caller_input_schema with a call_context, so a field a Validator
    declares only to rest is offered by both and required where dispatch requires
    it, and one declared only to another transport is offered by neither. OPTIONS
    hands the call's own dict; a document describes the transport and never one
    caller, so OpenAPI hands build_call_context("rest", view=view), with
    request None. A Validator declaring call_context guards request: a
    description that raises AttributeError, KeyError or TypeError is left out
    of OPTIONS, as before, and any other exception is a 500. A
    SerializerValidator's output does not move. Requires
    django-service-specs>=0.30.0.
  • Both seats name the action the wire names. A Validator keyed on
    call_context["action"] saw None in the document, "metadata" in OPTIONS and
    the action's name in dispatch, so a field it requires only for that action was
    missing from both descriptions and the wire answered 400 for it. The document
    now hands the view's action, and OPTIONS a copy of the call's dict naming the
    action each described method dispatches as (the route's action_map entry, none on a
    standalone view); the view's own dict is untouched.
  • The docs and the example say what DiscriminatedAction does. The viewsets
    reference has a section on it (where it attaches, who is refused before the body
    is read, the row, validation per variant, variant for a status or finalizer),
    the OpenAPI page names its {View}_{action}_Request anyOf component and its
    merged responses, and examples/invoices serves one as POST /intake/, asserted
    over HTTP and in the schema by make examples. The moving page's off-HTTP
    default now names the HTTP transports ("rest", "html") and says what it means
    for each of "agent", "mcp", "cli" and an unstamped call, where it compared
    ("agent", "mcp") and left out spec-cli's value.

Changed

  • A Validator declaring call_context that guards only call_context is None
    now raises out of OpenAPI generation.
    Generation handed it no dict before; it
    now hands one with request None, so a Validator that guards call_context is None and then reads call_context["request"].user generated and now fails with
    an AttributeError. Guard call_context["request"] is None instead. A
    document silently missing a body is worse than a failure its author sees at once.
  • django_spec_rest.W001 also reports a retrieve-only viewset. A retrieve
    ignores get_queryset() as a write or a list does, so tenant scoping left in an
    override let a GET read another tenant's row with no error, and the guard said
    nothing. as_view() now reports an override beside any spec, whatever its kind,
    and spec_rows_scoped_by_selector = True silences it as it does the others. A
    viewset that overrides get_queryset() and serves only retrieve specs, which
    built silent before, now warns once at as_view(); set the attribute once each
    selector scopes its own rows. The warning's text now reads "serves a spec", and
    the reference page says that a router-mounted viewset's file:line is DRF's
    rest_framework/routers.py, since the router calls as_view(); the text names
    the class.

Fixed

  • A viewset read with nothing to fall back to answers 405, not DRF's assertion
    as a 500.
    A list or retrieve with no spec on a viewset with no rows
    (queryset, get_queryset()) or no serializer (serializer_class,
    get_serializer_class(), get_serializer()) raises MethodNotAllowed as an
    unserved write does, and Allow, OPTIONS and the schema follow from one
    predicate. So a create-only ServiceViewSet on a router answers 405 on GET
    and HEAD, documents POST alone, and keeps a detail route, which a router
    mounts, with Allow: OPTIONS and no schema path. A project's own list,
    retrieve, get_object(), get_queryset(), get_serializer_class() or
    get_serializer() still answers, each for the half it supplies, and the rule
    that a list or retrieve fallback stays documented narrows to one that can
    run. OPTIONS of a project's own write on such a viewset answers with that method
    undescribed, where DRF's metadata asserted.
  • @selector_action refuses a spec that is not a SelectorSpec where it is
    decorated.
    A ServiceSpec, a DiscriminatedAction or anything else failed
    as an AttributeError at spec.kind, saying nothing of what to do. It is now
    an ImproperlyConfigured naming the action and the way out: a write goes to
    @service_action, anything else wants the SelectorSpec the action reads through.
  • A caller a plain spec refuses is refused whatever it sends, a body that cannot
    be read included.
    An unparseable body answered DRF's 400, an unsupported media
    type its 415 and too many form fields Django's 400, with no challenge, ahead of
    the spec's checks. The edge now judges a failed read on no arguments, as it
    judges a failed shape and as a DiscriminatedAction route already did, so an
    anonymous caller gets the 401 with the challenge, or a 403 where the first
    authenticator gives none, and a signed-in one the check's 403. A caller the
    checks admit is told what the read raised, as before, and OPTIONS hides a
    method from the same callers. A view hook that reads the body first is judged
    the same; hooks still run before the checks, and the body is not read ahead of
    them.
    A hook raising one of those errors itself is judged the same way, which it cannot
    be told from. A refused caller's too many form fields no longer writes to Django's
    django.security.TooManyFieldsSent log, so a project alerting on it stops hearing
    from callers it refuses; an admitted caller's still does.
  • A @service_action PATCH is documented as the wire validates it. The
    action runs its spec as declared, so its body is validated whole, and the
    document no longer calls it partial: its required list is the one the wire
    demands, on each variant of a decorated DiscriminatedAction too. Nothing on
    the wire changes. A spec declaring partial is the way to a partial call.
  • A spec with no presenter is documented at both statuses it may answer. The
    edge answers 204 for one where the service returns None (unless the view sets
    a status) and the action's default with the value where it returns anything
    else, and allow_none is a declaration no document can read, so the document
    lists both with no schema: 201 and 204 on a create, 200 and 204 on a
    custom action. It named the default alone, which was wrong for a service
    returning nothing. A destroy lists 204 alone, its default, and a status the
    view sets is the one status; a bare @extend_schema(responses=Foo) lands on the
    default. A DiscriminatedAction with one variant presenting and one not now
    lists both statuses, where the second's 204 went undocumented. A spec that may present
    nothing under a status the view sets no longer lists a 204 it never answers:
    the bodyless answer goes out at that status.
  • requestBody.required where the body is a schema given whole. drf-spectacular
    reads such a body as optional, so a DiscriminatedAction, and a plain spec over
    any Validator but a SerializerValidator, stated nothing while the wire answered
    400 for an empty body. It is stated wherever every spec the route may run takes
    a body with a required field, and stays absent where one takes no body or
    requires none of its fields.
  • A project's own transport key no longer replaces the stamp. A view hook or a
    serializer_context callable answering a "transport" key wrote it into the
    call's one dict, so every later stage read the project's value in place of
    "rest", against the kernel's contract that the transport stamps last. The key is
    now dropped from that shared dict, as format already was, without an error. A
    serializer built over a dict of its own keeps what its layers wrote.

v0.10.0

Choose a tag to compare

@github-actions github-actions released this 08 Nov 14:32
b2edfe2

Added

  • A view stamps its call's context "rest". The request's one dict is built
    through the kernel's build_call_context and carries call_context["transport"] == "rest", so checks, a discriminator, hooks, the validator, the service, the
    presenter and an OPTIONS answer read one value through the kernel's
    call_transport. The value is REST_TRANSPORT, from the package root. A
    serializer of this package running under another transport's dispatch leaves
    that transport's stamp alone, and a context written by hand from
    build_offline_context reads as its caller wrote it. Requires
    django-service-specs>=0.29.0.

  • A get_queryset() override beside a spec is reported. A spec's rows are
    its selector's, so tenant scoping left in a viewset's get_queryset() narrows
    nothing, and a PATCH or DELETE reaches another tenant's row with no error.
    as_view() now warns of a viewset overriding it while serving a write spec
    or a list spec: a GetQuerysetScopeWarning, from django_spec_rest, whose
    text begins with the stable id
    django_spec_rest.W001 and names the class. Set
    spec_rows_scoped_by_selector = True on a class to silence it once its
    selectors scope their own rows; it is inherited, and covers only overrides on
    that class and its bases. A project needs no INSTALLED_APPS entry to get
    it, so it is a Python warning rather than a system check, and
    SILENCED_SYSTEM_CHECKS does not apply. filter_backends are not reported,
    and the moving page now says a
    tenant backend loses its scoping the same way.

  • DiscriminatedAction: one action at one URL, chosen by the request. drfs'
    PolymorphicServiceSpec returns as an opt-in for an endpoint that must keep
    one URL; one kernel spec per route stays the default. DiscriminatedAction( discriminator=, specs=) maps each key the discriminator may answer to a
    kernel ServiceSpec, and attaches as an action_specs entry under create,
    update, partial_update or destroy, or as @service_action(...), which
    now accepts it. It is this package's alone, not a kernel spec: agents and MCP
    register each variant on its own. A caller every variant refuses is refused
    before the body is read; otherwise the chosen variant runs as a plain entry
    would, its own checks deciding, so drfs' permission_strategy= is gone. A
    callable success_status or response_finalizer on such an action may
    declare variant, the chosen key. OPTIONS describes the method as an anyOf
    of the variants the caller may send. A plain spec's
    success_status(result, variant=None) or
    response_finalizer(response, variant=None) passed as_view() on 0.9.0,
    since a defaulted parameter was never checked; each is now refused, as only
    a DiscriminatedAction offers variant.

  • OpenAPI documents a DiscriminatedAction. The request is one component,
    {View}_{action}_Request, an anyOf over each variant's body (a serializer's
    $ref, or the inline schema of any other Validator); a variant taking no
    body adds no member, and where none takes one there is no request body, never
    an empty anyOf, as OPTIONS describes it. The responses are the variants'
    merged per status, one body where they agree and an inline anyOf where they
    differ, and a 400 always, since the discriminator may refuse. A variant with
    a body but no serializer (an array of rows) is now documented, which drfs left
    out of its component. Variants of one body are one member, in OpenAPI and in
    OPTIONS. Where two operations would give one component name two bodies (two
    classes of one name in different modules, or a route capture that changes a
    variant's body), the second is given inline as the same anyOf with a
    drf-spectacular warning, rather than refused. drfs' component was a oneOf;
    this one is an anyOf, since a member is open (the edge drops a key it does
    not know) and a body two variants accept is valid for both, which a oneOf
    would document as invalid.

Changed

  • The floor on django-service-specs is 0.29.0, for its build_call_context
    and authorize_without_arguments. The check a caller is judged by before the
    body is read, and that an OPTIONS answer shares, now asks through the second,
    with no change in what it answers.

Fixed

  • The moving page and the codemod no longer say OfflineContract has no
    counterpart.
    Its parts have seats: field_audiences is
    SerializerPresenter(S, field_audiences=...), url_kwargs a Parameter in
    the selector's reads= (or a server-supplied argument where the model must
    never see the capture), query_params shapes= on the spec. The "Declaring
    a spec" table carries a row for each, and one for ArgumentBinding, whose
    choice the kernel's single argument namespace makes for the caller. The
    codemod's marker on a use of OfflineContract names those seats.

v0.9.0

Choose a tag to compare

@github-actions github-actions released this 05 Nov 14:27
b5066d5

Changed

  • get_queryset() off list is DRF's own. A viewset with a list spec
    answered that spec's set from get_queryset() to every action. Now it does
    so on list alone, and every other action reads the viewset's queryset,
    as on DRF's own viewset: a retrieve, a write, a @selector_action, a
    custom @action reading self.get_queryset(), and OPTIONS.
    SelectorListView answers its spec's set to a GET or HEAD alone. So a
    view under DRF's DjangoModelPermissions with no queryset attribute now
    raises DRF's own assertion off the list, where it used to read the model
    off the list spec's set: set queryset on it, as DRF asks. And the rows an
    action with no spec of its own reaches now come from queryset, no longer
    from the list selector: DRF's fallback retrieve (its get_object()) and a
    custom @action reading self.get_queryset() reach a row the list selector
    leaves out. A project that scoped a tenant in its list selector alone and
    relied on it for those actions scopes queryset too, or serves them with a
    spec.
  • A route capture is documented from the read its spec declares. A spec
    viewset with no queryset gave drf-spectacular its model through the list
    spec's set; off list it now gives none. So where drf-spectacular finds no
    model and the path does not type the capture, the schema types it from the
    read the operation's spec declares for it (a retrieve's or a detail
    action's selector, a write's target selector, or the write's own reads),
    with the read's help as its description. A viewset with no queryset
    keeps its router's {id} an integer, with no warning, and needs no
    queryset for its schema; its description is now the read's help, where
    it was the model's primary key's. Where drf-spectacular finds a model, or a
    converter or regex types the capture, its answer stands.

Fixed

  • A retrieve or a PATCH beside a list spec answers as its own spec says.
    DRF's DjangoModelPermissions asks get_queryset() on every action, so
    beside a list spec with a required read a retrieve, a PATCH, a
    @selector_action or an OPTIONS (a CORS preflight) answered the list's
    400, or 403 where the list's own check refused. SelectorListView
    answered an OPTIONS, and a method it does not serve, the same way.
  • A list runs its selector once under DjangoModelPermissions. The
    permission class's get_queryset() and the list each dispatched the spec.
    The list now presents the dispatch the permission class asked for, kept for
    that request alone.