Class SchemaDocument

java.lang.Object
software.amazon.smithy.jsonschema.SchemaDocument
All Implemented Interfaces:
ToNode, ToSmithyBuilder<SchemaDocument>

public final class SchemaDocument extends Object implements ToNode, ToSmithyBuilder<SchemaDocument>
Represents a JSON Schema document.
See Also:
  • Method Details

    • builder

      public static SchemaDocument.Builder builder()
      Returns a builder used to create a SchemaDocument.
      Returns:
      Returns the created builder.
    • toNode

      public Node toNode()
      Description copied from interface: ToNode
      Converts a value to a Node.
      Specified by:
      toNode in interface ToNode
      Returns:
      Returns the creates Node.
    • toBuilder

      public SchemaDocument.Builder toBuilder()
      Description copied from interface: ToSmithyBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToSmithyBuilder<SchemaDocument>
      Returns:
      a builder for type T
    • getRootSchema

      public Schema getRootSchema()
      Gets the root schema definition.
      Returns:
      Returns the root schema.
      See Also:
    • getIdKeyword

      public Optional<String> getIdKeyword()
      Gets the "$id" keyword of the document.
      Returns:
      Returns the optionally defined $id.
      See Also:
    • getSchemaKeyword

      public Optional<String> getSchemaKeyword()
      Gets the "$schema" keyword of the document.
      Returns:
      Returns the optionally defined $schema.
      See Also:
    • getDefinition

      public Optional<Schema> getDefinition(String pointer)
      Gets a schema definition from the "definitions" map using a JSON pointer.

      The "root" schema is returned if pointer is an empty string.

      Parameters:
      pointer - JSON Schema pointer to retrieve.
      Returns:
      Returns the optionally found schema definition.
    • getDefinitions

      public Map<String,Schema> getDefinitions()
      Gets all of the schema definitions defined in the "definitions" map.
      Returns:
      Returns the defined schema definitions.
      See Also:
    • getExtension

      public Optional<Node> getExtension(String key)
      Gets an extension value by name.
      Parameters:
      key - Name of the extension to retrieve.
      Returns:
      Returns the extension object.
    • getExtensions

      public ObjectNode getExtensions()
      Gets all extensions of the schema document.
      Returns:
      Returns the extensions added to the schema.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object