Heterogeneous JSON Array Support
In JSON, an array is an ordered collection of values that can be of various data types, such as strings, numbers, objects, arrays, booleans, or null. Homogeneous arrays are simply an ordered collection of values of the same type, whereas heterogeneous arrays are collections of disparate types.
Perform the following steps to configure a heterogeneous JSON array in the REST Adapter.
- Provide sample JSON containing the JSON heterogeneous array in the
REST Adapter. The sample must conform to the
following rules:
- You must enrich the sample JSON payload with an additional
metadata node
oic-json-metadata
. Provide the JSON path of the heterogeneous array in the sample and provide the JSON path to the discriminator.{ "oic-json-metadata": { "heterogeneousArrays": [ { "heterogeneousArrayPath": "$.entry", "heterogeneousArrayDiscriminatorPath": "$.entry.resourceType" } ] }
- Ensure the sample JSON is representative and adheres to the
following rules:
- All the types expected from the actual payload must be available in the sample.
- Each discriminator must have at least one cell.
- The first cell of a discriminator must be representative.
- Each array type must have more than one cell.
- You must enrich the sample JSON payload with an additional
metadata node
- Based on the metadata, Oracle Integration
identifies the coordinates of heterogeneous arrays in this document and where to
locate their discriminator.
Every cell of the JSON payload having a heterogeneous array must contain the discriminator value.
- For the heterogeneous array, an abstract type in the schema is generated. Each cell of the heterogeneous array is located. For each cell, the discriminator value is extracted and an extension type is created for the discriminator, which extends the abstract base type.
- You must extend the base type for the required discriminators and
map.
The following types are not currently supported:
- Nested heterogeneous arrays
- Heterogeneous arrays at the top level
- A nested heterogeneous array as an item of an array
- Multiple heterogeneous arrays