Skip to content

feat: add method for pipeline validation to PipelineResource #15

@mathislucka

Description

@mathislucka

We want to add a validate method to the PipelineResource. This method will call the validate endpoint and validate a pipeline's yaml config.

The request to the endpoint looks like this:

curl --request POST \
     --url https://api.cloud.deepset.ai/api/v1/workspaces/test_workspace/pipeline_validations \
     --header 'content-type: application/json' \
     --data '
{
  "deepset_cloud_version": "v2",
  "query_yaml": "This is where the yaml config goes."
}
'

To implement the feature, you need to make the following changes:

  • remove .raise_for_status from AsyncTransportProtocol
  • extend TransportResponse with a success (true/false property)
  • set success to false if the status code is greater or equal to 400
  • adapt any tests if needed

Now the actual implementation:

  • add a validate method in PipelineResource

  • the method accepts a yaml_config

  • it returns a PipelineValidationResult (create the model)

  • the API will return a 422 if the yaml_config is not valid yaml

  • the API will return a 400 if there are errors in the config

  • for 400 we will have an errors key with a list of code, message objects

  • return the errors in the PipelineValidationResult

Add unit and integration tests following the conventions used in the existing tests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions