Uploaded image for project: 'DC/OS'
  1. DC/OS
  2. DCOS_OSS-2224

UI should extract defaults from schema intelligently

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Medium
    • Resolution: Won't Do
    • Affects Version/s: DC/OS 1.13
    • Fix Version/s: None
    • Component/s: dcos-ui

      Description

      UI currently extracts defaults from the schema and then merges the default options with the user provided options. The extraction of defaults from the schema hinders the powers of json schema. For e.g. this is a valid json schema but cannot be used as a config.json : 

      {
          "$schema": "http://json-schema.org/schema#",
          "properties": {
            "registry": {
              "properties": {
                "service-account-secret-path": {
                  "description": "Path to the service account in the Secret store",
                  "type": "string"
                },
                "s3": {
                  "type": "object",
                  "properties": {
                    "credential-file-secret-path": {
                      "type": "string",
                      "description": "The path to the s3 credential file to be used by registry",
                      "examples": [
                        "/path/to/s3/credential/file"
                      ]
                    },
                    "credential-profile-name": {
                      "type": "string",
                      "description": "The name of the profile to use from the credential file",
                      "examples": [
                        "my-profile-name"
                      ]
                    },
                    "bucket": {
                      "type": "string",
                      "description": "The bucket to be used by registry",
                      "examples": [
                        "downloads.organization.com"
                      ]
                    },
                    "path": {
                      "type": "string",
                      "description": "The path to be used in the bucket",
                      "examples": [
                        "custom/mydata"
                      ]
                    },
                    "region": {
                      "type": "string",
                      "description": "Sets the region to be used by the AWS s3 client",
                      "examples": [
                        "us-east-1"
                      ]
                    }
                  },
                  "required": [
                    "bucket",
                    "path",
                    "region"
                  ],
                  "additionalProperties": false
                }
              },
              "anyOf" : [
                {
                  "required" : [
                    "service-account-secret-path"
                  ]
                },
                {
                  "required" : [
                    "service-account-secret-path",
                    "s3"
                  ]
                }
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "required": [
            "registry"
          ],
          "type": "object",
          "additionalProperties": false
        }
      

      The anyOf has valid structure but UI populates s3 with empty json object thus implying that there is an s3 element. One cannot use a simple test like whether s3 element is present or not in mustache template to build logic.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                amr Amr Abdelrazik
                Reporter:
                tarunguptaakirala Tarun Gupta Akirala
                Team:
                Frontend Team
                Watchers:
                Amr Abdelrazik, GeorgiSTodorov, Jackson West, Julian Gieseke, Orlando Hohmeier, Philipp Hinrichsen, Tarun Gupta Akirala
              • Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: