Skip to main content

render_sectioned_field_table

Function render_sectioned_field_table 

Source
pub fn render_sectioned_field_table(schema: &Value) -> String
Expand description

Render the root schema’s top-level properties as separate, captioned subsections instead of one flat table.

These subsections are easier to scan than the large dense table that render_field_table produces.

Each top-level property that resolves to an object, that is to a schema with properties, gets its own ## <key> heading, its description as a blurb, and a focused field table. The rows of that table are relative to the subtree, so the function removes the leading <key>. prefix. All the other top-level properties go under one leading ## General section, as one table keyed by the bare property name. These are the scalars, the arrays, and the objects without properties. A --- horizontal rule separates the sections.

This function shares all the type, default, description, and escaping logic with render_field_table through effective_schema, type_label, render_default, and collect_rows. render_field_table keeps its flat layout, so the CRD pages and the other pages keep that layout too.