Skip to content

Inconsistent error handling for validation scenarios #583

@kim-tsao

Description

@kim-tsao

/kind bug

Which area this bug is related to?

/area api

What versions of software are you using?

N/A

Bug Summary

Describe the bug:

While working through some negative path scenarios, I noticed some areas of validation returns the first error found while others returns a list. For example, commands.go returns the first error found while projects.go returns a collection of error messages. All this leads to an inconsistent display of error messages when calling ValidateDevfileData. You can wind up with a list of error message from commands, components, projects, etc but not all objects will contain the full validation results which can lead to a bad UX if an end user fixes one error then encounters a new one when re-validating

To Reproduce:

Here is a file with 4 errors in total; 2 errors in the commands section and 2 under projects

Test_Command_errors.yaml.zip

I only see 3 error messages:

=== RUN   Test_Command_Errors
    test_utils.go:341: [..... ERROR : Error validating testDevfile the command "testapplyparentcommand1" is invalid - command does not map to a container component
        error validating projects:
        project petclinic has more than one remote defined, but has no checkoutfrom remote defined
        unable to find the checkout remote origin2 in the remotes for project petclinic2 ]

Expected behavior

I'm expecting the following error message for the composite command error:
the command "test" is invalid - the command "testapplyparentcommand" mentioned in the composite command does not exist in the devfile

Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable.

Additional context

N/A

Any workaround?

None
Suggestion on how to fix the bug

Use a similar approach to what's being done in projects.go. This may affect other properties aside from the ones mentioned above so some additional investigation is needed.

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions