このコンテンツは選択した言語では利用できません。

13.24. Swagger Translator


13.24.1. Swagger Translator

The Swagger translator, known by the type name "swagger" relationally exposes the Swagger data sources and uses the Teiid WS resource adapter for making web service calls.
You can use Swagger similarly to any other source in Red Hat JBoss Data Virtualization. The metadata import is supported through the translator, the metadata is imported from the source system’s swagger.json file and then the API from this file is exposed as stored procedures in Red Hat JBoss Data Virtualization. The source system can then be queried by executing these stored procedures in the system.
Here is a sample VDB that can read metadata from the Petstore reference service found at http://petstore.swagger.io/:
<vdb name="petstore" version="1">
    <model visible="true" name="m">
        <source name="s" translator-name="swagger" connection-jndi-name="java:/swagger"/>
    </model>
</vdb>
Copy to Clipboard Toggle word wrap
This is what the resource-adapter configuration file will look like:
<resource-adapter id="swagger">
    <module slot="main" id="org.jboss.teiid.resource-adapter.webservice"/>
    <transaction-support>NoTransaction</transaction-support>
    <connection-definitions>
        <connection-definition class-name="org.teiid.resource.adapter.ws.WSManagedConnectionFactory" jndi-name="java:/swagger" enabled="true" use-java-context="true" pool-name="teiid-swagger-ds">
            <config-property name="EndPoint">
                http://petstore.swagger.io/v2
            </config-property>
        </connection-definition>
    </connection-definitions>
</resource-adapter>
Copy to Clipboard Toggle word wrap
Once you configure the resource-adapter and deploy the VDB successfully, you can connect to the deployed VDB using the JDBC driver and issue SQL statements like this:
EXEC findPetsByStatus(('sold',))
EXEC getPetById(1461159803)
EXEC deletePet('', 1461159803)
Copy to Clipboard Toggle word wrap

Note

This translator has no execution properties.
Expand
Table 13.23. Importer Properties
Name Description Default Value
useDefaultHost Use the default host specified in the Swagger file; when false uses the endpoint in the resource-adapter. True
preferredScheme Preferred Scheme to use when Swagger file supports multiple invocation schemes like http and https. null
preferredProduces Preferred Accept MIME type header. This should be one of the Swagger 'produces' types; application/json
preferredConsumes Preferred Content-Type MIME type header. Tthis should be one of the Swagger 'consumer' types. application/json
Here are example importer settings that allow you to avoid calling the host defined in the swagger.json file
<property name="importer.useDefaultHost" value="false"/>
Copy to Clipboard Toggle word wrap
This adapter uses a Web Service Data Source.

Note

Native or direct query execution is not supported through the Swagger translator. However, you can use the Web Services Translator’s invokehttp method to issue a REST-based call and parse the results using SQLXML.
The translator has these limitations:
  • The "application/xml" mime type is not supported in either "Accept" and "Content-Type".
  • File and Map properties are currently not supported, and therefore multi-part payloads are also not supported
  • Security metadata is not currently supported.
  • Custom properties that start with "x-" are not supported.
  • Schema with "allof", "multipleof", and "items" from JSON schema are not supported.
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat