Class Schema
java.lang.Object
software.amazon.smithy.jsonschema.Schema
- All Implemented Interfaces:
ToNode,ToSmithyBuilder<Schema>
Defines a single JSON schema.
This supports a subset of the "draft-handrews-json-schema-validation-01" version of JSON Schema. The following properties are not supported:
- dependencies
- if
- then
- else
- examples
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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAbstract class used to build Schema components. -
Method Summary
Modifier and TypeMethodDescriptionstatic Schema.Builderbuilder()booleangetAllOf()getAnyOf()getExtension(String key) getItems()getNot()getOneOf()getProperty(String key) booleangetRef()getTitle()getType()booleanbooleaninthashCode()selectSchema(String... segments) Selects a nested schema using a variadic list of property names to descend into.Take this object and create a builder that contains all of the current property values of this object.toNode()Converts a value to aNode.
-
Method Details
-
builder
-
getRef
-
getType
-
getEnumValues
-
getConstValue
-
getDefaultValue
-
getMultipleOf
-
getMaximum
-
getExclusiveMaximum
-
getMinimum
-
getExclusiveMinimum
-
getMaxLength
-
getMinLength
-
getPattern
-
getItems
-
getMaxItems
-
getMinItems
-
getUniqueItems
public boolean getUniqueItems() -
getMaxProperties
-
getMinProperties
-
getRequired
-
getProperties
-
getProperty
-
getAdditionalProperties
-
getPropertyNames
-
getPatternProperties
-
getAllOf
-
getAnyOf
-
getOneOf
-
getNot
-
getTitle
-
getDescription
-
getFormat
-
getReadOnly
public boolean getReadOnly() -
getWriteOnly
public boolean getWriteOnly() -
getComment
-
getExamples
-
getContentEncoding
-
getContentMediaType
-
getExtension
-
getAllExtensions
-
toNode
Description copied from interface:ToNodeConverts a value to aNode. -
selectSchema
Selects a nested schema using a variadic list of property names to descend into.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();- Parameters:
segments- The properties names to retrieve.- Returns:
- Returns the selected Schema.
-
toBuilder
Description copied from interface:ToSmithyBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin interfaceToSmithyBuilder<Schema>- Returns:
- a builder for type T
-
equals
-
hashCode
public int hashCode()
-