GraphQL Trigger
The GraphQL Trigger lets a Flogo app act as the GraphQL server. To use this trigger, you simply upload your GraphQL schema and TIBCO Flogo® Enterprise automatically creates the flows corresponding to each query or mutation field in your schema.
Trigger Settings
Field | Description |
---|---|
Trigger Settings | |
Port | The port on which the trigger listens to requests. By default, it is set to
7879 . You can change this to use any other open port. Do not use ports 8080 or 7777, as these ports are reserved for internal use. This field can also be set using an app property.
Important: If the app has multiple triggers that require a port to be specified, ensure that the port number is unique for each trigger. Two triggers in the same app cannot run on the same port.
|
Path | The HTTP resource path for the operation. By default, it is set to
/graphql , but you can change it to any string that is meaningful to you. It is the single endpoint that GraphQL queries and mutations use to access data from the multiple resources on the server. This field can also be set using an app property.
|
GraphQL Schema File |
When creating a GraphQL trigger, you can configure it by uploading an GraphQL Schema file with a
Note: If you have changed the GraphQL schema file that you uploaded when creating the flow or trigger, you must propagate the changes to the flow input and flow output. To do this, after you select the updated schema file in this field, click
Sync on the upper-right corner.
|
Schema Introspection | By default, it is set to True. You can use it to get the schema details for GraphQL. If you set it to False, it disables introspection and you cannot fetch the schema field details. |
Secure Connection | By default, it is set to
False. If you set this field to
True, you can create a secure endpoint by providing
Server Key and
CA or Server Certificate.
Server Key - A PEM encoded private key file CA or Server Certificate - A PEM encoded CA or self-signed server certificate file |
Handler Settings | |
GraphQL Operation | The type of GraphQL operation the flow should represent. You can select either Query or Mutation |
Resolver for | This field is populated based on the type of
GraphQL Operation that you selected. If you selected
Query, the
Resolver For lists the field names under the query type in the schema. If you select
Mutation, the dropdown menu lists the field names under the
mutation type in the schema.
|
Map to Flow Inputs
You can map the trigger output to flow input on this tab. The tab contains an element
arguments
, which contains a field or objects list that matches the input arguments of the
Resolver For field in the GraphQL schema. Fields and Headers are available to map inside Map to Flow Inputs. Fields contains the fieldName string and the field array passed for the given Query or Mutation. The following structure is an example of Fields:
{"fieldName":"employee","fields":[{"fieldName":"id"},{"fieldName":"name"}]}
Map from Flow Outputs
You can map the flow output to the trigger reply on this tab. The tab contains a child element
data
, which contains either a simple type or an object that matches the output type of the
Resolver For field in the GraphQL schema. If the output type of the field is an
interface
type, the data contains a single field of type
any
. You can use the Error field to map the trigger reply setting for any error in the flow. Its value is parsed as a string.
To avoid any runtime exception, you can define your data and error mapping using the following formats:
Data:
isDefined($flow.data) ? $flow.data : coerce.toObject('{}')
Error:
isDefined($flow.error) ? $flow.error : ''