gleamunison/sap
Schema-Aligned Parsing (gap analysis concept B).
Liberal-in-what-you-accept repair of near-miss model output: fences, yapping, comments, trailing commas, single quotes, unquoted keys, Python literals — then strict decode, then validation against a JSON-native Schema (bridged from core ast.Type). Pure Gleam, no FFI.
Types
pub type SapError {
NoJsonFound
StrictError(reason: String)
ValidationFailed(paths: List(String))
}
Constructors
-
NoJsonFound -
StrictError(reason: String) -
ValidationFailed(paths: List(String))
Values
pub fn decode_as(
text: String,
schema: Schema,
) -> Result(dynamic.Dynamic, SapError)
Repair, decode, and validate against a schema.
pub fn parse(text: String) -> Result(String, SapError)
Repair near-miss model output into strict JSON text.