Validate a workflow definition

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Checks a workflow definition and tells you what is wrong with it, without saving anything.

Call this before Create workflow or Update workflow to catch problems while you still have the definition in hand. An invalid definition doesn't fail the call. It comes back with valid set to false and the problems listed in errors, so branch on valid rather than on whether the call succeeded.

post/api/apps/{app_id}/workflows/validate-definition

Path parameters

app_idstring required

ID of the app whose workflows you want to work with.

ID of the app whose workflows you want to work with.

Request body

definitionobject required

The CNCF Serverless Workflow v1.0 document to check.

Example request

{
  "definition": {
    "do": [],
    "document": {
      "dsl": "1.0.0",
      "name": "notify",
      "version": "1.0.0"
    }
  }
}

Response

The verdict. Check valid, not the status code.

validboolean required

Whether the definition can be saved as-is.

errorsobject[]

What is wrong with the definition, one entry per problem, each with a code, a human-readable message, and a location pointing into the definition. Empty when valid is true.

supported_task_typesstring[]

The fixed set of task types a definition's do steps can use, call, switch, or wait. This doesn't vary by app.

available_activitiesstring[]

The activities a call task on this app can invoke. This varies by app.

Example response

{
  "valid": true,
  "errors": [
    {
      "code": "UNSUPPORTED_TASK_TYPE",
      "location": "do[0].notify",
      "message": "Task 'notify' has no supported type key. Supported: ['call', 'switch', 'wait']"
    }
  ],
  "supported_task_types": [
    "call",
    "switch",
    "wait"
  ],
  "available_activities": [
    "compute_seconds_until",
    "invoke_backend_function"
  ]
}

Changes

Changed in 1 of the 14 revisions of this API.1