You can define a JSON or Avro schema such that it is available for reuse across an app. Creating an app-level schema saves you time and effort of entering the same schema multiple times. An app-app-level schema can be used in any flow, activity, or trigger configuration where a schema editor is provided. You can simply pick an existing schema from a list. For example, app-level schemas are available from the following locations:
● Inputs or Outputs tab of a flow (including Error Handler flows and subflows)
● Input or Output Settings tab of an activity
● Output or Reply Settings tab of a trigger
App-level schemas are filtered based on the type of the activity or trigger. For example, only JSON schemas are displayed in a REST trigger or activity configuration.
Currently, TIBCO Cloud Integration - Flogo (PAYG) only supports the JSON and Avro types of schemas.
Defining an App-Level Schema Procedure
1. On the App Details page, click Schemas.
The Schemas page opens.
2. Click +Schema.
3. In the Schema Name field, enter a schema name.
4. Select the type of schema. You can select either JSON or Avro schema. The default is JSON schema.
5. Enter the schema in the schema editor.
If you enter JSON data in the editor, it is automatically converted to JSON schema.
6. Click Save.
Result
After the schema is defined, it can be used in any activity or trigger configuration by using the Use an app-level schema button in the schema editor of the activity or trigger.
Editing an App-Level Schema
When you make changes to an app-level schema, the changes are automatically reflected everywhere the schema is used.
To edit an app-level schema, follow these steps:
Procedure
1. On the App Details page, click Schemas.
The Schemas page opens.
2. Expand the schema to be edited.
3. Edit the schema name or the schema in the editor, as required.
4. Click Save.
If the app-level schema is used in any flow, activity, or trigger, a warning is displayed.
Deleting an App-Level Schema
Deleting a schema removes its reference from all the places where it is used, but it retains a copy of the schema in the fields that use the schema.
Procedure
1. On the App Details page, click Schemas.
The Schemas page opens.
2. Click the Delete icon beside the schema to be deleted.
Result
After confirmation, the selected schema is deleted.
Using an App-Level Schema
You can use an app-level schema from a flow, trigger, or activity from the following tabs:
● Inputs or Outputs tab of a flow
● Input or Output Settings tab of an activity
● Output or Reply Settings tab of a trigger Flow Input & Output Tab
Use these tabs to configure the input to the flow and the flow output. These tabs are particularly useful when you create blank flows that are not attached to any triggers.
The schemas for input and output to a flow can be entered or modified only in this Flow Inputs & Outputs accordion tab. You cannot coerce the flow input or output from outside this accordion tab.
Both these tabs (the Input tab and the Output tab) have two views:
● JSON schema view:
You can enter either the JSON data or JSON schema in this view. You must click Save to save your changes or Discard to revert the changes. If you entered JSON data, the data is converted to a JSON schema automatically when you click Save.
● List view: This view allows you to view the data that you entered in the JSON schema view in a list format. In this view, you can:
— Enter your data directly by adding parameters one at a time
— Mark parameters as required by selecting its check box.
— When creating a parameter, if you select its data type as an array or an object, an ellipsis (…) appears to the right of the data type. Click the ellipsis to provide a schema for the object or array.
— Use an app-level schema by selecting the Use an app-level schema button. On the Schemas page that appears, click Select beside the schema that you want to use. The name of the schema is displayed beside the Use an app-level schema button and the schema is displayed in a read-only mode.
You cannot edit an app-level schema in the List View if the Use an app-level schema button is selected. To edit an app-level schema, follow the instructions in the section Editing an App-level Schema. You can, however, switch to another app-level schema by clicking Change and selecting another level schema. You can also unbind the app-level schema (by deselecting the Use an app-app-level schema button) from a trigger, activity, or the input and output of a flow. After you unbind the app-level schema, you can make changes to it using the schema editor in the List View.
— Click Save to save the changes or Discard to discard your changes.
Input or Output Settings Tab of an Activity
When configuring an activity, you can select an app-level schema in its Input or Output Settings Tab. For example, the following screenshot shows an app-level schema selected in the Response Schema field of the Output Settings tab of an InvokeRESTService activity.
Output or Reply Settings Tab of a Trigger
When configuring a trigger, you can select an app-level schema in its Output or Reply Settings Tab. For example, the following screenshot shows an app-level schema selected in the Reply Data Schema field of the Reply Settings tab of a ReceiveHTTPMessage trigger.
If there is change in the schema attached to a trigger, click Sync to synchronize it with the input and/or output of the flow.