Interface JsonSchemaReader

  • 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 String CUSTOM_FORMATS
      The property used to specify whether the schema reader uses custom format attributes or not.
      static String DEFAULT_SPEC_VERSION
      The property used to specify the default version of the JSON Schema specification.
      static String METASCHEMA
      The property used to specify the metaschema to be used when validating the schema.
      static String RESOLVERS
      The property used to specify the list of schema resolvers.
      static String SCHEMA_VALIDATION
      The property used to specify whether the schema reader validates the schema against the metaschema or not.
      static String SPEC_VERSION_DETECTION
      The property used to specify whether the automatic detection of specification version is enabled or not.
      static String STRICT_FORMATS
      The property used to specify whether the schema reader is strict with formats or not.
      static String STRICT_KEYWORDS
      The 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
      void close()
      Closes this reader and frees any resources associated with this reader.
      JsonSchema read()
      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
      • 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

      • close

        void close()
        Closes this reader and frees any resources associated with this reader. This method closes the underlying input source.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Throws:
        JsonException - if an I/O error occurs while closing this reader.