com.networknt.schema.Version7 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-schema-validator Show documentation
Show all versions of json-schema-validator Show documentation
A json schema validator that supports draft v4, v6, v7, v2019-09 and v2020-12
package com.networknt.schema;
import java.util.Arrays;
public class Version7 extends JsonSchemaVersion{
private static final String URI = SchemaId.V7;
private static final String ID = "$id";
static {
// add version specific formats here.
//BUILTIN_FORMATS.add(pattern("phone", "^\\+(?:[0-9] ?){6,14}[0-9]$"));
}
@Override
public JsonMetaSchema getInstance() {
return new JsonMetaSchema.Builder(URI)
.specification(SpecVersion.VersionFlag.V7)
.idKeyword(ID)
.addFormats(BUILTIN_FORMATS)
.addKeywords(ValidatorTypeCode.getNonFormatKeywords(SpecVersion.VersionFlag.V7))
// keywords that may validly exist, but have no validation aspect to them
.addKeywords(Arrays.asList(
new NonValidationKeyword("$schema", false),
new NonValidationKeyword("$id", false),
new NonValidationKeyword("title"),
new NonValidationKeyword("description"),
new NonValidationKeyword("default"),
new NonValidationKeyword("definitions", false),
new NonValidationKeyword("$comment"),
new NonValidationKeyword("examples"),
new NonValidationKeyword("then"),
new NonValidationKeyword("else"),
new NonValidationKeyword("additionalItems"),
new NonValidationKeyword("message", false)
))
.build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy