-
Notifications
You must be signed in to change notification settings - Fork 69
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
Refactor validation IF119 #4277
base: master
Are you sure you want to change the base?
Conversation
Changelog(s) in markdown:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a body to the PR
...s/IF119_select_values_cannot_contain_multiple_or_only_empty_values_in_single_select_types.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
See my comments.
@@ -0,0 +1,4 @@ | |||
changes: | |||
- description: Refactored validation IF119, Check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- description: Refactored validation IF119, Check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options. | |
- description: Added support for validation IF119 - "check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options." for new validate flow. |
def select_values_do_not_contain_multiple_or_only_empty_values_in_single_select_types( | ||
content_item: ContentTypes, | ||
) -> bool: | ||
if content_item.data.get("type") == IncidentFieldType.SINGLE_SELECT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add type as an attr of the IncidentField class.
content_item: ContentTypes, | ||
) -> bool: | ||
if content_item.data.get("type") == IncidentFieldType.SINGLE_SELECT: | ||
select_values = content_item.data.get("selectValues") or [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for selectValues.
error_code = "IF119" | ||
description = "We do not allow for incidentFields with singleSelect types to have in the selectValues more than one or only emtpy option" | ||
rationale = "Due to UI issues, we cannot allow more than one or only empty values for selectValues field" | ||
error_message = "singleSelect types cannot contain more than one or only empty values in the selectValues field." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make sure only the relevant issue appears, maybe consider returning the relevant error msg rather than True/False from select_values_do_not_contain_multiple_or_only_empty_values_in_single_select_types.
Related Issues
fixes:
Description
Refactored validation IF119, Check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options.