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
      Specified by:
      configure in interface IPipe
      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 IPipe.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

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

      public void setSubSchemaPrefix(String prefix)
      Prefix to element name to find subschema in schema
      Default value
      /definitions/
    • setReasonSessionKey

      public void setReasonSessionKey(String reasonSessionKey)
      If set: key of session variable to store reasons of mis-validation in
      Default value
      failureReason
    • getSchema

      public String getSchema()
    • getSubSchemaPrefix

      public String getSubSchemaPrefix()
    • getReasonSessionKey

      public String getReasonSessionKey()