Using an OpenAPI Specification

You can create the Flogo app logic (flows) by importing an API specification file. You can simply drag a specification file to the UI or navigate to it. If you have an existing specification file stored in the TIBCO Cloud™ Integration - API Modeler or TIBCO Cloud™ API Modeler, select it when creating the flow. The flows for your app are automatically created based on the definitions in the specification file that you uploaded.

Tip: For more information on the TIBCO Cloud™ API Modeler, see TIBCO Cloud™ API Modeler.

When you create an app from a specification, the ConfigureHTTPResponse and Return activities are automatically added to the flow. The mappings from trigger output to flow inputs get configured for you based on the definitions in the specification. The output of the ConfigureHTTPResponse Activity is automatically mapped to the Return Activity input. However, you must configure the input to the ConfigureHTTPResponse Activity manually. If you have multiple response codes configured in the REST trigger, the first response code is configured in the ConfigureHTTPResponse Activity by default. The only exception to this is if you have a response code of 200 configured. In that case, the 200 response code is configured in the ConfigureHTTPResponse Activity by default.

Before the Flogo app is created, a validation process ensures that the features defined in the specification are supported in Flogo.

Considerations when using an API specification file to create a Flogo app:

  • Flogo supports Swagger Specification 2.0 and OpenAPI Specification 3.0.
  • Currently, Flogo supports only the JSON format.
  • Cyclic dependency is not supported when creating flows from specifications. For example, if you have a type Book that contains an object element of the type, Author. The type Author in turn contains an element of the type Book, that represents the books written by the author. To retrieve the Author, it creates a cyclic dependency where the Author object contains the Book object and the Book type, in turn, contains the Author object.
  • String, integer, and boolean are the data types supported by Flogo. A data type that appears in your specification but is not supported by Flogo results in an error being displayed.
  • Schema references within schemas are not supported.
  • If the specification has a response code other than 200 (OK) or 500 (Error), the method that contains the unsupported response code is not created.
  • You can enter a schema for the response code 200, but the 500 response code must be a string.
  • Basepath element in the schema is not supported.

If you get a validation error, you can either cancel the process of generating the app or click Continue. If you opt to continue, the process of app creation continues and the parts of the specification that did not pass the validation are ignored.

Note: The REST reply data type is by default set to any data type. To configure the reply to an explicit data type, see Configuring the REST Reply section.

To create an app using an API specification and upload the specification file:

    Procedure
  1. Log in to TIBCO Cloud™ Integration.
  2. On the Apps page, select Create/Import. The What do you want to build? dialog is displayed.
  3. To create a Flogo app using an OpenAPI specification: 
    • Under QuickstartAll app typesAPIs, click Create an app from OpenAPI.
    • On the left, select a category that identifies the type of integration you need. On the right, click Create an app from OpenAPI.
  4. In the block that displays below your selection, select one of the following options:
    Create a flow using an API specification that exists in the TIBCO Cloud™ Integration-API Modeler. To do this, on the API Specs tab, select the specification that you want to use.
    Use an API specification saved locally on your computer by uploading it to Flogo. To do this, click the Upload file tab. Browse to the saved API specification on your local machine or drag your saved API specification into the dialog.
  5. Click Import OpenAPI spec.
  6. In each flow:
    1. Open the flow by clicking its name.
    2. Click the trigger to open its configuration dialog.
    3. Map the following:
      • On the Map to Flow Inputs tab, map the Available data to Flow inputs.
      • On the Map from Flow Outputs tab, map the Available data to Trigger reply.

    To test the deployed app, follow the procedure in the Testing the Deployed App section.

    You can also download the specification used to create the app by following the procedure in Downloading the API Specification Used section.

    You also have the option to copy the endpoint URL from the Endpoints tab by clicking the Copy spec URL. Or you can click the () icon next to the endpoint URL itself.

    Click the Publish to API Management link to publish your specification to TIBCO Cloud(TM) API management.

The following is a list of Swagger 2.0 and OpenAPI Specification 3.0 features supported in Flogo:

For more information, refer to OpenAPI Specification.

Result

The app is created and the App Details Page is displayed for the new app. Your app does not run and has zero instances. To start and scale your app, see Starting, Stopping, and Scaling Apps.