Class OpenApiValidator

All Implemented Interfaces:
AdapterAware, 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 OpenApiValidator extends AbstractValidator
Pipe that validates the input message against an OpenAPI specification.
Author:
evandongen
  • Constructor Details

    • OpenApiValidator

      public OpenApiValidator()
  • 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.
    • validate

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

      @Mandatory public void setOpenApiDefinition(String openApiDefinition)
      The OpenAPI specification file to validate against. This should be a JSON file containing the OpenAPI specification. The file should be available on the classpath.
    • setPath

      @Mandatory public void setPath(String path)
      Set the path in the OpenAPI specification to validate against. This is used in combination with the method attribute to validate against a specific operation in the OpenAPI specification.
    • setMethod

      @Mandatory public void setMethod(String method)
      Set the HTTP method to validate against. This is used in combination with the path attribute to validate against a specific operation in the OpenAPI specification.
    • setReasonSessionKey

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

      public void setUseAsOutputValidator(boolean useAsOutputValidator)
      Mark this Validator as configured for mixed validation, meaning it will be used for both request and response validation. Depending solely on the responseRoot being set is not sufficient, since in case of OpenApiValidator, the resposeRoot is not used, but it is still a mixed validator.
      Default value
      false
    • isConfiguredForMixedValidation

      protected boolean isConfiguredForMixedValidation()
      Overrides:
      isConfiguredForMixedValidation in class AbstractValidator