While creating a template for dotnet new <template>, one of the required parameters is of datatype "choice". I am trying to then have a generated parameter with the generator of "switch" based on the choice parameter. When using the template, the string that is supposed to be replaced hasn't been replaced in any of the files. Considering the other parameters are successfully being replaced elsewhere, I'm assuming the issue comes from the actual switch conditionals.
The required choice parameter is being used for other generated and derived parameters so I've also tried to use those as the switch case conditionals and have not had any luck there either. Below is the basic setup I currently have (minus more parameters that aren't related to the issue).
{
"$schema": "http://json.schemastore.org/template",
.
.
.
,
"symbols": {
"ChoiceInput": {
"type": "parameter",
"isRequired": true,
"datatype": "choice",
"choices": [
{
"choice": "Choice 1",
"description": "Choice 1"
},
{
"choice": "Choice 2",
"description": "Choice 2"
},
.
.
.
,
{
"choice": "Choice 8",
"description": "Choice 8"
},
{
"choice": "Choice 9",
"description": "Choice 9"
}
]
},
"ChoiceDerived": {
"type": "derived",
"valueSource": "ChoiceInput",
"valueTransform": "Combine",
"replaces": "{ChoiceDerivedParameter}"
},
"ChoiceDerivedLower": {
"type": "generated",
"generator": "casing",
"parameters": {
"source": "ChoiceDerived",
"toLower": true
},
"replaces": "{choicederivedparameter}"
},
"ChoiceShortHand": {
"type": "generated",
"generator": "switch",
"parameters": {
"datatype": "string",
"replaces": "{cshparameter}",
"cases": [
{
"condition": "(ChoiceInput== 'Choice 1')",
"value": "c1"
},
{
"condition": "(ChoiceInput== 'Choice 2')",
"value": "c2"
},
.
.
.
,
{
"condition": "(ChoiceInput== 'Choice 8')",
"value": "c8"
},
{
"condition": "(ChoiceInput== 'Choice 9')",
"value": "c9"
}
]
}
}
},
"forms": {
"lc": {
"identifier": "lowerCase"
},
"Combine": {
"identifier": "replace",
"pattern": " |-",
"replacement": ""
}
}
}