fix: handle None value in parameter definition allowedValues validation #180
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.



The parameter definition validators were failing when
allowedValueswas explicitly set toNone, despiteNonebeing a valid value according to the model definition. This fix ensures both explicitNonevalues and omittedallowedValuesfields are handled correctly in validation.Also, fixed a few minor typos and inconsistencies.
Fixes: #179
What was the problem/requirement? (What/Why)
The parameter definition validators were failing with
'NoneType' object is not iterablewhen allowedValues was explicitly set toNone, even thoughNoneis a valid value according to the model definition. The validators needed to handle both cases: whenallowedValuesis omitted (implicitlyNone) and when it's explicitly set toNone.What was the solution? (How)
Updated the validators in
JobStringParameterDefinition,JobPathParameterDefinition,JobIntParameterDefinition, andJobFloatParameterDefinitionto:Nonevalues explicitly by returningNoneearly in the validation("allowedValues", i)formatJobIntParameterDefinitionfrom"larger than minValue"to"larger than maxValue"What is the impact of this change?
This change allows users to explicitly set
allowedValuestoNonein their parameter definitions, which was previously causing validation errors. It also makes error messages more consistent and accurate across all parameter types.How was this change tested?
The existing test suite covers both cases of omitted
allowedValuesand explicitly setNonevalues. The tests pass successfully.Yes, all unit tests pass.
Was this change documented?
No documentation changes were needed as this fix aligns the implementation with the existing model definition and documentation.
Is this a breaking change?
No, this is not a breaking change. It fixes the implementation to match the intended behavior as defined by the model's type hints and existing documentation.
Does this change impact security?
No.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.