App Connect

 View Only
  • 1.  Json payload validation

    Posted Fri November 26, 2021 10:28 AM
    Hi, trying to validate json message through Rest Request node.
    Properties set at node level are -
    Message Domain- json
    Message model- swagger.json
    Message- /paths/~test/{id}/put/responses/200/schema
    As resource uri in swagger schema is - /test/{id}

    Validation- content and value
    Parsing- immediate

    I'm getting "Validation is enabled but no json schema file name given".
    Is above path handling is correct?

    Dinesh Kumar

  • 2.  RE: Json payload validation

    Posted Tue November 30, 2021 10:20 AM
    This is a new feature in v12:

    Did you deploy the schema as indicated on that page?


  • 3.  RE: Json payload validation

    Posted Tue November 30, 2021 11:18 AM
    Edited by Martin Boag Tue November 30, 2021 12:23 PM


    Ensure you are setting the correct REST API file name to match the file deployed in your application, see the screen grab below for example.

    Also often the JSON models for REST API responses are often provided in the Swagger "definitions" or OpenAPI 3 "components/schemas" section, and it's much simpler to provide the JSON path directly to that.

    For example the standard Pets Store Swagger 2 example  operation "getPetById" defines its response as

     "schema" : {  "$ref" : "#/definitions/Pet"  }

    So we can use the simple JSON pointer "/definitions/Pet" directly in the "Message" property on the REST Request node as in the screen grab below.

    For reference the more complex JSON pointer for this would be "/paths/~1pet~1{petId}/get/responses/200/schema", noting that in JSON Pointers any "/" must be escaped as "~1", hence the "getPetById" operations path "/pet/{getId}" becomes "~1pet~1{petId}".

    REST Request node JSON schema validation example for Pet Store


    Martin Boag
    Software Developer