Generate an Adapter Definition Document

Using the VS Code extension, you can generate an adapter definition document from an exported Postman collection or from an OpenAPI document.

  1. For Postman Collections, perform the following steps:
    1. In VS Code, click Explorer Explorer icon on the sidebar to bring up the Explorer view.
      The directory structure of your workspace folder is displayed.
    2. Click the misc directory listing to expand it.
    3. Right-click the exported collection file (<ApplicationName>_Adapter.postman_collection.json), and then click RAB: Convert Postman Collection.
    4. In the Select request(s) pane, select the request to convert, and click Done.
  2. For OpenAPI documents, perform the following steps:
    1. Import the OpenAPI document (in a JSON format) into the api directory of your workspace folder.
    2. In VS Code, click Explorer Explorer icon on the sidebar to bring up the Explorer view.
      The directory structure of your workspace folder is displayed.
    3. Click the api directory listing to expand it.
    4. Right-click the OpenAPI document you imported, and click Rename.
      Rename the document as openapi.resource.json.
    5. Right-click the document again, and click RAB: Convert OpenAPI document.
    6. In the Select request(s) pane, select the request to convert, and click Done.

    Note:

    You cannot convert an OpenAPI document with more than 200 requests.
  3. In the dialog box that appears, you can choose either of the following options:
    • Click Update main to add the request to the default document provided with the VS Code extension (main.add.json).
    • Click Save new to generate a new adapter definition document.
    The VS Code extension converts the request into the document you select. If you choose to create a new document, the extension generates the document and saves it in the definitions directory of your workspace. In addition, the document opens in the VS Code editor.

    Note:

    If you create a new document, the VS Code extension doesn't recognize it as an adapter definition document. The extension only recognizes the default document, main.add.json. You can either copy the content from the new document to the default document or rename the new document to main.add.json.
  4. Ensure that the adapter definition document contains an API response schema.
  5. Press Ctrl+S on your keyboard to save the file.