fix(api): better error message for non-string variable names and min/max validation adjustment #14938
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.
Overview
Closes AUTH-303.
This PR fixes an issue where if a non-string was given for a variable name, it would fail with an unhelpful error message instead of raising the proper error saying that the variable name was not a string. This was due to the uniqueness check which was not checking if the variable name was a string, which could lead to
unhashable type
errors for certain values (like dictionaries).The other part of this PR is a small adjustment to the validation for minimum and maximum. Previously we would not allow minimum and maximum values that were the same. After talk with the Authorship team, it was decided that these values would be allowed, since there is one valid option for the parameter. This matches with the current behavior of allowing only one
choice
parameter. The error message "Maximum must be greater than the minimum" was kept however, so as not to point users in this direction.Test Plan
Tested that this protocol fails with a "Variable name must be a string." error
and this following PR passes analysis
Changelog
minimum
andmaximum
to be the same for int and float parametersReview requests
Risk assessment
Low