API Connect

 View Only
Expand all | Collapse all

Validation policy - how to validate the response after invoke policy

  • 1.  Validation policy - how to validate the response after invoke policy

    Posted 10 days ago

    I am trying to validate the request and response using parse followed by validate policy. 

    Below is a simple policy to test this one. 

     

    I am able to validate the request message properly. The setting to validate request message set to

    I am able to capture the proper error message something like this:

    Validate: temporary:///swagger/test-dev_ai-test-app_1.0.0.json:247: [JSV0002] Invalid object: the property 'xyzID' is missing.

    But when I try to validate the response message with setting

    I am not getting proper response back. The message I get is: 

    Validate: Internal Validation Error
    Any clues here?


    ------------------------------
    Sandeepkumar Rane
    ------------------------------


  • 2.  RE: Validation policy - how to validate the response after invoke policy

    Posted 3 days ago

    Hi Sandeepkumar,
    The response-param should get the validation schema from your path's response object. 

      /your-path:
        get:
          responses:
            '200':
              description: success
              schema:
                type: string  <=== or a $ref to a #/definitions (OAI2) or #/components (OAI3)
          consumes: []
          produces: []

    Without seeing the API yaml file I can only speculate that the policy can't find the response schema.  Do you have access to the DataPower logs which would provide additional detail?
    Regards,
    Steve Linn



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------