class
Jargon::Schema
- Jargon::Schema
- Reference
- Object
Overview
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.
Defined in:
jargon/schema.crConstructors
-
.from_file(path : String) : Schema
Build a Schema from a JSON Schema file.
-
.from_json(json_string : String) : Schema
Build a Schema from a JSON Schema document (string).
-
.from_json_any(json : JSON::Any) : Schema
Build a Schema from an already-parsed JSON document.
- .new(root : Property, definitions : Hash(String, Property) = {} of String => Property, positional : Array(String) = [] of String)
Instance Method Summary
- #definitions : Hash(String, Property)
- #positional : Array(String)
-
#resolve_ref(ref : String) : Property | Nil
Resolve a local
$refpointer (e.g. - #root : Property
Constructor Detail
Build a Schema from a JSON Schema document (string).
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.
def self.new(root : Property, definitions : Hash(String, Property) = {} of String => Property, positional : Array(String) = [] of String)
#
Instance Method Detail
Resolve a local $ref pointer (e.g. #/$defs/Name) to its definition,
or nil if the pointer is non-local or unknown.