1

Requirement : To display conditional prompts, based on the previous selection ( "Analytics", in this case ).

Problem : For any selection, it is still displaying the prompt to add Google Analytics's Tracking Id even if i select AppDynamics or none.

Reference : Applying Subschemas Conditionally

Note: For Simplicity, i have removed "allOf","anyOf" etc. and code for any other analytics tool, still it was not working.

Code (Schema.json):

{
  "$schema": "http://json-schema.org/schema",
  "id": "MyDemoSchema",
  "title": "My Demo Schematics Schema",
  "type": "object",
  "properties": {
    "analytics": {
      "enum": [
        "none",
        "GoogleAnalytics",
        "AppDynamics"
      ],
      "x-prompt": "Which Analytics would you like to use?"
    }
  },
  "if": {
    "properties": {
      "analytics": {
        "const": "GoogleAnalytics"  
      }
    }
  },
  "then": {
    "properties": {
      "GoogleAnalytics": {
        "type": "string",
        "x-prompt": "Enter Tracking ID?"
      }
    }
  }
}

Read many articles on this but still couldn't figure it out. Is there any way to add these conditional prompts?

yanky_cranky
  • 1,303
  • 1
  • 11
  • 16

0 Answers0