Skip to content

Commit

Permalink
Add proper pipeline validation in the OrderedMultiplePipelineChoiceFi…
Browse files Browse the repository at this point in the history
…eld #1426

Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Nov 1, 2024
1 parent ce2ed1e commit c0b7882
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scanpipe/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ def to_internal_value(self, data):

# Adds support for providing pipeline names as a comma-separated single string.
data = [item.strip() for value in data for item in value.split(",")]

# Pipeline validation
for pipeline in data:
pipeline_name, _ = scanpipe_app.extract_group_from_pipeline(pipeline)
pipeline_name = scanpipe_app.get_new_pipeline_name(pipeline_name)
if pipeline_name not in scanpipe_app.pipelines:
self.fail("invalid_choice", input=pipeline_name)

return data

def to_representation(self, value):
Expand Down

0 comments on commit c0b7882

Please sign in to comment.