Repository navigation
Releases
v0.17.0
Added
SerializerValidatorstates aCharField's lengths. ACharField, or any subclass
such asEmailField, withmax_lengthormin_lengthcompiles to a parameter whose
json_schema_extraholdsmaxLengthandminLength. 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 amany=Truelist's
rows. A field withallow_blank=Truestates nominLength, 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 aftertrim_whitespace, so a padded value it takes can exceed the stated
maxLength. AListField'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 statesminLengthon anallow_blankfield.- A recipe for serving a spec on a spec-html page. It covers one spec served by a
viewset and by django-spec-html'sSpecFormView, and what a call carries on the page.
viewis the page, with the URL's captures as itskwargs. A DRF permission class is
asked a DRFRequestaround a copy of the page's request, its methodPOSTand its
dataempty. So a class readingrequest.userorview.kwargsworks 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
Added
- The project's field schema rules reach the DRF seats.
SerializerValidatorand
SerializerPresenterask the kernel'sregistered_fragmentfor each field's class, so the
registry the kernel'sSERVICE_SPECS_FIELD_SCHEMA_REGISTRYsetting names answers behind the
seat's ownjson_schema_registry=, at every depth. AnIntegerFieldsubclass that keeps a
string, ruled{"type": "string"}there, is astringparameter 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_settingsreaches a spec compiled before it.project_registry=Falseopts 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'sto_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 itsroute_captures: the serializer binds what the
caller sent, aPATCHwithout 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 frominput_data=lambda view: {"org": view.kwargs["org"]}; a target selector reads it through itskwargs
provider. Captures declared as reads, or as a target selector's reads, are
arguments as before. A capture named like amanyspec'smany_argument
(the caller's list,itemsby default) is refused as
ImproperlyConfigured: atas_view()for a router-mounted detail route's
lookup capture, and on the request that carries it for a route mounted by
hand, whose capturesas_view()cannot see. JsonSchemaRegistryis the kernel's, re-exported from
django_spec_rest.types.json_schema_registryand 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_REGISTRYis the kernel's empty registry.- Selector routes layer the view's output serializer context hooks, as
mutations do. A viewset'slistandretrieve, a@selector_action, and
SelectorListView/SelectorRetrieveViewnow layer
get_output_serializer_contextandget_<action>_output_serializer_context
over DRF's context, with or without aSerializerPresenter, whose own
serializer_contextstays outermost. The hooks are offeredpageand
resulton a list (the rows served) andinstanceandresulton a
retrieve. AServiceViewSet's view-wideget_output_serializer_context
override, written for its writes, now adds its keys tolistandretrieve
responses too.get_service_kwargsand the input hooks still never reach a
selector. - The OpenAPI document follows the field schema rules.
ServiceAutoSchematypes a field
the seat's or the project's rules type (the same lookup, precedence and
project_registry=Falseopt-out as the compiled spec) by that rule, in the request and the
response components, at every depth, so theIntegerFieldsubclass ruled astringis a
stringin 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
nullableunder OAS 3.0 and keeps onenullunder 3.1, and a$refthe 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_fieldand anOpenApiSerializerFieldExtensionon 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-specsfloor is 0.36.0, the release that adds
route_capturesand the project field schema registry.
v0.15.1
Changed
- A
kwargskey named like a validator field is the kernel's namesake, no
longer refused. Every HTTP call to a spec over aSerializerValidator
whosekwargsprovider answered such a key was a 500 (ImproperlyConfigured),
though the kernel serves it: the field stays the caller's, asked for and
validated intodata, and the provider's value is the service's keyword of
that name, unvalidated. A body'steam_id=5beside a provider's999now
hands the serviceteam_id=999anddata["team_id"] == 5, typed provider or
untyped; amanyspec'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, amanyspec's list) is refused when the spec is built, as before. To
have the serializer validate a server value, return it frominput_data=. - The
django-service-specsfloor is 0.35.0, the release that makes a
provider's key named like a field a namesake.
v0.15.0
Changed
- A JSON
nullfor a file field clears the file on a dataclass input too.
Behind aDataclassSerializer(a frozen dataclass included), a nested one, or
avalidate()returning a dataclass, the instance in the service'sdataand
the parameter named like the field hold""where the client sentnull, as
a mapping's already did, soPUT {"upload": null}clears the file. A service
that read the dataclass'sNonethere as "keep the file" now gets"", "no
file". A key the client left out keeps the file, the instance'sNonedefault
and a DRFdefault=Nonefield included (a mapping input'sPUTomitting such
a field still clears): the clear reads what was sent, at each nesting level
and each row. Dataclass rows a parentvalidate()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
Added
- An affordance entry says where and how to call it.
SelectorListView,
SelectorRetrieveView,SelectorListMixinandSelectorRetrieveMixin(so
ServiceViewSet,SelectorViewSetand a@selector_action) take
link_routes, a kernelSpecRegistrywhose names are URL pattern names. Each
presented row'saffordancesentry whose target it names gainshref, DRF's
reverseof 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 ofPOST,PUT,PATCH,DELETEthe 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 raisesImproperlyConfigured.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
affordancesobject the kernel'saffordance_schemadescribes, with optional
href(format: uri) andmethodon each entrylink_routesnames.
Changed
- A selector declaring affordances documents its rows differently. Each
row isallOfthe serializer's component (or the presenter's output) and the
affordancesobject, with or withoutlink_routes, where it was the
component alone; a client generated from the document sees a composed type. - The
django-service-specsfloor is 0.34.1, forrow_linksand the
requiredreads on each of its links,link_bindingsand
SpecRegistry.name_of.
v0.13.0
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 overSelectorRetrieveView, a viewset's
retrieveor a detail@selector_action), the response is Django'sFileResponse,
or aStreamingHttpResponsefor an iterable of bytes, withContent-Type,
Content-Disposition: attachmentnaming the file andContent-Lengthwhere the
size is known; a view or viewset whose newas_attachmentattribute isFalse
answersinline, and anAcceptnaming the file's type is served, not a 406. A
response_finalizerreceives thatFileResponse, so its annotation, and the write views' and viewset handlers' return types, widen to
Django'sHttpResponseBase. The OpenAPI success is the presenter's content type
carrying{"type": "string", "format": "binary"}. ALISTselector, amanyor
returns_manyservice, or presented affordances with a file presenter is refused at
as_view(), and aLIST@selector_actionwhere it decorates.
Changed
- The kernel floor is
django-service-specs>=0.33.0, the release carrying
FilePresenter,file_outputand amanyspec'scollection_selector_spec. A
presenter whoseoutput()answersNone, which it now may, is documented as any value. - A
manyspec with acollection_selector_specis pinned over HTTP: its rows validate as one list serializer bound with no instance, however the kernel's collection target reachesvalidated_many. - The bulk body's refusal of a row that is not an object is documented as kept:
concepts.mdgives 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,HiddenFieldand
call_contextin hooks, the update that answers 200 on aNoneresult, a write's
target outsidefilter_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 saysself.context["request"]isNonethere, not aKeyError.
v0.12.0
Added
lenient_json_bodyon a view or viewset, also anas_view()and
@service_actionkeyword, and theSPEC_REST_LENIENT_JSON_BODYsetting: a JSON
body is answered by the serializer alone, as a form body is, amanyspec'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
ListFieldor a nestedmany=Trueserializer under the switch, so give those a
max_length.- The off-HTTP recipe gains a DRF
requestseed built with
build_offline_context, for a selector that keeps reading
request.query_paramsover MCP, and says what a view resource needs from
django-spec-mcpfirst. - The codemod follows a spec's answers into a view in another module. A kernel
spec has no seat forsuccess_statusorresponse_finalizer, and
tools/drfs_codemodmoved them only to views in the spec's own module, so a
specs/plusviews/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-levelSpecRegistryis 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-specsfloor is 0.31.0. It writes a choice filter's labels
into the schema, anOrderingFilter's included, which the document fix below
lowers under OpenAPI 3.0.
Fixed
- A JSON
nullfor a file field declaringallow_nullclears the file, where
it answered 200 and kept it; withoutallow_nullit is refused.
SerializerValidatorhandsdataand the values""on every transport, so a
service reading the value itself sees"". It is what the model field stores
for no file, sosetattrthensave(),create(**data)andupdate(**data)
take it and clear the file, and the kernel'supdate_from_inputreads it as a
clear. The bound serializer keepsNone, soserializer.save()still clears.
A form body is unchanged. APUTomitting aFileField(allow_null=True, default=None)is filled with thatNoneby DRF and clears the file the same
way; aPATCHfills no default and keeps it. - A form body's checked checkbox,
on, is read asTruefor a boolean
parameter. A kernelFormValidatorover a form body went through the kernel's
coerce_flat, which spells a booleantrue,false,1or0alone, so a
forms.BooleanFieldand the<name>-clearboolean an optional file field's
clearable input declares were refused for theona browser sends. The edge now
readsonasTruefor a parameter declaredboolean, or an array of them, in a
form body only; a query string's?flag=onand a JSON body's"on"are refused
as before, and no other truthy string is widened to. ASerializerValidatorwas
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 ananyOfof{"const", "title"},
and a labelled output choice aoneOfof the same. 3.0, drf-spectacular's
defaultOAS_VERSION, has neither a type list norconst, so
validate_schemarefused the whole document. Under 3.0 such a schema is now
written asnullableandenumwherever 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 underpropertiesanditemsas
deep as they go. A choice and a null are oneenumlistingnull, beside
nullable: trueonly where the field admits null: a plaintypewith a null
choice stays non-nullable, as the server answers400for a null there. The
titles are dropped, since 3.0 has no place for them. A route capture'senum
lists nonullunder any version, since a segment is always present. Inside a
named component (aDiscriminatedAction's request), drf-spectacular's enum hook moves the values
to*Enumcomponents, as it does for a serializer's choice field, which can
rename a component they collide with. What an author writes in
json_schema_extrareaches 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 everyOrderingFilteris 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 ownspecoraction_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
annotatedsuccess_statusis 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
Added
- OPTIONS and the OpenAPI body read a spec under the
reststamp. Each asks
spec_caller_input_schemawith acall_context, so a field a Validator
declares only torestis 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 handsbuild_call_context("rest", view=view), with
requestNone. A Validator declaringcall_contextguardsrequest: a
description that raisesAttributeError,KeyErrororTypeErroris 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"]sawNonein 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 answered400for 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'saction_mapentry, none on a
standalone view); the view's own dict is untouched. - The docs and the example say what
DiscriminatedActiondoes. The viewsets
reference has a section on it (where it attaches, who is refused before the body
is read, the row, validation per variant,variantfor a status or finalizer),
the OpenAPI page names its{View}_{action}_RequestanyOfcomponent and its
merged responses, andexamples/invoicesserves one asPOST /intake/, asserted
over HTTP and in the schema bymake 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_contextthat guards onlycall_context is None
now raises out of OpenAPI generation. Generation handed it no dict before; it
now hands one withrequestNone, so a Validator that guardscall_context is Noneand then readscall_context["request"].usergenerated and now fails with
anAttributeError. Guardcall_context["request"] is Noneinstead. A
document silently missing a body is worse than a failure its author sees at once. django_spec_rest.W001also reports a retrieve-only viewset. A retrieve
ignoresget_queryset()as a write or a list does, so tenant scoping left in an
override let aGETread another tenant's row with no error, and the guard said
nothing.as_view()now reports an override beside any spec, whatever its kind,
andspec_rows_scoped_by_selector = Truesilences it as it does the others. A
viewset that overridesget_queryset()and serves onlyretrievespecs, which
built silent before, now warns once atas_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'sfile:lineis DRF's
rest_framework/routers.py, since the router callsas_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. Alistorretrievewith no spec on a viewset with no rows
(queryset,get_queryset()) or no serializer (serializer_class,
get_serializer_class(),get_serializer()) raisesMethodNotAllowedas an
unserved write does, andAllow, OPTIONS and the schema follow from one
predicate. So a create-onlyServiceViewSeton a router answers 405 onGET
andHEAD, documentsPOSTalone, and keeps a detail route, which a router
mounts, withAllow: OPTIONSand no schema path. A project's ownlist,
retrieve,get_object(),get_queryset(),get_serializer_class()or
get_serializer()still answers, each for the half it supplies, and the rule
that alistorretrievefallback 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_actionrefuses a spec that is not aSelectorSpecwhere it is
decorated. AServiceSpec, aDiscriminatedActionor anything else failed
as anAttributeErroratspec.kind, saying nothing of what to do. It is now
anImproperlyConfigurednaming the action and the way out: a write goes to
@service_action, anything else wants theSelectorSpecthe 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 aDiscriminatedActionroute 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.TooManyFieldsSentlog, so a project alerting on it stops hearing
from callers it refuses; an admitted caller's still does. - A
@service_actionPATCHis 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: itsrequiredlist is the one the wire
demands, on each variant of a decoratedDiscriminatedActiontoo. Nothing on
the wire changes. A spec declaringpartialis the way to a partial call. - A spec with no presenter is documented at both statuses it may answer. The
edge answers204for one where the service returnsNone(unless the view sets
a status) and the action's default with the value where it returns anything
else, andallow_noneis a declaration no document can read, so the document
lists both with no schema:201and204on a create,200and204on a
custom action. It named the default alone, which was wrong for a service
returning nothing. A destroy lists204alone, its default, and a status the
view sets is the one status; a bare@extend_schema(responses=Foo)lands on the
default. ADiscriminatedActionwith one variant presenting and one not now
lists both statuses, where the second's204went undocumented. A spec that may present
nothing under a status the view sets no longer lists a204it never answers:
the bodyless answer goes out at that status. requestBody.requiredwhere the body is a schema given whole. drf-spectacular
reads such a body as optional, so aDiscriminatedAction, and a plain spec over
any Validator but aSerializerValidator, stated nothing while the wire answered
400for 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
transportkey no longer replaces the stamp. A view hook or a
serializer_contextcallable 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, asformatalready was, without an error. A
serializer built over a dict of its own keeps what its layers wrote.
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.
v0.9.0
Changed
get_queryset()offlistis DRF's own. A viewset with alistspec
answered that spec's set fromget_queryset()to every action. Now it does
so onlistalone, and every other action reads the viewset'squeryset,
as on DRF's own viewset: aretrieve, a write, a@selector_action, a
custom@actionreadingself.get_queryset(), and OPTIONS.
SelectorListViewanswers its spec's set to aGETorHEADalone. So a
view under DRF'sDjangoModelPermissionswith noquerysetattribute now
raises DRF's own assertion off the list, where it used to read the model
off the list spec's set: setqueryseton it, as DRF asks. And the rows an
action with no spec of its own reaches now come fromqueryset, no longer
from the list selector: DRF's fallbackretrieve(itsget_object()) and a
custom@actionreadingself.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 scopesquerysettoo, or serves them with a
spec.- A route capture is documented from the read its spec declares. A spec
viewset with noquerysetgave drf-spectacular its model through the list
spec's set; offlistit 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 ownreads),
with the read'shelpas its description. A viewset with noqueryset
keeps its router's{id}an integer, with no warning, and needs no
querysetfor its schema; its description is now the read'shelp, 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'sDjangoModelPermissionsasksget_queryset()on every action, so
beside a list spec with a required read aretrieve, a PATCH, a
@selector_actionor 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'sget_queryset()and the list each dispatched the spec.
The list now presents the dispatch the permission class asked for, kept for
that request alone.