------
How can one create a Sphinx directive that creates documentation from an externally defined data structure?
For context, I have some classes that automatically create attributes based on a JSON response.
class Model:
def __init__(self, json_data):
self.__dict__ = json_data
model = Model({"a": 1})
model.a
The issue I'm having is documenting this in Sphinx. I could possibly do it manually like so:
.. autoclass:: Model
.. attribute:: a
However the properties are numerous, outside my control, which presents issues keeping the documentation up to date with the backend.
Attempting to remedy this problem I've built up a data-structure pulled from a swagger document that contains information about these dynamic properties. However I have no idea how to apply this in Sphinx. I've looked into custom directives and domains, but without some serious digging into the internals I don't understand how to create a directive that creates other directives.
In essence I would like to do the following.
.. autoclass:: Model
.. custom_set_of_attributes_directive:: model_schema
Which would be equivalent to:
.. autoclass:: Model
.. attribute:: a
.. attribute:: b
.. attribute:: c
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/E12C5519-4646-4A3E-AA66-289D3897707F%40doughellmann.com.