class JSONSchema::NodeContext

Overview

Tracks the location of a JSON value within a JSON schema.

Defined in:

node_context.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(path = ".", parent = nil) #

[View source]

Instance Method Detail

def dig_into(input : JSON::Any) #

Calls JSON::Any#dig on a given input to dig to the value represented by this NodeContext.


[View source]
def from_property(prop : String) #

Create a child NodeContext based on self, taking into account whether self is the root node.


[View source]
def parent : NodeContext? #

[View source]
def parent=(parent : NodeContext?) #

[View source]
def path : String #

[View source]
def path=(path : String) #

[View source]
def to_s #

Get a string representation of the node's full path. The format is dot and square bracket notation, similar to the format expected by jq, a popular JSON querying CLI.

Example: .parent.children[0].example

The top-level . will always refer to the root node.


[View source]