1

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.

CodeMonkey
  • 11,196
  • 30
  • 112
  • 203
  • Related: https://stackoverflow.com/questions/64136616/in-task-json-required-can-have-a-expression-or-not This solution uses an alternate paths option. – James Sheils Jul 04 '23 at 08:19
  • @JamesSheils That's close but using visibleRule works for classic pipelines only. In my case I'm using a yaml pipeline so it won't work. Edited the question with that info – CodeMonkey Jul 04 '23 at 08:39

1 Answers1

0

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
},
Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114