Skip to content

Conditional “X-Prompt” in Angular Schematics #18578

Closed
@Ankit-sagar32

Description

@Ankit-sagar32

It seems feature to add conditional x-prompts is missing in angular schematics.

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.

References : Applying Subschemas Conditionally
Angular Schematics

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?"
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions