Closed jayvdb closed 1 year ago
There is no specification for AutoMetadata
, the specification is determined by the adapter used and are explained here with relevant links to the different scpecifications.
I am not sure there is a case for using both DRF's specification and JsonSchema (the specification of the base adapter) but you might have one. One way to accomodate that would be to create and use a custom adapter with a different render method
The
AutoMetadata
inherits fromSimpleMetadata
, but has a wildly incompatible output.The output of the base class is
Most of that data is missing from the drf-schema-adapter
AutoMetadata
, and thename
is moved to be underui.label
. Is theAutoMetadata
response loosely following some spec; if so, which one? I suspect that the DRFSimpleMetadata
has no spec, but they are implicitly the standard setter for Django REST, and there are lots of frontend apps which expect/use that format. It is a defacto standard, for good or ill.The
OPTIONS
response is fairly flexible according to the spec, but drf-schema-adapter should provide the response some content-type likeapplication/json+foobar
to give a clue what it is.I see that
AutoMetadataMixin.determine_metadata
does invoke the DRFSimpleMetadata.determine_metadata
, and it gives that to the adapter, defaulting toadapters.BaseAdapter
, which then discards all of the metadata provided by DRFSimpleMetadata.determine_metadata
.IMO the default drf-schema-adapter adapter should enrich the DRF format, not discard the elements it provides, as that makes the default adapter incompatible with DRF.
If not the default adapter, there should at least be one adapter which does extend the DRF format with extra fields, if only as a demo of how this library can be used to extend existing DRF based clients.