This documentation is for WSO2 Open Banking version 1.3.0. View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

This feature is available as a product update from  June 25, 2019 (06-25-2019) onwards. Apply the update and follow the instructions given below to use the feature.

Request Payload Validation adds flexibility to validate an incoming request against any customisations done to the swagger definition. For example, remove an enumeration from an existing set and check whether the incoming request contains the defined enumerations. 

According to the following sample payload, the given account number formats are accepted.

If your API supports only the UK.OBIE.IBAN and UK.OBIE.SortCodeAccountNumber account number formats, you can simply modify the published swagger file and republish the API for the modifications to take effect.

When an API is published, the swagger file is added as a local entry and saved under the <WSO2_OB_APIM_HOME>/repository/deployment/server/synapse-configs/default/local-entries directory.

To add the swagger as a local entry, the created and published API lifecycles are extended using customised API executor named For more information on executors, see Extension Points of API Life cycle.  

Extend API lifecycle

  1. Go to API Manager - Management Console at https://<WSO2_OB_APIM_HOST>:9443/carbon.

  2. Navigate to the Extensions tab and click lifecycles.
  3. Select View/Edit of APILifeCycle.
  4. Add the following changes to the XML file, under the respective tags to enable publishing the swagger as a local entry in the <WSO2_OB_APIM_HOST>/repository/deployment/server/synapse-configs/default/local-entries directory.

    • In the state id= "Published"element, add a new execution element under data name="transitionExecution" with the properties below:

      <state id="Published">
             <data name="transitionExecution">
                 <execution forEvent="Publish" 
    • In the state id=“Created” element, under data name=“transitionExecution” find the default execution class value for event “Publish”. Replace that default execution class with as follows:

      <state id="Created">
           <data name="transitionExecution">
                <execution forEvent="Publish"

Configure request validation handler

Open the <WSO2_OB_APIM_HOME>/repository/resources/api_templates/velocity_template.xml file and configure RequestSchemaValidationHandler as follows:

#if($apiObj.additionalProperties.get("ob-spec") == "uk")

##add request validation handler
##Request validator should come before Signature validator.
#if($!apiVersion == "v3.0" || $!apiVersion == "v3.1" || $!apiVersion == "v3.1.1" || $!apiVersion == "v2.0")

<handler class=""/>

Republish APIs

You need to republish the API to apply the swagger based validations. Therefore, follow the steps below:

  1. Sign in to the API Publisher at https://<WSO2_OB_APIM_HOST>:9443/publisher using the credentials of a user, whose role is an API Publisher. For more information on users and roles, see here.
  2. Select the respective API and click Edit API.
  3. You are redirected to the  Design  phase. Click the  Edit Source button  under  API Definition  section.
  4. In the Swagger Editor menu bar, select File>Import File.
  5. Browse for the intended  swagger file (.yaml) in the <WSO2_OB_APIM_HOME>/repository/resources/finance/apis directory  and click Open File.

    WSO2 Open Banking has improved the UK specific payment swagger files of version-3 APIs as their existing data definitions do not allow swagger-based validations. Following are the improved swagger files:

    Do the customisations to the improved swagger file and upload the swagger before republishing the API.

  6. Click  Apply Changes to save the changes and go back to the  Design  page.
  7. Scroll down and click Save.
  8. Click Next: Implement > Next: Manage and Save and Publish.

  • No labels