sqlathanor
sqlathanor copied to clipboard
Serialization to Documentation / JSON Schema / OpenAPI / apispec integration
Does it make sense to support serialization to (and maybe deserialization from) various documentation formats, including possibly OpenAPI (Swagger)?
If so, does it make sense to integrate with documentation platforms like Sphinx or apispec?
What additional metadata support would be necessary, if any?
On further consideration, it does not make sense to try to serialize model class metadata to RST or Sphinx. The reason is actually pretty obvious: a model class is already a regular Python class, and so can be documented normally the way one would document anything with docstrings. So built in Sphinx support, by definition.
However, serializing SQLAlchemy model classes to OpenAPI does make sense, and can definitely provide value.
Some further research should be done to figure out the best architecture and API for supporting this functionality.
Slight tweak to also support the serialization of a table structure to / from JSON Schema.
Slight tweak to also support the serialization of a table structure to / from JSON Schema.
IMO this would be very valuable as this would allow people not knowing Python & SQLAlchemy to prepare config files with complete "create table" DDL statements in a simplified form (for example in YAML).