Class SchemaDocument
- java.lang.Object
-
- software.amazon.smithy.jsonschema.SchemaDocument
-
- All Implemented Interfaces:
ToNode
,ToSmithyBuilder<SchemaDocument>
public final class SchemaDocument extends java.lang.Object implements ToNode, ToSmithyBuilder<SchemaDocument>
Represents a JSON Schema document.- See Also:
- JSON Schema specification
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SchemaDocument.Builder
Builds a JSON Schema document.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SchemaDocument.Builder
builder()
Returns a builder used to create aSchemaDocument
.boolean
equals(java.lang.Object o)
java.util.Optional<Schema>
getDefinition(java.lang.String pointer)
Gets a schema definition from the "definitions" map using a JSON pointer.java.util.Map<java.lang.String,Schema>
getDefinitions()
Gets all of the schema definitions defined in the "definitions" map.java.util.Optional<Node>
getExtension(java.lang.String key)
Gets an extension value by name.ObjectNode
getExtensions()
Gets all extensions of the schema document.java.util.Optional<java.lang.String>
getIdKeyword()
Gets the "$id" keyword of the document.Schema
getRootSchema()
Gets the root schema definition.java.util.Optional<java.lang.String>
getSchemaKeyword()
Gets the "$schema" keyword of the document.int
hashCode()
SchemaDocument.Builder
toBuilder()
Take this object and create a builder that contains all of the current property values of this object.Node
toNode()
Converts a value to aNode
.
-
-
-
Method Detail
-
builder
public static SchemaDocument.Builder builder()
Returns a builder used to create aSchemaDocument
.- Returns:
- Returns the created builder.
-
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 interfaceToSmithyBuilder<SchemaDocument>
- Returns:
- a builder for type T
-
getRootSchema
public Schema getRootSchema()
Gets the root schema definition.- Returns:
- Returns the root schema.
- See Also:
- Root schema
-
getIdKeyword
public java.util.Optional<java.lang.String> getIdKeyword()
Gets the "$id" keyword of the document.- Returns:
- Returns the optionally defined $id.
- See Also:
- $id
-
getSchemaKeyword
public java.util.Optional<java.lang.String> getSchemaKeyword()
Gets the "$schema" keyword of the document.- Returns:
- Returns the optionally defined $schema.
- See Also:
- $schema
-
getDefinition
public java.util.Optional<Schema> getDefinition(java.lang.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 java.util.Map<java.lang.String,Schema> getDefinitions()
Gets all of the schema definitions defined in the "definitions" map.- Returns:
- Returns the defined schema definitions.
- See Also:
- Schema reuse with "definitions"
-
getExtension
public java.util.Optional<Node> getExtension(java.lang.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(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-