public final class Schema extends java.lang.Object implements ToNode, ToSmithyBuilder<Schema>
This supports a subset of the "draft-handrews-json-schema-validation-01" version of JSON Schema. The following properties are not supported:
Custom properties can be added to the scheme using the
Schema.Builder.putExtension(java.lang.String, software.amazon.smithy.model.node.ToNode)
method. Custom properties are merged with
the schema document when serializing it to a Node
object. Any
extension properties that conflict with built-in properties overwrite the
built-in property.
Modifier and Type | Class and Description |
---|---|
static class |
Schema.Builder
Abstract class used to build Schema components.
|
Modifier and Type | Method and Description |
---|---|
static Schema.Builder |
builder() |
boolean |
equals(java.lang.Object o) |
java.util.Optional<Schema> |
getAdditionalProperties() |
java.util.Map<java.lang.String,ToNode> |
getAllExtensions() |
java.util.List<Schema> |
getAllOf() |
java.util.List<Schema> |
getAnyOf() |
java.util.Optional<java.lang.String> |
getComment() |
java.util.Optional<Node> |
getConstValue() |
java.util.Optional<java.lang.String> |
getContentEncoding() |
java.util.Optional<java.lang.String> |
getContentMediaType() |
java.util.Optional<Node> |
getDefaultValue() |
java.util.Optional<java.lang.String> |
getDescription() |
java.util.Optional<java.util.Collection<java.lang.String>> |
getEnumValues() |
java.util.Optional<Node> |
getExamples() |
java.util.Optional<java.lang.Number> |
getExclusiveMaximum() |
java.util.Optional<java.lang.Number> |
getExclusiveMinimum() |
java.util.Optional<ToNode> |
getExtension(java.lang.String key) |
java.util.Optional<java.lang.String> |
getFormat() |
java.util.Optional<Schema> |
getItems() |
java.util.Optional<java.lang.Number> |
getMaximum() |
java.util.Optional<java.lang.Integer> |
getMaxItems() |
java.util.Optional<java.lang.Long> |
getMaxLength() |
java.util.Optional<java.lang.Integer> |
getMaxProperties() |
java.util.Optional<java.lang.Number> |
getMinimum() |
java.util.Optional<java.lang.Integer> |
getMinItems() |
java.util.Optional<java.lang.Long> |
getMinLength() |
java.util.Optional<java.lang.Integer> |
getMinProperties() |
java.util.Optional<java.lang.Number> |
getMultipleOf() |
java.util.Optional<Schema> |
getNot() |
java.util.List<Schema> |
getOneOf() |
java.util.Optional<java.lang.String> |
getPattern() |
java.util.Map<java.lang.String,Schema> |
getPatternProperties() |
java.util.Map<java.lang.String,Schema> |
getProperties() |
java.util.Optional<Schema> |
getProperty(java.lang.String key) |
java.util.Optional<Schema> |
getPropertyNames() |
boolean |
getReadOnly() |
java.util.Optional<java.lang.String> |
getRef() |
java.util.Collection<java.lang.String> |
getRequired() |
java.util.Optional<java.lang.String> |
getTitle() |
java.util.Optional<java.lang.String> |
getType() |
boolean |
getUniqueItems() |
boolean |
getWriteOnly() |
int |
hashCode() |
java.util.Optional<Schema> |
selectSchema(java.lang.String... segments)
Selects a nested schema using a variadic list of property names
to descend into.
|
Schema.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 a
Node . |
public static Schema.Builder builder()
public java.util.Optional<java.lang.String> getRef()
public java.util.Optional<java.lang.String> getType()
public java.util.Optional<java.util.Collection<java.lang.String>> getEnumValues()
public java.util.Optional<Node> getConstValue()
public java.util.Optional<Node> getDefaultValue()
public java.util.Optional<java.lang.Number> getMultipleOf()
public java.util.Optional<java.lang.Number> getMaximum()
public java.util.Optional<java.lang.Number> getExclusiveMaximum()
public java.util.Optional<java.lang.Number> getMinimum()
public java.util.Optional<java.lang.Number> getExclusiveMinimum()
public java.util.Optional<java.lang.Long> getMaxLength()
public java.util.Optional<java.lang.Long> getMinLength()
public java.util.Optional<java.lang.String> getPattern()
public java.util.Optional<Schema> getItems()
public java.util.Optional<java.lang.Integer> getMaxItems()
public java.util.Optional<java.lang.Integer> getMinItems()
public boolean getUniqueItems()
public java.util.Optional<java.lang.Integer> getMaxProperties()
public java.util.Optional<java.lang.Integer> getMinProperties()
public java.util.Collection<java.lang.String> getRequired()
public java.util.Map<java.lang.String,Schema> getProperties()
public java.util.Optional<Schema> getProperty(java.lang.String key)
public java.util.Optional<Schema> getAdditionalProperties()
public java.util.Optional<Schema> getPropertyNames()
public java.util.Map<java.lang.String,Schema> getPatternProperties()
public java.util.List<Schema> getAllOf()
public java.util.List<Schema> getAnyOf()
public java.util.List<Schema> getOneOf()
public java.util.Optional<Schema> getNot()
public java.util.Optional<java.lang.String> getTitle()
public java.util.Optional<java.lang.String> getDescription()
public java.util.Optional<java.lang.String> getFormat()
public boolean getReadOnly()
public boolean getWriteOnly()
public java.util.Optional<java.lang.String> getComment()
public java.util.Optional<Node> getExamples()
public java.util.Optional<java.lang.String> getContentEncoding()
public java.util.Optional<java.lang.String> getContentMediaType()
public java.util.Optional<ToNode> getExtension(java.lang.String key)
public java.util.Map<java.lang.String,ToNode> getAllExtensions()
public java.util.Optional<Schema> selectSchema(java.lang.String... segments)
For example, this method can be used to get the items schema nested inside of an array inside of an object:
Schema itemsSchema = schema.selectSchema("properties", "foo", "items").get();
segments
- The properties names to retrieve.public Schema.Builder toBuilder()
ToSmithyBuilder
toBuilder
in interface ToSmithyBuilder<Schema>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object