balli.json-schema

Schema -> JSON Schema export (Malli's malli.json-schema). transform takes a raw schema form or a balli schema object (plus optional opts {:registry r}, ignored when given a schema object -- its baked-in registry wins) and returns a STRING-KEYED Basilisp map shaped like a JSON Schema document (draft 2020-12: :tuple uses prefixItems + items false). Per-node result (mirrors Malli's -json-schema-walker): (or (:json-schema props) ; whole-node override, verbatim (merge {title/description/default} ; passthrough props (generated type mapping) (unlifted :json-schema/* props))) ; :json-schema/foo -> \"foo\", wins Keywords render as name strings (\"ns/name\" when qualified) -- map keys, :enum values, := consts, :default values. Refs emit {\"$ref\" \"#/definitions/\"} with the name JSON-Pointer escaped per RFC 6901 (~ -> ~0 FIRST, then / -> ~1); the top-level \"definitions\" map (attached only when non-empty) is keyed by the UNESCAPED name. Local {:registry ...} schema properties layer the lookup per subtree; a keyword SHADOWED to a different schema form emits a second definition suffixed __2 (__3, ...) with $refs pointing at the right one (see transform-ref). Recursion is guarded by marking a ref's [kw form] identity visited before recursing into its target, so recursive (local or global) registries terminate. Unresolved refs throw ex-info {:type :balli.core/unresolved-ref} (same contract as the validator compiler). The output is Basilisp data, not Python data: feed it to python json.dumps via a small clj->py conversion (or basilisp.json/write-str, which accepts it directly).

transform

Kind: defn

Export schema s (raw form or schema object) as a JSON Schema: a string-keyed Basilisp map. opts supports {:registry r} for raw forms (ignored when s is a schema object). When any refs were reached, the top-level map carries \