class

Jargon::Schema

Inherits Reference < Object

A parsed JSON Schema describing one command: its root property (the object whose properties are the command's options), the named positional arguments, and any reusable definitions ($defs/definitions) that $ref resolves against.

Constructors

from_file(path : String) : Schema

Build a Schema from a JSON Schema file.

Source
from_json(json_string : String) : Schema

Build a Schema from a JSON Schema document (string).

Source
from_json_any(json : JSON::Any) : Schema

Build a Schema from an already-parsed JSON document. The whole document is the root property; positional and definitions/$defs are lifted out alongside it.

Source
new(root : Property, definitions : Hash(String, Property) = {} of String => Property, positional : Array(String) = [] of String)
Source

Instance methods

definitions
Source
positional
Source
resolve_ref(ref : String) : Property | Nil

Resolve a local $ref pointer (e.g. #/$defs/Name) to its definition, or nil if the pointer is non-local or unknown.

Source
root
Source