Class JSONSchemaAbstractUtils

java.lang.Object
eu.europa.esig.json.JSONSchemaAbstractUtils
Direct Known Subclasses:
AbstractJWSUtils, CryptographicSuiteJsonUtils

public abstract class JSONSchemaAbstractUtils extends Object
This class contains util methods for parsing and validation of JSON documents
  • Constructor Details

    • JSONSchemaAbstractUtils

      protected JSONSchemaAbstractUtils()
      Empty constructor
  • Method Details

    • validateAgainstSchema

      public List<String> validateAgainstSchema(InputStream is)
      Validates a JSON against JWS Schema according to ETSI TS 119 322 JSON schema
      Parameters:
      is - InputStream representing a JSON to validate
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstSchema

      public List<String> validateAgainstSchema(String jsonString)
      Validates a JSON against JWS Schema according to ETSI TS 119 322 JSON schema
      Parameters:
      jsonString - String representing a JSON to validate
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstSchema

      public List<String> validateAgainstSchema(JsonObjectWrapper jsonObjectWrapper)
      Validates a JSON against JWS Schema according to ETSI TS 119 322 JSON schema
      Parameters:
      jsonObjectWrapper - JsonObjectWrapper representing a JSON to validate
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstSchema

      public List<String> validateAgainstSchema(com.github.erosb.jsonsKema.JsonObject json)
      Validates a JSON against JWS Schema according to ETSI TS 119 322 JSON schema
      Parameters:
      json - JsonObject representing a JSON to validate
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • getSchema

      protected com.github.erosb.jsonsKema.Schema getSchema()
      Gets the schema according to the current JSON specification
      Returns:
      Schema
    • getSchemaURI

      public abstract String getSchemaURI()
      Gets URI for the current schema
      Returns:
      String
    • getSchemaDefinitions

      public abstract Map<URI,String> getSchemaDefinitions()
      Gets a list of schema definitions
      Returns:
      a map between schema URI's and their filesystem locations
    • getValidator

      protected com.github.erosb.jsonsKema.Validator getValidator()
      Gets a validator for the given JSON schema
      Returns:
      Validator
    • getJSONSchemaDefinitions

      public Map<URI,String> getJSONSchemaDefinitions()
      Returns a JSON Draft 7 Schema definition
      Returns:
      a map of definitions
    • loadSchema

      protected com.github.erosb.jsonsKema.Schema loadSchema(String schemaJSON, Map<URI,String> definitions)
      Loads schema with the given list of definitions (references)
      Parameters:
      schemaJSON - JsonObject the schema object URI
      definitions - a map containing definitions and their reference names
      Returns:
      Schema