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

Return all validation errors from configuration #1561

Merged
merged 5 commits into from
Oct 2, 2024
Merged

Conversation

sagikazarmark
Copy link
Contributor

Overview

Instead of returning on error at a time, config now returns all validation errors.

Notes for reviewer

@sagikazarmark sagikazarmark added the kind/refactor Code refactor, cleanup or minor improvement label Sep 23, 2024
chrisgacsal
chrisgacsal previously approved these changes Sep 23, 2024
Copy link
Contributor

@chrisgacsal chrisgacsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! :shipit:

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
if err := c.ConsumerConfiguration.Validate(); err != nil {
return err
errs = append(errs, errorsx.WithPrefix(err, "consumer"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think it would be better if the prefixes used the full name of the configuration object, it would make things 100% unambiguous (e.g. consumer => ConsumerConfiguration)
Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm...maybe

Right now it follows the name as it appears in the config file which probably makes it easier to debug a problem.

Ultimately, this should be a "path" to the configuration (whether it's file or not), but people rarely look at the code to figure out configuration.

@sagikazarmark sagikazarmark merged commit efcc0f1 into main Oct 2, 2024
18 checks passed
@sagikazarmark sagikazarmark deleted the validation branch October 2, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/refactor Code refactor, cleanup or minor improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants