AnsweredAssumed Answered

JSON Schema Assertion Unexpected behaviour

Question asked by Samuel Vandecasteele on Nov 30, 2017
Latest reply on Dec 1, 2017 by Seenu_Mathew

Hi all

 

I have problem defining optional field in a JSON Schema. The API Gateway JSON Schema validation Assertion does not interpret the JSON Schema as expected. According to the standard the "LegacyKeys" should be optional but the assertions thinks otherwise

 

We are currently on CA API Gateway 9.1


Can anyone clarify or suggest a workaround?

 

My Schema:

 

 {

  "type": "object",

  "properties": {

    "VEName": {

      "type": "string",

      "minLength": 1

    },

    "PeriDBSequence": {

      "type": "string",

      "pattern": "^(\\d*)$"

    },

    "LegacyKeys": {

      "type": "string",

      "pattern": "^((\\d*)(,\\d+)*)$",

      "minLength": 1

    }

  },

  "required" : [ "VEName", "PeriDBSequence"]

}

 

Input json:

{

                "VEName": "TownOfA",

                "PeriDBSequence": "3318673"

}

 

Unexpected fault: 

$.LegacyKeys: is missing and it is not optional

 

Kind regards
Samuel

Outcomes