I'm using Oracle Rest Data Services (ORDS) and I want to return a complex data type. For example, a 'Customer' with their corresponding 'Addresses'. I can manually construct and return the JSON for this, which is not a problem. I can also create Oracle OBJECTs with sub-objects and return them. However, the OpenAPI 3.0 documentation generated by ORDS doesn't represent this correctly.
In the OpenAPI documentation, my sub-object is simply shown as a type: String, which doesn't reflect its actual structure. I need the detailed definition of the sub-object in the documentation.
Here's an example of what I'm doing:
-- Creating an object
CREATE TYPE address_obj AS OBJECT (
street VARCHAR2(100),
city VARCHAR2(100),
zip NUMBER
);
-- Creating another object that uses the first one
CREATE TYPE customer_obj AS OBJECT (
name VARCHAR2(100),
address address_obj
);
-- Create a table type
CREATE TYPE customer_tab IS TABLE OF customer_obj;
-- Create a pipelined function
CREATE FUNCTION get_customers RETURN customer_tab PIPELINED AS
BEGIN
PIPE ROW(customer_obj('Example', address_obj('Street', 'City', 12345)));
RETURN;
END;
I also tried it with a function and without pipeline Table.
In my OpenAPI 3.0 documentation, the type of 'address' under 'customer_obj' is just shown as 'String', instead of showing its actual structure as an 'address_obj'.
Is there a way to get ORDS to generate more accurate OpenAPI 3.0 documentation for these complex data types? Any help would be appreciated.