Class JsonValidator

All Implemented Interfaces:
FrankElement, HasApplicationContext, HasName, HasTransactionAttribute, IConfigurable, IDualModeValidator, IForwardTarget, IPipe, IScopeProvider, IValidator, IWithParameters, NameAware, EventThrowing, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle

@Category(BASIC) public class JsonValidator extends AbstractValidator
Pipe that validates the input message against a JSON Schema.
Author:
Gerrit van Brakel
  • Constructor Details

    • JsonValidator

      public JsonValidator()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from class: FixedForwardPipe
      Checks for correct configuration of forward.
      Specified by:
      configure in interface IConfigurable
      Overrides:
      configure in class AbstractValidator
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • start

      public void start()
      Description copied from interface: IPipe
      Perform necessary action to start the pipe. This method is executed after the IConfigurable.configure() method, for each start and stop command of the adapter.
      Specified by:
      start in interface IPipe
      Specified by:
      start in interface org.springframework.context.Lifecycle
      Overrides:
      start in class AbstractPipe
    • validate

      protected PipeForward validate(Message messageToValidate, PipeLineSession session, boolean responseMode, String messageRoot) throws PipeRunException
      Specified by:
      validate in class AbstractValidator
      Throws:
      PipeRunException
    • getJsonSchema

      protected org.leadpony.justify.api.JsonSchema getJsonSchema() throws IOException
      Throws:
      IOException
    • setSchema

      @Mandatory public void setSchema(String schema)
      The JSON Schema to validate to
    • setSubSchemaPrefix

      public void setSubSchemaPrefix(String prefix)
      The subSchemaPrefix is an optional attribute used when referencing a subschema located in a nested structure, such as $defs or definitions. Adding only the subSchema attribute is not enough if your schema organizes definitions in nested objects. Add root attribute to complete the process.
      Default value
      /definitions/
    • setReasonSessionKey

      public void setReasonSessionKey(String reasonSessionKey)
      If set: creates a sessionKey to store any errors when validating the json output
      Default value
      failureReason