Package com.networknt.schema
Class SpecVersionDetector
- java.lang.Object
-
- com.networknt.schema.SpecVersionDetector
-
public final class SpecVersionDetector extends Object
This class is used to detect schema version- Since:
- 25/06/20
- Author:
- Subhajitdas298
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SpecVersion.VersionFlagdetect(com.fasterxml.jackson.databind.JsonNode jsonNode)Detects schema version based on the schema tag: if the schema tag is not present, throwsJsonSchemaExceptionwith the corresponding message, otherwise - returns the detected spec version.static Optional<SpecVersion.VersionFlag>detectOptionalVersion(com.fasterxml.jackson.databind.JsonNode jsonNode)static Optional<SpecVersion.VersionFlag>detectOptionalVersion(String schemaUri)
-
-
-
Method Detail
-
detect
public static SpecVersion.VersionFlag detect(com.fasterxml.jackson.databind.JsonNode jsonNode)
Detects schema version based on the schema tag: if the schema tag is not present, throwsJsonSchemaExceptionwith the corresponding message, otherwise - returns the detected spec version.- Parameters:
jsonNode- JSON Node to read from- Returns:
- Spec version if present, otherwise throws an exception
-
detectOptionalVersion
public static Optional<SpecVersion.VersionFlag> detectOptionalVersion(com.fasterxml.jackson.databind.JsonNode jsonNode)
Detects schema version based on the schema tag: if the schema tag is not present, returns an emptyOptionalvalue, otherwise - returns the detected spec version wrapped intoOptional.- Parameters:
jsonNode- JSON Node to read from- Returns:
- Spec version if present, otherwise empty
-
detectOptionalVersion
public static Optional<SpecVersion.VersionFlag> detectOptionalVersion(String schemaUri)
-
-