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

Validate default values #128

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Validate default values #128

wants to merge 2 commits into from

Conversation

todvora
Copy link
Contributor

@todvora todvora commented Jul 2, 2024

So far we have ignored validation of default values. These are given by us, as a field value of the configuration property. This would be a valid configuration that causes no errors during init:

@Parameter(value = "test.positive.long", validator = PositiveLongValidator.class)
private long myPositiveLong = -1;

But it's obviously wrong and will cause, sooner or later, problems elsewhere. That's why I believe is correct to validate default values as well.

In the best case, we would validate these during compile time, not during run time. But some of the properties are paths and config related to the running system, so we are unable to determine if the value is correct or not during compilation. Runtime check is the next best thing to avoid problems later in the execution.

Notes for Reviewers

  • The commit history must be preserved - please use the rebase-merge or standard merge option instead of squash-merge
  • Sync up with the author before merging

@todvora todvora force-pushed the fix/validate-default-values branch from 32583ec to f204e24 Compare July 2, 2024 11:18
@todvora todvora force-pushed the fix/validate-default-values branch from f204e24 to 581d649 Compare July 2, 2024 11:20
Copy link
Contributor

@luk-kaminski luk-kaminski left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants