Package com.networknt.schema
Class JsonMetaSchema
- java.lang.Object
-
- com.networknt.schema.JsonMetaSchema
-
public class JsonMetaSchema extends java.lang.Object
Represents a meta-schema which is uniquely identified by its IRI.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonMetaSchema.Builder
Builder forJsonMetaSchema
.static interface
JsonMetaSchema.FormatKeywordFactory
Factory for creating a format keyword.
-
Field Summary
Fields Modifier and Type Field Description private JsonMetaSchema.Builder
builder
private java.lang.String
idKeyword
private java.lang.String
iri
private java.util.Map<java.lang.String,Keyword>
keywords
private static org.slf4j.Logger
logger
private SpecVersion.VersionFlag
specification
private java.util.Map<java.lang.String,java.lang.Boolean>
vocabularies
-
Constructor Summary
Constructors Constructor Description JsonMetaSchema(java.lang.String iri, java.lang.String idKeyword, java.util.Map<java.lang.String,Keyword> keywords, java.util.Map<java.lang.String,java.lang.Boolean> vocabularies, SpecVersion.VersionFlag specification, JsonMetaSchema.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JsonMetaSchema.Builder
builder(JsonMetaSchema blueprint)
Create a builder.static JsonMetaSchema.Builder
builder(java.lang.String iri)
Create a builder without keywords or formats.static JsonMetaSchema.Builder
builder(java.lang.String iri, JsonMetaSchema blueprint)
Create a builder.boolean
equals(java.lang.Object obj)
java.lang.String
getIdKeyword()
java.lang.String
getIri()
java.util.Map<java.lang.String,Keyword>
getKeywords()
SpecVersion.VersionFlag
getSpecification()
static JsonMetaSchema
getV201909()
static JsonMetaSchema
getV202012()
static JsonMetaSchema
getV4()
static JsonMetaSchema
getV6()
static JsonMetaSchema
getV7()
java.util.Map<java.lang.String,java.lang.Boolean>
getVocabularies()
int
hashCode()
JsonValidator
newValidator(ValidationContext validationContext, SchemaLocation schemaLocation, JsonNodePath evaluationPath, java.lang.String keyword, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema)
Creates a new validator of the keyword.java.lang.String
readAnchor(com.fasterxml.jackson.databind.JsonNode schemaNode)
java.lang.String
readDynamicAnchor(com.fasterxml.jackson.databind.JsonNode schemaNode)
java.lang.String
readId(com.fasterxml.jackson.databind.JsonNode schemaNode)
private static java.lang.String
readText(com.fasterxml.jackson.databind.JsonNode node, java.lang.String field)
java.lang.String
toString()
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
-
iri
private final java.lang.String iri
-
idKeyword
private final java.lang.String idKeyword
-
keywords
private final java.util.Map<java.lang.String,Keyword> keywords
-
vocabularies
private final java.util.Map<java.lang.String,java.lang.Boolean> vocabularies
-
specification
private final SpecVersion.VersionFlag specification
-
builder
private final JsonMetaSchema.Builder builder
-
-
Constructor Detail
-
JsonMetaSchema
JsonMetaSchema(java.lang.String iri, java.lang.String idKeyword, java.util.Map<java.lang.String,Keyword> keywords, java.util.Map<java.lang.String,java.lang.Boolean> vocabularies, SpecVersion.VersionFlag specification, JsonMetaSchema.Builder builder)
-
-
Method Detail
-
getV4
public static JsonMetaSchema getV4()
-
getV6
public static JsonMetaSchema getV6()
-
getV7
public static JsonMetaSchema getV7()
-
getV201909
public static JsonMetaSchema getV201909()
-
getV202012
public static JsonMetaSchema getV202012()
-
builder
public static JsonMetaSchema.Builder builder(java.lang.String iri)
Create a builder without keywords or formats.Use
getV4()
for the Draft 4 Metaschema, or if you need a builder based on Draft4, useJsonMetaSchema.builder("http://your-metaschema-iri", JsonMetaSchema.getV4()).build();
- Parameters:
iri
- the IRI of the metaschema that will be defined via this builder.- Returns:
- a builder instance without any keywords or formats - usually not what one needs.
-
builder
public static JsonMetaSchema.Builder builder(java.lang.String iri, JsonMetaSchema blueprint)
Create a builder.- Parameters:
iri
- the IRI of your new JsonMetaSchema that will be defined via this builder.blueprint
- the JsonMetaSchema to base your custom JsonMetaSchema on.- Returns:
- a builder instance preconfigured to be the same as blueprint, but with a different uri.
-
builder
public static JsonMetaSchema.Builder builder(JsonMetaSchema blueprint)
Create a builder.- Parameters:
blueprint
- the JsonMetaSchema to base your custom JsonMetaSchema on.- Returns:
- a builder instance preconfigured to be the same as blueprint
-
getIdKeyword
public java.lang.String getIdKeyword()
-
readId
public java.lang.String readId(com.fasterxml.jackson.databind.JsonNode schemaNode)
-
readAnchor
public java.lang.String readAnchor(com.fasterxml.jackson.databind.JsonNode schemaNode)
-
readDynamicAnchor
public java.lang.String readDynamicAnchor(com.fasterxml.jackson.databind.JsonNode schemaNode)
-
readText
private static java.lang.String readText(com.fasterxml.jackson.databind.JsonNode node, java.lang.String field)
-
getIri
public java.lang.String getIri()
-
getKeywords
public java.util.Map<java.lang.String,Keyword> getKeywords()
-
getVocabularies
public java.util.Map<java.lang.String,java.lang.Boolean> getVocabularies()
-
getSpecification
public SpecVersion.VersionFlag getSpecification()
-
newValidator
public JsonValidator newValidator(ValidationContext validationContext, SchemaLocation schemaLocation, JsonNodePath evaluationPath, java.lang.String keyword, com.fasterxml.jackson.databind.JsonNode schemaNode, JsonSchema parentSchema)
Creates a new validator of the keyword.- Parameters:
validationContext
- the validation contextschemaLocation
- the schema locationevaluationPath
- the evaluation pathkeyword
- the keywordschemaNode
- the schema nodeparentSchema
- the parent schema- Returns:
- the validator
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-