Fix a bug in invalid action alias array parameter casting#5141
Merged
Conversation
Code would incorrectly try to cast a value to a list even if it's already a list which means it would break in scenarios when value is already a list (e.g. when parameter contains a default value or when immutable_parameters are used with an action alias).
Member
Author
|
Added tests. It was quite painful. My old development environment was not working and getting a new one up also took much longer then it should (couldn't find any good up to date docs so I created one myself from scratch). |
Member
Author
|
On a related note - I assume the whole str to list casting code was added as a quick hack / workaround at some point in the past to make it easier to specify lists in a chat. It's not ideal or complete since it doesn't handle more complex scenarios (e.g. lists of objects with |
1 task
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.
This pull request fixes a bug in action alias array parameter value casting when executing an alias.
The code would incorrectly assume value is always a string and try to cast it to an array (the value may very well be a string when executing command from chat, but even then is not always true).
This would not work if value is already a list (e.g. if parameter contains a default value or a default value is specified using
immutable_parametersin action alias definition).Background, Context
I encountered this bug when trying to define a default value for a parameter in action alias which is a list.
Here is action alias definition in question:
TODO