• 沒有找到結果。

App Schemas

在文檔中 TIBCO Cloud™ (頁 109-112)

You can define a JSON or Avro schema so that it is available for reuse across an app. Creating such an app-level schema saves you time and effort of entering the same schema multiple times; you can simply pick the schema from a list. An app-level schema can be used in any flow, activity, or trigger

configuration where a schema editor is provided. For example:

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.

Types of schemas supported are JSON and Avro.

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 in all places where the schema is used.

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 the schema values.

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:

Inputs or Outputs tab of a flow

Input or Output Settings tab of an activity

Output or Reply Settings tab of a trigger Flow Inputs & Outputs 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 &

Outpts accordian tab. You cannot coerce the flow input or output from outside this accordian 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 in this view 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 (…) appear 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 app-level schema. You can also unbind the app-level schema (by deselecting the Use an app-level schema button) from a trigger, activity, or a flow's input and output. 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 the Input or Output Settings Tab of an activity. As an example, the following screenshot shows a 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 the Output or Reply Settings Tab of a trigger. As an 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/output of the flow.

在文檔中 TIBCO Cloud™ (頁 109-112)