arazzo: 1.0.1 info: title: Affinda Parse and Reject a Document summary: Upload a document, wait for parsing, inspect the result, then branch to reject or confirm it. description: >- A triage flow that branches on the parse outcome. A document is uploaded and polled until ready; if processing failed the document is rejected, otherwise it is confirmed. This shows how a pipeline can automatically quarantine documents that the AI could not process. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: affindaV3Api url: ../openapi/affinda-v3-openapi.yml type: openapi workflows: - workflowId: parse-and-reject-document summary: Parse a document then reject it if it failed, otherwise confirm it. description: >- Uploads a file, polls until ready, and branches: failed documents are rejected, successful documents are confirmed. inputs: type: object required: - workspace - file properties: workspace: type: string description: The workspace identifier to upload the document into. file: type: string description: The document file contents (binary) to upload. steps: - stepId: uploadDocument description: Upload the file with wait=false so an identifier is returned for polling. operationId: createDocument requestBody: contentType: multipart/form-data payload: file: $inputs.file workspace: $inputs.workspace wait: false successCriteria: - condition: $statusCode == 201 outputs: identifier: $response.body#/meta/identifier - stepId: pollUntilReady description: >- Poll the document until meta.ready becomes true, then branch on whether processing failed. operationId: getDocument parameters: - name: identifier in: path value: $steps.uploadDocument.outputs.identifier successCriteria: - condition: $statusCode == 200 - context: $response.body condition: $.meta.ready == true type: jsonpath outputs: failed: $response.body#/meta/failed onSuccess: - name: parseFailed type: goto stepId: rejectDocument criteria: - context: $response.body condition: $.meta.failed == true type: jsonpath - name: parseSucceeded type: goto stepId: confirmDocument criteria: - context: $response.body condition: $.meta.failed == false type: jsonpath - stepId: rejectDocument description: Reject the document because processing failed. operationId: updateDocument parameters: - name: identifier in: path value: $steps.uploadDocument.outputs.identifier requestBody: contentType: application/json payload: isRejected: true successCriteria: - condition: $statusCode == 200 outputs: isRejected: $response.body#/meta/isRejected onSuccess: - name: done type: end - stepId: confirmDocument description: Confirm the document because processing succeeded. operationId: updateDocument parameters: - name: identifier in: path value: $steps.uploadDocument.outputs.identifier requestBody: contentType: application/json payload: isConfirmed: true successCriteria: - condition: $statusCode == 200 outputs: isConfirmed: $response.body#/meta/isConfirmed outputs: documentIdentifier: $steps.uploadDocument.outputs.identifier isRejected: $steps.rejectDocument.outputs.isRejected isConfirmed: $steps.confirmDocument.outputs.isConfirmed