Repository navigation
v0.10.0
Added
-
A view stamps its call's context
"rest". The request's one dict is built
through the kernel'sbuild_call_contextand carriescall_context["transport"] == "rest", so checks, a discriminator, hooks, the validator, the service, the
presenter and anOPTIONSanswer read one value through the kernel's
call_transport. The value isREST_TRANSPORT, from the package root. A
serializer of this package running under another transport'sdispatchleaves
that transport's stamp alone, and a context written by hand from
build_offline_contextreads 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'sget_queryset()narrows
nothing, and aPATCHorDELETEreaches 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: aGetQuerysetScopeWarning, fromdjango_spec_rest, whose
text begins with the stable id
django_spec_rest.W001and names the class. Set
spec_rows_scoped_by_selector = Trueon 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 noINSTALLED_APPSentry to get
it, so it is a Python warning rather than a system check, and
SILENCED_SYSTEM_CHECKSdoes not apply.filter_backendsare 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'
PolymorphicServiceSpecreturns 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
kernelServiceSpec, and attaches as anaction_specsentry undercreate,
update,partial_updateordestroy, 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
callablesuccess_statusorresponse_finalizeron such an action may
declarevariant, the chosen key. OPTIONS describes the method as ananyOf
of the variants the caller may send. A plain spec's
success_status(result, variant=None)or
response_finalizer(response, variant=None)passedas_view()on 0.9.0,
since a defaulted parameter was never checked; each is now refused, as only
aDiscriminatedActionoffersvariant. -
OpenAPI documents a
DiscriminatedAction. The request is one component,
{View}_{action}_Request, ananyOfover 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 emptyanyOf, as OPTIONS describes it. The responses are the variants'
merged per status, one body where they agree and an inlineanyOfwhere they
differ, and a400always, 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 sameanyOfwith a
drf-spectacular warning, rather than refused. drfs' component was aoneOf;
this one is ananyOf, 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 aoneOf
would document as invalid.
Changed
- The floor on
django-service-specsis 0.29.0, for itsbuild_call_context
andauthorize_without_arguments. The check a caller is judged by before the
body is read, and that anOPTIONSanswer shares, now asks through the second,
with no change in what it answers.
Fixed
- The moving page and the codemod no longer say
OfflineContracthas no
counterpart. Its parts have seats:field_audiencesis
SerializerPresenter(S, field_audiences=...),url_kwargsaParameterin
the selector'sreads=(or a server-supplied argument where the model must
never see the capture),query_paramsshapes=on the spec. The "Declaring
a spec" table carries a row for each, and one forArgumentBinding, whose
choice the kernel's single argument namespace makes for the caller. The
codemod's marker on a use ofOfflineContractnames those seats.