Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Hence, adding JSON Schema support in addition to Avro support in APEX-PDP can be beneficial.
In addition to the support for optional fields, JSON Schema support can help in writing the schema and using the fields in the logic itself much more simple and straightforward.

Note: Avro schema will continue to be supported in APEX-PDP, JSON Schema support will come in addition to Avro support.

What are the potential solutions?

...

Code Block
languageyml
{
  "definitions": {},
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Root",
  "type": "object",
  "required": [
    "requestId",
    "subRequestId",
    "originatorId"
  ],
  "properties": {
    "requestId": {
      "$id": "#root/requestId",
      "title": "Requestid",
      "type": "string",
      "default": "",
      "examples": [
        "123456-1000"
      ],
      "pattern": "^.*$"
    },
    "subRequestId": {
      "$id": "#root/subRequestId",
      "title": "Subrequestid",
      "type": "string",
      "default": "",
      "examples": [
        "sub-123456-1000"
      ],
      "pattern": "^.*$"
    },
    "originatorId": {
      "$id": "#root/originatorId",
      "title": "Originatorid",
      "type": "string",
      "default": "",
      "examples": [
        "sdnc"
      ],
      "pattern": "^.*$"
    }
  }
}

Note: If a field is optional, then do not mention it in the required fields list.

5) In the logic file

  • The extra complexity of using "_DoT_" instead of ".", "_DasH_" instead of "-" and "_ColoN_" instead of ":" will be removed and the field names can be directly used.
  • createNewInstance and createNewSubInstance methods will probably not be needed with JsonSchema supportwhen populating fields that are defined using JSON Schema. HashMap, ArrayList etc can directly be created and used as these could can be mapped straightaway using the JsonSchema validator.

...

Code Block
languagejs
var payloadEntry = new java.util.HashMap();
payloadEntry.put("create-subscription-properties", payloadProperties)
var payload = new java.util.HashMap();
payload.put("create-subscription-request", payloadEntry);

Test Plan

The test plan for validating the JSON Schema Support in any example policy is attached here - APEX_PDP_JSON_Schema_Support_Test_Plan.xlsx

Summary

JsonSchema support in APEX-PDP has the following advantages:

...