GraphQL Trigger
The GraphQL Trigger lets the Flogo app act as the GraphQL server. To use this trigger, you simply upload your GraphQL schema and 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. This field can also be set using an app property.
Important: If the app has multiple triggers that require a port to be specified, make sure 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 | The file that contains the GraphQL schema is used to create the flow. The file has a
.gql or
.graphql extension.
Note: If you have made changes to 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 top right corner.
|
Schema Introspection | By default, it is set to True. You can use it to get the schema field 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 drop-down menu lists the field names under the
mutation type in the schema.
|
Output Settings
Field | Description |
---|---|
Headers | You can define the JSON schema of the key value pair for Headers. This field is available inside the flow.
Note: Headers values are parsed as a string.
|
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 list of fields or objects that match 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 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.
Data:
isDefined($flow.data) ? $flow.data : coerce.toObject('{}')
Error:
isDefined($flow.error) ? $flow.error : ''