Implement resource documentation generator for models
bruth opened this issue · 0 comments
bruth commented
The metadata that can be obtained from options passed into serialize
can be used to extract various field labels, docstrings, etc. about the resource. A new function serialize_docs
(a clever name) could take the same options and a top-level model object that the resource represents.
>>> serialize_docs(User, **data_template)
{ ... }
This of course only works if the data is derived from a model or queryset. As an added bonus, if a model instance (rather than the model class) is passed in, the generated docs could provide an example value.