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

Add validation helper for Label Values/Keys #164

Merged
merged 2 commits into from
Aug 17, 2022

Conversation

LKaemmerling
Copy link
Member

@LKaemmerling LKaemmerling commented Aug 17, 2022

This implementation is similar to the implementation in the hcloud-go. To give the "user" as much as verbosity as possible i introduced two methods.

  • validate which is a simple validator that just returns True/False
  • validate_verbose which also returns the corresponding error message (like which key/value is not correctly formatted)

I decided against calling one of both function in the other and instead duplicate the code. This is based on my feeling that the code would be more complex when we as a sample call validate_verbose in validate. Also, it is slightly more readable imho, but we can discuss this :)

Closes #153

Signed-off-by: Lukas Kämmerling [email protected]

This implementation is similar to the implementation in the hcloud-go. To give the "user" as much as verbosity as possible i introduced two methods.

- `validate` which is a simple validator that just returns True/False.add-validator-for-labels
- `validate_verbose` which also returns the corresponding error message (like which key/value is not correctly formatted)

I decided against calling one of both function in the other and instead duplicate the code. This is based on my feeling that the code would be more complex when we as a sample call validate_verbose in validate. Also, it is slightly more readable imho, but we can discuss this :)

Closes #153

Signed-off-by: Lukas Kämmerling <[email protected]>
Signed-off-by: Lukas Kämmerling <[email protected]>
@LKaemmerling LKaemmerling force-pushed the add-validator-for-labels branch from 2457212 to 62dcc7d Compare August 17, 2022 06:42
@4ND3R50N 4ND3R50N self-requested a review August 17, 2022 06:47
@LKaemmerling LKaemmerling merged commit 090be27 into main Aug 17, 2022
@jooola jooola deleted the add-validator-for-labels branch August 8, 2023 11:52
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.

Implement validation on labels as per spec
2 participants