gargamelle/documentation
Optional HTML documentation for Gargamelle’s emitted schema vocabulary. This is a presentation module, not a general JSON Schema validator.
Types
A rejected example’s zero-based position and ordinary validation errors.
pub type ExampleError {
ExampleError(index: Int, errors: List(gargamelle.DataError))
}
Constructors
-
ExampleError(index: Int, errors: List(gargamelle.DataError))
Values
pub fn escape_html(s: String) -> String
Escape both text and double-quoted HTML attribute values.
pub fn render(
definition: gargamelle.Definition(a),
id: String,
) -> String
Render a definition with every shared definition visible in its own section. Supply a unique article ID when embedding multiple contracts on one page.
pub fn render_emitted(
source: String,
id: String,
aliases: List(#(String, String)),
) -> Result(String, String)
Render JSON emitted by Gargamelle. Aliases are optional presentation-only pairs (omitted definition, displayed definition); they must name existing definitions and point directly to a displayed definition. They do not change the schema or decoding. Explain any such compression in the surrounding page.
pub fn render_examples(
definition: gargamelle.Definition(a),
id: String,
examples: List(gargamelle.Value),
) -> Result(String, List(ExampleError))
Validate admitted input examples before displaying them. This never invokes decoding callbacks or modifies schema acceptance. Examples are JSON inputs, not decoded values; checking again at render time prevents silent drift.