From 732fde003d2ae89ffd79d77449f298f75045a9ed Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 5 Nov 2024 08:17:52 -0500 Subject: [PATCH] Fix: flow framework schema tests. Signed-off-by: dblock --- spec/namespaces/flow_framework.yaml | 12 +++--- spec/namespaces/observability.yaml | 3 +- spec/schemas/flow_framework.common.yaml | 36 +++++++++++++++--- spec/schemas/flow_framework.errors.yaml | 44 +++++++++++----------- spec/schemas/observability._common.yaml | 10 ++--- tests/default/flow_framework/template.yaml | 2 + 6 files changed, 66 insertions(+), 41 deletions(-) diff --git a/spec/namespaces/flow_framework.yaml b/spec/namespaces/flow_framework.yaml index 278a88f03..7d3616220 100644 --- a/spec/namespaces/flow_framework.yaml +++ b/spec/namespaces/flow_framework.yaml @@ -403,7 +403,7 @@ components: content: application/json: schema: - oneOf: + anyOf: - $ref: '../schemas/flow_framework.errors.yaml#/components/schemas/InvalidParameterError' - $ref: '../schemas/flow_framework.errors.yaml#/components/schemas/ConflictError' - $ref: '../schemas/flow_framework.errors.yaml#/components/schemas/MissingParameterError' @@ -419,7 +419,7 @@ components: content: application/json: schema: - oneOf: + anyOf: - $ref: '../schemas/flow_framework.errors.yaml#/components/schemas/InvalidParameterError' - $ref: '../schemas/flow_framework.errors.yaml#/components/schemas/ConflictError' - $ref: '../schemas/flow_framework.errors.yaml#/components/schemas/MissingParameterError' @@ -478,7 +478,7 @@ components: content: application/json: schema: - $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkflowStep' + $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkflowSteps' flow_framework.get_steps@403: description: Flow Framework API Disabled Error content: @@ -504,19 +504,19 @@ components: content: application/json: schema: - oneOf: + anyOf: - $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkFlowStatusFullResponse' - $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkFlowStatusDefaultResponse' flow_framework.deprovision@200: content: application/json: schema: - $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkflowID' + $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkflowIDResponse' flow_framework.provision@200: content: application/json: schema: - $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkflowID' + $ref: '../schemas/flow_framework.common.yaml#/components/schemas/WorkflowIDResponse' flow_framework.deprovision@202: content: application/json: diff --git a/spec/namespaces/observability.yaml b/spec/namespaces/observability.yaml index a8553dbe1..62cca3dfd 100644 --- a/spec/namespaces/observability.yaml +++ b/spec/namespaces/observability.yaml @@ -150,7 +150,6 @@ components: type: object additionalProperties: type: string - example: OK observability.delete_object@404: description: Not Found content: @@ -168,7 +167,7 @@ components: type: object additionalProperties: type: string - example: OK + # example: OK observability.delete_objects@404: description: Not Found content: diff --git a/spec/schemas/flow_framework.common.yaml b/spec/schemas/flow_framework.common.yaml index d3ab4ae9b..d449168c2 100644 --- a/spec/schemas/flow_framework.common.yaml +++ b/spec/schemas/flow_framework.common.yaml @@ -11,6 +11,12 @@ components: type: string WorkflowID: type: string + WorkFlowIDResponse: + type: object + properties: + workflow_id: + type: string + description: The ID of the workflow WorkflowStepName: type: string Provision: @@ -99,6 +105,8 @@ components: properties: name: type: string + version: + $ref: '#/components/schemas/version' description: type: string use_case: @@ -111,6 +119,8 @@ components: type: integer last_updated_time: type: integer + last_provisioned_time: + type: number version: type: object description: A key-value map with two fields, template, which identifies the template version, and compatibility, which identifies a list of minimum required OpenSearch versions. @@ -135,6 +145,9 @@ components: failed: type: integer description: The number of shards where the deletion failed. + skipped: + type: integer + description: The number of shards where the deletion was skipped. query: type: object description: The search query to match workflows. Use `match_all` to retrieve all workflows, or `match` to search by specific fields like `use_case`. @@ -237,9 +250,11 @@ components: total: $ref: '#/components/schemas/total' max_score: - type: number - format: float - description: The maximum score of the search hits. + oneOf: + - type: 'null' + - type: number + format: float + description: The maximum score of the search hits. hits: type: array items: @@ -250,13 +265,19 @@ components: total: $ref: '#/components/schemas/total' max_score: - type: number - format: float - description: The maximum score of the search hits. + oneOf: + - type: 'null' + - type: number + format: float + description: The maximum score of the search hits. hits: type: array items: $ref: '#/components/schemas/StateItems' + WorkflowSteps: + type: object + additionalProperties: + $ref: '#/components/schemas/WorkflowStep' WorkflowStep: type: object properties: @@ -275,6 +296,9 @@ components: items: type: string description: The list of plugins required for the workflow step + timeout: + type: + $ref: '../schemas/_common.yaml#/components/schemas/Duration' WorkFlowStatusDefaultResponse: type: object properties: diff --git a/spec/schemas/flow_framework.errors.yaml b/spec/schemas/flow_framework.errors.yaml index 0c64af9d4..c91ed0e1d 100644 --- a/spec/schemas/flow_framework.errors.yaml +++ b/spec/schemas/flow_framework.errors.yaml @@ -11,7 +11,7 @@ components: properties: error: type: string - example: This API is disabled. To enable it, set [flow_framework.enabled] to true. + # example: This API is disabled. To enable it, set [flow_framework.enabled] to true. status: type: integer InvalidParameterError: @@ -19,7 +19,7 @@ components: properties: error: type: string - example: Only the parameters [param1, param2] are permitted unless the provision parameter is set to true. + # example: Only the parameters [param1, param2] are permitted unless the provision parameter is set to true. status: type: integer ConflictError: @@ -27,7 +27,7 @@ components: properties: error: type: string - example: You cannot use both the 'provision_workflow' and 'update_workflow_fields' parameters in the same request. + # example: You cannot use both the 'provision_workflow' and 'update_workflow_fields' parameters in the same request. status: type: integer MissingParameterError: @@ -35,7 +35,7 @@ components: properties: error: type: string - example: You cannot use the 'reprovision_workflow' parameter to create a new template. + # example: You cannot use the 'reprovision_workflow' parameter to create a new template. status: type: integer ParameterConflictError: @@ -43,7 +43,7 @@ components: properties: error: type: string - example: You cannot use the 'reprovision_workflow' and 'use_case' parameters in the same request. + # example: You cannot use the 'reprovision_workflow' and 'use_case' parameters in the same request. status: type: integer WorkFlowIdNullError: @@ -51,7 +51,7 @@ components: properties: error: type: string - example: Workflow ID can not be null + # example: Workflow ID can not be null status: type: integer DuplicateKeyError: @@ -63,7 +63,7 @@ components: status: type: integer description: HTTP status code for the error. - example: 400 + # example: 400 InvalidRequestBodyFieldError: type: object properties: @@ -82,21 +82,21 @@ components: status: type: integer description: HTTP status code for the error. - example: 400 + # example: 400 WorkflowSaveError: type: object properties: error: type: string - example: Failed to save workflow state - status: - type: integer + # example: Failed to save workflow state + status: + type: integer MaxWorkflowsLimitError: type: object properties: error: type: string - example: Maximum workflows limit reached 50 + # example: Maximum workflows limit reached 50 code: type: integer TemplateNameRequiredError: @@ -110,7 +110,7 @@ components: properties: error: type: string - example: Failed to retrieve template (12345) from global context. + # example: Failed to retrieve template (12345) from global context. code: type: integer InvalidTemplateVersionError: @@ -119,27 +119,27 @@ components: error: type: string description: Error message when the template version is invalid or missing. - example: Unable to parse field [version] in a version object. + # example: Unable to parse field [version] in a version object. UnsupportedFieldUpdateError: type: object properties: error: type: string description: Error message when trying to update an unsupported field in a template. - example: You can not update the field [fieldName] without updating the whole template. + # example: You can not update the field [fieldName] without updating the whole template. WorkflowParsingError: type: object properties: error: type: string description: Error message when workflow parsing fails. - example: Unable to parse field [workflow] in a template object. + # example: Unable to parse field [workflow] in a template object. WorkflowStepsRetrieveError: type: object properties: error: type: string - example: Failed to retrieve workflow step json. + # example: Failed to retrieve workflow step json. code: type: integer DeprovisioningError: @@ -148,7 +148,7 @@ components: error: type: string description: Describes the deprovisioning error and identifies resources that were not deprovisioned - example: Failed to deprovision some resources [connector_id Lw7PX4wBfVtHp98y06wV]. + # example: Failed to deprovision some resources [connector_id Lw7PX4wBfVtHp98y06wV]. required: - error DeprovisioningForbiddenError: @@ -157,7 +157,7 @@ components: error: type: string description: Describes the resources that require the allow_delete parameter for deprovisioning - example: These resources require the allow_delete parameter to deprovision [index_name my-index]. + # example: These resources require the allow_delete parameter to deprovision [index_name my-index]. required: - error RequestTimeoutError: @@ -169,15 +169,15 @@ components: status: type: integer description: HTTP status code for the error. - example: 408 + # example: 408 BadRequestError: type: object properties: error: type: string description: Error message when the request body or parameters are invalid. - example: Invalid request body or query parameters. + # example: Invalid request body or query parameters. status: type: integer description: HTTP status code for the error. - example: 400 \ No newline at end of file + # example: 400 \ No newline at end of file diff --git a/spec/schemas/observability._common.yaml b/spec/schemas/observability._common.yaml index fc8018f55..08b7fbce6 100644 --- a/spec/schemas/observability._common.yaml +++ b/spec/schemas/observability._common.yaml @@ -218,7 +218,7 @@ components: $ref: '#/components/schemas/ErrorResponse' status: type: integer - example: 404 + # example: 404 required: - error - status @@ -232,10 +232,10 @@ components: $ref: '#/components/schemas/RootCause' type: type: string - example: status_exception + # example: status_exception reason: type: string - example: 'ObservabilityObject {objectId} not found' + # example: 'ObservabilityObject {objectId} not found' required: - reason - root_cause @@ -246,10 +246,10 @@ components: properties: type: type: string - example: status_exception + # example: status_exception reason: type: string - example: 'ObservabilityObject {objectId} not found' + # example: 'ObservabilityObject {objectId} not found' required: - reason - type diff --git a/tests/default/flow_framework/template.yaml b/tests/default/flow_framework/template.yaml index c7ac780c9..84ecd8638 100644 --- a/tests/default/flow_framework/template.yaml +++ b/tests/default/flow_framework/template.yaml @@ -7,6 +7,8 @@ epilogues: status: [200, 404] parameters: workflow_id: ${create_flow_framework.test_workflow_id} +warnings: + multiple-paths-detected: false chapters: - synopsis: Create workflow with openAI model. id: create_flow_framework