Closed amyXia1994 closed 1 year ago
cc @ffforest
Here I uploaded a demo to demonstrate the appearance when displaying the schema attributes in a flattened way: https://github.com/amyXia1994/kusionstack.io/blob/demo/model-doc-style/docs/user_docs/reference/model/catalog_models/doc_app_configuration.md
After I saw this demo with all real models in the catalog repo, I think displaying attributes in a flattened way with markdown is not a good idea:
AppConfiguration
schema has a maximum nesting depth of 6 levels: AppConfiguration.workload.containers.livenessProbe.probeHandler.command
. This means that when the attributes of AppConfiguration are expanded, its content will include varied documentation for models at 6 different levels. For users, viewing such a complex hierarchical structure is quite hard, and makes the flat representation less clear than a jump-based navigation.livenessProbe.probeHandler, readinessProbe.probeHandler, startupProbe.probeHandler, lifecycle.preStop, lifecycle.postStart
, and all of these attributes are indirectly located under one AppConfiguration model.Research on similar documentation platforms:
Terraform registry adopts a flat representation more suitably, as the resources and data resources of TF usually have less level of attribute nesting and less model reuse than Kusion.
The approach of Pulumi Registry is closer to the method we are currently adopting on kusionstack.io website.(Though kusionstack.io does not include all the related models on the AppConfiguration schema page)
Pulumi registry adopts a navigation representation of nested schemas. All the related schemas are organized in a fixed section - Supporting Types
, so that all the related schemas are displayed on one page, and no duplication of reused schemas.
example: https://www.pulumi.com/registry/packages/grafana/api-docs/cloudaccesspolicy/
They all adopted a flat representation. (I believe that was for the purpose of quickly validating RESTful APIs)
Based on following facts:
Currently, we can continue the navigation way. Once our website and registry design are matured and we have more time to support the generation of HTML documentation, we can consider supporting the Spotlight way.
For now, we'll generate the doc for schemas and subpackage within the same package into a single package doc file.
Enhancement
Background
KCL focuses on model abstraction and configuration, and it's important to provide a clear overview of the attribute list and attribute details in the model documentation to both model maintainers and developers writing configurations based on the model.
The goal is to achieve that: With all information readily available in the doc, developers can write usable configurations without the need to navigate to other pages -- that requires all the configurable fields, along with their structures, constraints, and descriptions, can be obtained on a single page for the concerned model.
Design
Currently, the documentation generated by the KCL Doc tool only supports nested display of models, see konfig model docs on kusionstack.io.
flat(the way terraform registry adopted, example) and the nested representation, pros and cons:
Solution
provide an option on whether to display schema attributes in a flattened or nested way.