
My custom connector returns a type mismatch error. The API's response sometimes contain an array (for more than 1 record) or an object (for 1 record). How do I configure the custom connector to allow mixed type of data.
Can I use Swagger 3.0 definition since it support OneOf and AnyOf option which allows mixed type.
If not how do I do it in OpenAPI 2?
Unfortunately, this is currently a limitation on the platform.
I can think of the following workarounds-
(1) Do not provide a schema - will mean that customers will need to parse the response and use it based on whether they are expecting one or more than one. Not a great option.
(2) You could provide 2 actions - one for object and another for the array. They can point to the same API endpoint using a policy. Customers will need to pick the appropriate action. Again, not a great option.
In future, we may provide ability to handle/normalize this in the connector itself (map it array, for instance). This is easier and will probably come out sonner. The other is support for multiple schemas (anyOf) in our platform - which is a harder challenge.