azureazure-devopsazure-pipelinesazure-pipelines-tasks

Azure custom task input - conditional required


I got an Azure custom task with inputs defined in its task.json file. Can I make an input required based on the value of another input?

Pseudo code of what I mean (the required of the 2nd input is the main thing here):

{
  "name": "boolInput",
  "type": "boolean",
  "required": true,
  "label": "Do we require the string input",
  "defaultValue": "true",
},
{
  "name": "stringInput",
  "type": "string",
  "required": "boolInput = true",
  "label": "My string input",
  "defaultValue": "initialVal",
},

The solution should work with a yaml pipeline, not a classic one.


Solution

  • There is no such option. you can see here the task.json schema:

    "required": {
      "type": "boolean",
      "description": "Whether the input is a required field (default is false).",
      "default": false
    },