Skip to content

Commit

Permalink
Fix: flow framework schema tests.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Nov 5, 2024
1 parent f3759a1 commit 732fde0
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 41 deletions.
12 changes: 6 additions & 6 deletions spec/namespaces/flow_framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions spec/namespaces/observability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ components:
type: object
additionalProperties:
type: string
example: OK
observability.delete_object@404:
description: Not Found
content:
Expand All @@ -168,7 +167,7 @@ components:
type: object
additionalProperties:
type: string
example: OK
# example: OK
observability.delete_objects@404:
description: Not Found
content:
Expand Down
36 changes: 30 additions & 6 deletions spec/schemas/flow_framework.common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -99,6 +105,8 @@ components:
properties:
name:
type: string
version:
$ref: '#/components/schemas/version'
description:
type: string
use_case:
Expand All @@ -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.
Expand All @@ -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`.
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
44 changes: 22 additions & 22 deletions spec/schemas/flow_framework.errors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,47 @@ 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:
type: object
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:
type: object
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:
type: object
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:
type: object
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:
type: object
properties:
error:
type: string
example: Workflow ID can not be null
# example: Workflow ID can not be null
status:
type: integer
DuplicateKeyError:
Expand All @@ -63,7 +63,7 @@ components:
status:
type: integer
description: HTTP status code for the error.
example: 400
# example: 400
InvalidRequestBodyFieldError:
type: object
properties:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
# example: 400
10 changes: 5 additions & 5 deletions spec/schemas/observability._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ components:
$ref: '#/components/schemas/ErrorResponse'
status:
type: integer
example: 404
# example: 404
required:
- error
- status
Expand All @@ -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
Expand All @@ -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
2 changes: 2 additions & 0 deletions tests/default/flow_framework/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 732fde0

Please sign in to comment.