8000
Skip to content

Simplify config validation#14559

Merged
tomponline merged 8 commits intocanonical:mainfrom
simondeziel:validation
Nov 29, 2024
Merged

Simplify config validation#14559
tomponline merged 8 commits intocanonical:mainfrom
simondeziel:validation

Conversation

@simondeziel
Copy link
Copy Markdown
Member

validate.Optional() checks if the provided value is not empty before calling the other validator.

As such, validate.Optional(validate.IsNotEmpty) is conceptually the same as validate.IsAny.

Also, since validate.IsAny accepts anything, using, validate.Optional(validate.IsAny) is conceptually the same as validate.IsAny.

`validate.Optional()` checks if the provided value is not empty before calling
the other validator. As such, `validate.Optional(validate.IsNotEmpty)` is
conceptually the same as `validate.IsAny`.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
`validate.Optional()` checks if the provided value is not empty before calling
the other validator. Since `validate.IsAny` accepts anything, using,
`validate.Optional(validate.IsAny)` is conceptually the same as
`validate.IsAny`.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
…h,data}` validation

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
…ix` validation

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
kadinsayani
kadinsayani previously approved these changes Nov 29, 2024
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@github-actions github-actions bot added the Documentation Documentation needs updating label Nov 29, 2024
@simondeziel simondeziel marked this pull request as ready for review November 29, 2024 17:51
@tomponline tomponline merged commit 4a3c4a3 into canonical:main Nov 29, 2024
@simondeziel simondeziel deleted the validation branch November 29, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Documentation needs updating

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0