I'm trying to parse a template parameter in order to provide a user with a prompt on the command line. Once they've entered a value, I would like to validate that it is appropriate. If the parameter type is "Number", then I would need to check:
that the user entered a numeric value, and
if the template file defined a MinValue and/or MaxValue for the parameter,
then the user's numeric value falls between the defined min/max.
These fields are float64, which means that even if the optional properties are not present in the template file, the fields will get a zero-value of 0.
So the trouble is, I can't differentiate between a parameter where there is no defined MinValue, or a parameter where there is a defined MinValue of 0.
I'm trying to parse a template parameter in order to provide a user with a prompt on the command line. Once they've entered a value, I would like to validate that it is appropriate. If the parameter type is
"Number"
, then I would need to check:MinValue
and/orMaxValue
for the parameter,https://github.com/awslabs/goformation/blob/bf80608c482dde15129c70dd7175c74f143fd5bf/cloudformation/template.go#L36-L37
These fields are
float64
, which means that even if the optional properties are not present in the template file, the fields will get a zero-value of0
.So the trouble is, I can't differentiate between a parameter where there is no defined
MinValue
, or a parameter where there is a definedMinValue
of0
.