You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is the snippet of the Template parameter: (Integer)
"appRootDiskSize": {
"type": "int",
"minValue": 30,
"maxValue": 2048,
"defaultValue": 30,
"metadata": {
"description": "Please select the size of the data disk you wish to deploy (value is integer GB)."
}
},
Here is the snippet of UI element and output: (String type)
"bladeTitle": "app Configuration",
"elements": [
{
"name": "deployApp",
"type": "Microsoft.Common.OptionsGroup",
"label": "Deploy App",
"defaultValue": "true",
"toolTip": "Optionally select to deploy App",
"constraints": {
"allowedValues": [
{
"label": "true",
"value": "yes"
},
{
"label": "false",
"value": "no"
}
],
"required": true
}
},
{
"name": "rootDiskSize",
"type": "Microsoft.Common.TextBox",
"label": "Swarm instance root disk size",
"defaultValue": "30",
"toolTip": "Provide the size of the Swarm root disk - The size (GB) of the Managed disk.",
"constraints": {
"required": true,
"regex": "^([3-9]\d{1}\d*|\d{3}\d*)$",
"validationMessage": "Value must be numeric and greater than or equal to 30"
},
"visible": true
},
],
"visible": "[equals(steps('SwarmConfig').deployApp, 'yes')]"
}
]
},
Once you have the createUIDefinition.json & mainTemplate.json files are ready based on the above data, you can do the UI input validation using "arm-ttk" toolkit, and "Deploy To Azure" URL and Marketplace.
You can notice both "arm-ttk" and "Deploy To Azure" pass validation and there is no type mismatch - template expects integer whereas integer is passed from UI output.
If you upload the same template to Marketplace then you can notice the JToken validation error, whereas this is not exposed or caught in both arm-ttk or "deploy to azure" URL methods.
Resolution: Resolved by modifying the UI output as below:
"swarmRootDiskSize": "[int(coalesce(steps('SwarmConfig').vmSettings.rootDiskSize, 30))]",
ASK: Implement in arm-ttk toolkit to validate if the output type matches the template input parameter type. This helps catching the type mismatch errors in arm-ttk tool instead of noticing it only after publishing it to marketplace.
The text was updated successfully, but these errors were encountered:
* Fixing #444: Template Output Data Types
* Adding positive/negative tests
* Expanding list of acceptable data type coercion functions
* Adding Length to -AllowedFunctionInOutput
* Adding boolean case to failure
* Adding Tracing for CI/CD debugging
* More tracing for debugging CI/CD
* Adding -Debug support to test functions
* Adding -Debug to the Outputs-Must-Be-Present-In-Template-Parameters
* Updating failure case (making JSON more correct)
* Fixing casing in createUiDefinition filename
* Cleaning up CI/CD debugging
* Outputs-Must-Be-Present-In-Template-Parameters: Switching to warning. Adding notes.
* Outputs-Must-Be-Present-In-Template-Parameters: Switching to warning. Adding notes.
Here is the snippet of the Template parameter: (Integer)
"appRootDiskSize": {
"type": "int",
"minValue": 30,
"maxValue": 2048,
"defaultValue": 30,
"metadata": {
"description": "Please select the size of the data disk you wish to deploy (value is integer GB)."
}
},
Here is the snippet of UI element and output: (String type)
"bladeTitle": "app Configuration",
"elements": [
{
"name": "deployApp",
"type": "Microsoft.Common.OptionsGroup",
"label": "Deploy App",
"defaultValue": "true",
"toolTip": "Optionally select to deploy App",
"constraints": {
"allowedValues": [
{
"label": "true",
"value": "yes"
},
{
"label": "false",
"value": "no"
}
],
"required": true
}
},
{
"name": "rootDiskSize",
"type": "Microsoft.Common.TextBox",
"label": "Swarm instance root disk size",
"defaultValue": "30",
"toolTip": "Provide the size of the Swarm root disk - The size (GB) of the Managed disk.",
"constraints": {
"required": true,
"regex": "^([3-9]\d{1}\d*|\d{3}\d*)$",
"validationMessage": "Value must be numeric and greater than or equal to 30"
},
"visible": true
},
],
"visible": "[equals(steps('SwarmConfig').deployApp, 'yes')]"
}
]
},
UI output:
"swarmRootDiskSize": "[steps('SwarmConfig').vmSettings.rootDiskSize]",
Resolution: Resolved by modifying the UI output as below:
"swarmRootDiskSize": "[int(coalesce(steps('SwarmConfig').vmSettings.rootDiskSize, 30))]",
ASK: Implement in arm-ttk toolkit to validate if the output type matches the template input parameter type. This helps catching the type mismatch errors in arm-ttk tool instead of noticing it only after publishing it to marketplace.
The text was updated successfully, but these errors were encountered: