-
- All Superinterfaces:
AutoCloseable,Closeable
public interface JsonSchemaReader extends Closeable
A reader interface for reading a JSON schema from an input source.The following example shows how to read a JSON schema from a string:
JsonValidationService service = JsonValidationService.newInstance(); StringReader reader = new StringReader("{\"type\": \"integer\"}"); JsonSchemaReader schemaReader = service.createSchemaReader(reader); JsonSchema schema = schemaReader.read(); schemaReader.close();Each instance of this type is NOT safe for use by multiple concurrent threads.
- Author:
- leadpony
-
-
Field Summary
Fields Modifier and Type Field Description static StringCUSTOM_FORMATSThe property used to specify whether the schema reader uses custom format attributes or not.static StringDEFAULT_SPEC_VERSIONThe property used to specify the default version of the JSON Schema specification.static StringMETASCHEMAThe property used to specify the metaschema to be used when validating the schema.static StringRESOLVERSThe property used to specify the list of schema resolvers.static StringSCHEMA_VALIDATIONThe property used to specify whether the schema reader validates the schema against the metaschema or not.static StringSPEC_VERSION_DETECTIONThe property used to specify whether the automatic detection of specification version is enabled or not.static StringSTRICT_FORMATSThe property used to specify whether the schema reader is strict with formats or not.static StringSTRICT_KEYWORDSThe property used to specify whether the schema reader is strict with keywords or not.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes this reader and frees any resources associated with this reader.JsonSchemaread()Returns a JSON schema that is represented in the input source.
-
-
-
Field Detail
-
STRICT_KEYWORDS
static final String STRICT_KEYWORDS
The property used to specify whether the schema reader is strict with keywords or not.- See Also:
- Constant Field Values
-
STRICT_FORMATS
static final String STRICT_FORMATS
The property used to specify whether the schema reader is strict with formats or not.- See Also:
- Constant Field Values
-
CUSTOM_FORMATS
static final String CUSTOM_FORMATS
The property used to specify whether the schema reader uses custom format attributes or not.- See Also:
- Constant Field Values
-
RESOLVERS
static final String RESOLVERS
The property used to specify the list of schema resolvers.- See Also:
- Constant Field Values
-
DEFAULT_SPEC_VERSION
static final String DEFAULT_SPEC_VERSION
The property used to specify the default version of the JSON Schema specification.- See Also:
- Constant Field Values
-
SCHEMA_VALIDATION
static final String SCHEMA_VALIDATION
The property used to specify whether the schema reader validates the schema against the metaschema or not.- See Also:
- Constant Field Values
-
SPEC_VERSION_DETECTION
static final String SPEC_VERSION_DETECTION
The property used to specify whether the automatic detection of specification version is enabled or not.- See Also:
- Constant Field Values
-
METASCHEMA
static final String METASCHEMA
The property used to specify the metaschema to be used when validating the schema.- See Also:
- Constant Field Values
-
-
Method Detail
-
read
JsonSchema read()
Returns a JSON schema that is represented in the input source. This method needs to be called only once for a reader instance.- Returns:
- the JSON schema, never be
null. - Throws:
JsonException- if an I/O error occurs while reading.JsonParsingException- if the parser encounters invalid JSON while reading.JsonValidatingException- if the reader found any problems during validation of the schema.IllegalStateException- ifread()orclose()method is already called.
-
close
void close()
Closes this reader and frees any resources associated with this reader. This method closes the underlying input source.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
JsonException- if an I/O error occurs while closing this reader.
-
-