%JSONImport: How to import JSON object with an array item that can be "anyof" 3 different schemas
I am writing a POST API using IRIS. My POST API Endpoint invokes a Business Service -> Business Process -> Business Operation in an IRIS production .
I am trying to import the JSON payload into a JSON enabled class and work with the JSON class in my Business Process and invoke different Business operation(s) based on the data supplied. This works fine for simpler JSON schemas.
The POST API I am writing now needs to handle a complex schema. I.e. one of the Item on my JSON schema ("recipient") can be an array of "anyof" 5 different schemas.
Here, recipient can be an array of any of the 5 different schemas like Reference, Contact, Patient, Practitioner or PractitionerRole.
So in my JSON enabled class, representing this particular schema, I tried defining Property recipient as list of %DynamicObject; but when I then try to import the JSON object in this class using %JSONImport, it fails because %DyanmicObject doesn't have %JSONNew method.
Has anyone done anything similar before? What should I use as "type" for my recipient property ?
Appreciate any ideas or input.