2

We are using cerberus extensively to validate json configuration files. We therefore have a wide range of schemas, which define how these json documents should be formatted.

We would like to be able to use these schemas to auto-generate some documentation for the users who may need to create these json files.

At the moment, we keep separate pages of documentation around all of the different config formats that we have, however these can sometimes drift out of date if a change in made to the code that is not picked up that it requires a change to the documentation, and also requires the same piece of information to be updated in two places. By auto-generating from the schemas, the docs would always be up to date and guaranteed to reflect the actual code, and it would avoid the need to update in multiple places.

We are also using Sphinx to auto generate docs from our codebase, based on Docstrings in out .py files, and separate .md files.

It feels that using the Cerberus schema files to create a "human readable" documentation file for each schema should be reasonably straight forward, but I have not been able to find any documentation for this within either Cerberus or Sphinx. Does anyone know if there is some native functionality in either of these packages that would achieve this that I am missing, or another way or example of achieving this?

OliverBurke
  • 51
  • 1
  • 5
  • How do you envision this to work? What exactly is it that you want to automate? Cerberus schemas are Python `dict`s (that's basically all I know). Are you thinking of attaching a docstring to such a dict? I don't quite understand what it is that you feel is "straight forward". – mzjn Mar 10 '22 at 14:19

0 Answers0