-
Notifications
You must be signed in to change notification settings - Fork 89
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
[Feature]: Support new ASL choice comparators #88
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
tests/unit/test_choice_rule.py
Outdated
@@ -61,6 +61,35 @@ def test_variable_value_must_be_consistent(): | |||
with pytest.raises(ValueError): | |||
func('$.Variable', True) | |||
|
|||
def test_path_function_value_must_be_consistent(): |
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.
def test_path_function_value_must_be_consistent(): | |
def test_path_operator_raises_error_when_value_is_not_a_path(): |
tests/unit/test_choice_rule.py
Outdated
with pytest.raises(ValueError): | ||
func('$.Variable', 'string') | ||
|
||
def test_is_function_value_must_be_consistent(): |
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.
def test_is_function_value_must_be_consistent(): | |
def test_is_operator_raises_error_when_value_is_not_a_bool(): |
|
||
Args: | ||
variable (str): Path to the variable to compare. | ||
value (bool): Constant value to compare `variable` against. |
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.
For the type comparisons, maybe the documentation for value
can be more descriptive:
- IsNull: "Whether the value at
variable
is equal to the JSON literalnull
or not. - IsPresent: "Whether a field at
variable
exists in the input or not. - IsNumeric: "Whether the value at
variable
is a string or not. - etc.
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.
fixed in subsequent commit
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.
Adam mentioned some naming changes. Once done it should be good to go.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
||
Args: | ||
variable (str): Path to the variable to compare. | ||
value (bool): Constant value to compare `variable` against. |
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.
I missed this one earlier. The value for StringMatches
is a str
. Since this is one of the ambiguous operators, let's add a description of the format in the documentation. Customers shouldn't have to go the ASL spec to figure out how to use this SDK.
value (bool): Constant value to compare `variable` against. | |
value (str): A string pattern that may contain one or more `*` characters to compare the value at `variable` to. The comparison yields true if the variable matches the pattern, where `*` is a wildcard that matches zero or more characters. |
Trying to think of good wording about escaping special characters with \
. Not sure if there's anything that's handled differently in Python.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Args: | ||
variable (str): Path to the variable to compare. | ||
value (str): A string pattern that may contain one or more `*` characters to compare the value at `variable` to. | ||
The `*` character can be escaped using two backslashes. |
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.
Not sure if this docstring will render this correctly if the newlines aren't indented
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Adding new choice state comparators that were added to the Amazon States Language specifications. https://states-language.net/
These include:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.