Search code examples
teiidredhat-datavirt

Teiid generated Swagger Json file is corrupted


I have deployed several VDBs on a teiid Master slave setup in the domain mode. for an example AirFlights-vdb.xml, Customer-vdb.xml ...etc are deployed with several procedures which are exposed as REST APIs in each VDBs.I use IP:8080/AirFlights_1/api like URL to access the swagger documentation for a particular VDB. When there are several VDBs deployed the swagger documentation get corrupted. for an example when I do IP:8080/AirFlights_1/api it lists the API resources related to Customer-vdb.xml and other deployed VDBs. Can you help me to solve this messy nature of the generated swagger file.

I use http://teiid.org/rest}auto-generate" value="true"/> property to generate War files.

example vdb whould look like this

?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="sample" version="1">
    <property name="UseConnectorMetadata" value="true" />
    <property name="{http://teiid.org/rest}auto-generate" value="true"/>

    <model name="PM1">
        <source name="text-connector" translator-name="loopback" />
         <metadata type="DDL"><![CDATA[
                CREATE FOREIGN TABLE G1 (e1 string, e2 integer);
                CREATE FOREIGN TABLE G2 (e1 string, e2 integer);
        ]]> </metadata>
    </model>
    <model name="View" type ="VIRTUAL">
         <metadata type="DDL"><![CDATA[
            SET NAMESPACE 'http://teiid.org/rest' AS REST;
            CREATE VIRTUAL PROCEDURE g1Table(IN p1 integer) RETURNS TABLE (xml_out xml) OPTIONS (UPDATECOUNT 0, "REST:METHOD" 'GET', "REST:URI" 'g1/{p1}')
            AS
            BEGIN
                SELECT XMLELEMENT(NAME "rows", XMLATTRIBUTES (g1Table.p1 as p1), XMLAGG(XMLELEMENT(NAME "row", XMLFOREST(e1, e2)))) AS xml_out FROM PM1.G1;
            END
            ]]> </metadata>
    </model>

</vdb>

Solution

  • That certainly looks like a bug. I was able to reproduce and captured it as https://issues.jboss.org/browse/TEIID-5173