From c13df2fb1127601a2002c72b8b175538956d63db Mon Sep 17 00:00:00 2001 From: liivw <164842155+liivw@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:17:04 +0800 Subject: [PATCH] schema-validation --- docs/developer-guides/schema-validation.md | 50 +++++++++++++++--- ...t_output_validation-task_config_schema.png | Bin 0 -> 272332 bytes ...nput_output_validation-task_def_schema.png | Bin 0 -> 221643 bytes ..._output_validation-workflow_def_schema.png | Bin 0 -> 277687 bytes 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 static/img/dev-guides/input_output_validation-task_config_schema.png create mode 100644 static/img/dev-guides/input_output_validation-task_def_schema.png create mode 100644 static/img/dev-guides/input_output_validation-workflow_def_schema.png diff --git a/docs/developer-guides/schema-validation.md b/docs/developer-guides/schema-validation.md index 658af518..589c32a7 100644 --- a/docs/developer-guides/schema-validation.md +++ b/docs/developer-guides/schema-validation.md @@ -8,14 +8,11 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; # Input/Output Schema Validation +In Orkes Conductor, you can create schemas to define and enforce the payload structure of workflow or task inputs/outputs. Once created, schemas can be added to workflow or task definitions: +* A **workflow-level schema** specifies what workflow inputs must be supplied. +* A **task-level schema** specifies the inputs/outputs that must be wired to/from the task. The task-level schema can be general across workflows (specified in the *task definition*) or unique to a specific workflow (specified in the *task configuration*). -Create schemas to define and enforce the payload structure of workflow or task inputs/outputs. - -Once created, schemas can be added to workflow or task definitions: -* A **workflow-level schema** allows you to specify what workflow inputs must be supplied. -* A **task-level schema** allows you to specify a contract that the task worker should follow—in other words, the inputs/outputs that must be wired to/from the task configuration. The task-level schema can be general across workflows (specified in the *task definition*) or unique to a specific workflow (specified in the *task configuration*). - -The schema is enforced at runtime. The workflow or task will fail if the inputs/outputs do not pass the validation. This behavior is the main distinction between a *task-level schema* versus the *input keys, output keys, and input templates* in a task definition. The schema enforces validation on a payload, while the latter parameters are non-enforceable guides. +The schema is enforced at runtime. The workflow or task will fail if the inputs/outputs do not pass the validation. This behavior is the main distinction between a *task-level schema* versus non-enforceable guides like the *input keys, output keys, and input templates* in a task definition. ## Schema formats @@ -93,6 +90,8 @@ If the version is unspecified, the latest schema version will be used. 5. Switch on the **Enforce schema** toggle. 6. Select **Save** in the top right. +
+ ``` json // task definition @@ -123,6 +122,8 @@ If the version is unspecified, the latest schema version will be used. 6. Switch on the **Enforce schema** toggle. 7. Select **Save** > **Confirm** in the top right. + + ``` json // workflow definition @@ -167,6 +168,9 @@ If the version is unspecified, the latest schema version will be used. 5. Switch on the **Enforce schema** toggle. 6. Select **Save** > **Confirm** in the top right. + + + ``` json // workflow definition @@ -186,6 +190,12 @@ If the version is unspecified, the latest schema version will be used. Once the schema is added, modify your workflow or task inputs/outputs to match the schema. +## Editing schemas + +Schemas can be edited in the **Definitions** > **Schema** tab or directly from where they are added to the workflow definition itself. + +Since schemas can be reused for multiple workflows or tasks, you are encouraged to save changes to an existing schema as a new version or as a new schema entirely. + ## Workflow behavior with schemas @@ -197,3 +207,29 @@ If a task does not pass its schema validation, it will fail with a terminal erro +## Supported tasks + +Schema validation is currently supported for the following task types: +* [Worker (Simple)](/reference-docs/worker-task) +* [Event](/reference-docs/system-tasks/event) +* [HTTP](/reference-docs/system-tasks/http) +* [HTTP Poll](/reference-docs/system-tasks/http-poll) +* [Inline](/reference-docs/system-tasks/inline) +* [JSON JQ Transform](/reference-docs/system-tasks/jq-transform) +* [Business Rule](/reference-docs/system-tasks/business-rule) +* [Wait For Webhook](/reference-docs/system-tasks/wait-for-webhook) +* [JDBC](/reference-docs/system-tasks/jdbc) +* [Update Secret](/reference-docs/system-tasks/update-secret) +* [Get Signed JWT](/reference-docs/system-tasks/get-signed-jwt) +* [Update Task](/reference-docs/system-tasks/update-task) +* [Opsgenie](https://orkes.io/content/reference-docs/system-tasks/opsgenie) +* [Query Processor](/reference-docs/system-tasks/query-processor) +* [Text Complete](/reference-docs/ai-tasks/llm-text-complete) +* [Generate Embeddings](/reference-docs/ai-tasks/llm-generate-embeddings) +* [Get Embeddings](/reference-docs/ai-tasks/llm-get-embeddings) +* [Store Embeddings](/reference-docs/ai-tasks/llm-store-embeddings) +* [Search Index](/reference-docs/ai-tasks/llm-search-index) +* [Index Document](/reference-docs/ai-tasks/llm-index-document) +* [Get Document](/reference-docs/ai-tasks/llm-get-document) +* [Index Text](/reference-docs/ai-tasks/llm-index-text) +* [Chat Complete](/reference-docs/ai-tasks/llm-chat-complete) \ No newline at end of file diff --git a/static/img/dev-guides/input_output_validation-task_config_schema.png b/static/img/dev-guides/input_output_validation-task_config_schema.png new file mode 100644 index 0000000000000000000000000000000000000000..2ba11f0cd24ff28df5b5250186cef76018e28631 GIT binary patch literal 272332 zcmbSz1ymf-mMsv12A5y~8h1!=ch}%9A-Dw%u8q69ySrO(cLKrPg1f`7yqPyo|IC`{ zwR%-ouj;BR=k9aPKKpjCf}A)K0v-Yc1O$?#goq*p1Uv}@1hgU?4Dd~d2|+w?fV5W> z7lNo5CpZ93oQ>2ajb&vaXn@af5YUi#5O4on0=)Sk@&D_y7$gO==Sa$c|vk1z&8n|BKG_L3v@mBerX|*Q<
zkCzh%*Mm(7yp{aALoc=6`=xOi^O1~P 5|gLfz$<$YNJ+*`SW4whrVnwH>zR(mNZYm*PTij|{VJIYxc{Td;mYdA4VOM$(*F
zQm2j&PgX Gjj7+0FE-KhKqZ3nU!Brp1xD(Kn4L0XEHB3zxr382&p~!01O0UOk_l0R
z8vJ^WSilfx2WPMl74XdhAR3EBVTrgrAv(Vm)D-FDbyPusVyIPE4LWwmJXI197pvBO
z#SZ1OP1BMd0P%?OnCDp+Y<>z6lfJhUKF2rWgF{9CGzo#FKlS(KaG-)W>26ipLKsSj
zKg>~LSeky3mt7e$isq4x#Orj}G36x6`J0V35m0^?@j15e9lA7?@~>E1@d@ka%7)s0
z8y^`_8Ui-Ha8q5=ZL)2mswPO>l@w7MOg>G+VuZ?{y^Xa+#
zBGdlf;WZMzPX7xtyqghNZKM)JIIY`QRtN=3n|fel#HCUAx#NiPn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