Skip to content

Schema Tree

Read fields, types, constraints, and descriptions in a shared schema hierarchy. Branches expand with native browser controls, including when JavaScript is unavailable.

Default Rendered example
  • data object

    Data that helps a client respond to an operation failure. The fields depend on the type of error.

    • message string

      A human-readable explanation of the failure.

    • error_type string required

      Identifies the kind of failure.

      Allowed
      ERROR, ALREADY_EXISTS, NOT_FOUND
  • request_id string required

    Include this identifier when asking for support.

Usage Example
@schematree.SchemaTree(schematree.Config{
    AriaLabel: "Response schema",
    Nodes: []schematree.Node{{
        Name: "data", Type: "object",
        DescriptionContent: responseDescription(),
        Children: []schematree.Node{{
            Name: "error_type", Type: "string", Required: true,
            Description: "Identifies the kind of failure.",
        }},
    }},
})

Configuration schema

The same component accepts a JSON Schema adapter. Full property paths remain available on field names, and required state is expressed in words.

Configuration schema Rendered example
  • assets string

    Whether generated pages reference copied assets or embed supported assets.

    Allowed
    local, inline
    Default
    local
  • base_path string

    Normalized public path prefix used by links and canonical URLs.

    Default
    /
  • custom_css array

    Additional stylesheets for this site.

    Default
    []
    • items object
      • css_url string required
        minLength
        1
  • frame object

    Frame settings for the generated site.

    • builtin string
    • command string
Configuration schema
schematree.Node{
    Name: "custom_css", Path: "/custom_css", Type: "array",
    Description: "Additional stylesheets for this site.",
    Constraints: []schematree.Constraint{{Name: "Default", Value: "[]"}},
    Children: []schematree.Node{{
        Name: "items", Type: "object",
        Children: []schematree.Node{{
            Name: "css_url", Type: "string", Required: true,
            Constraints: []schematree.Constraint{{Name: "minLength", Value: "1"}},
        }},
    }},
}

Component descriptions

DescriptionContent overrides plain Description. Supply a rendered Markdown component, links, lists, or other block content; parse and sanitize external content in the caller.

Component descriptions Rendered example
  • plain string

    Text such as <strong> is escaped and displayed literally.

  • rich string

    Data that helps a client respond to an operation failure. The fields depend on the type of error.

  • a_very_long_property_name_that_must_remain_readable_on_a_narrow_mobile_screen array<string> required

    Field names wrap inside their column while state labels stay visible.

Component descriptions
schematree.Node{
    Name: "description", Type: "string",
    Description: "Plain text fallback",
    DescriptionContent: markdownDescription(),
}

Go API

v0.3.0

The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.

github.com/araihu/goshtoso/components/schematree
Open v0.3.0 API