Check allowed values for fields#771
Merged
jsoriano merged 10 commits intoelastic:mainfrom Jun 9, 2022
Merged
Conversation
Collaborator
mtojek
reviewed
Apr 1, 2022
mtojek
approved these changes
Apr 6, 2022
|
|
||
| // ensureAllowedValues validates that the document's field value | ||
| // is one of the allowed values. | ||
| func ensureAllowedValues(key, value string, allowedValues AllowedValues) error { |
Contributor
There was a problem hiding this comment.
nit: in theory, you don't need to pass key here as it's just used to render the error message :)
Member
Author
There was a problem hiding this comment.
Umm, but error message is rendered here, key is used in this function for that.
I would be fine with refactoring this error generation, but in a different PR, making the other ensure methods consistent with this.
17 tasks
Member
Author
|
Blocked till elastic/integrations#3016 is solved. |
Collaborator
🌐 Coverage report
|
This was referenced May 11, 2022
145a797 to
f40d122
Compare
This was referenced May 23, 2022
4 tasks
Merged
Member
Author
|
I have moved the changes to check values in arrays to #835, so we can start benefiting of this in other cases as with IP validation (elastic/integrations#3408). |
Member
Author
|
Opening this for final review as blockers in elastic/integrations#3016 are close to be completed. @mtojek could you please take another look? |
This was referenced Jun 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fields can include a list of allowed values. Check that the values of
these fields are between the allowed ones.
For arrays, validation is now done for all fields, as we not only need
to validate their type but also their values.
Part of #615.