Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise the Validation() method of the Option interface #322

Open
AleksandarSavchev opened this issue Oct 18, 2024 · 0 comments
Open

Revise the Validation() method of the Option interface #322

AleksandarSavchev opened this issue Oct 18, 2024 · 0 comments
Labels
kind/enhancement Enhancement, improvement, extension priority/4 Priority (lower number equals higher priority)

Comments

@AleksandarSavchev
Copy link
Member

What would you like to be added:
Currently there are places for improving the Validation() method of the Option interface in the pkg/shared/ruleset/disak8sstig/option package

// Option that can be validated in order to ensure
// that configurations are correctly defined
type Option interface {
Validate() field.ErrorList
}

  1. Most implementations of Option add field.Path to the errors returned from Validate(). ex:

    func (o Options242415) Validate() field.ErrorList {
    var (
    allErrs field.ErrorList
    rootPath = field.NewPath("acceptedPods")
    )

    We should allow field.Path to be passed to the Validate() method to have a better description of which options are not valid.

  2. Currently Validate() returns field.ErrorList. We should look into weather it is better to return an error which contains all other errors merged with errors.Join()

Why is this needed:
Enhance user options validation experience.

@AleksandarSavchev AleksandarSavchev added the kind/enhancement Enhancement, improvement, extension label Oct 18, 2024
@dimityrmirchev dimityrmirchev added the priority/4 Priority (lower number equals higher priority) label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Enhancement, improvement, extension priority/4 Priority (lower number equals higher priority)
Projects
None yet
Development

No branches or pull requests

2 participants