Angular-cli: Discuss: CLI Configuration JSON Schema and option discovery

Created on 10 Apr 2018  路  4Comments  路  Source: angular/angular-cli

We can use enums and anyOf for validating properly, but editors might not be show completion properly.

2 (required)

Most helpful comment

Proof of concept schema fragment:

    "test": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "not": { "enum": [ "pancake", "waffle" ] }
            },
            "options": { "type": "object" }
          }
        },
        {
          "type": "object",
          "properties": {
            "name": { "const": "pancake" },
            "options": {
              "type": "object",
              "properties": {
                "x": { "type": "number" },
                "y": { "type": "number" }
              },
              "additionalProperties": false
            }
          },
        },
        {
          "type": "object",
          "properties": {
            "name": { "const": "waffle" },
            "options": {
              "type": "object",
              "properties": {
                "a": {"type":"string"},
                "b": {"type":"boolean"}
              },
              "additionalProperties": false
            }
          }
        }
      ]
    }

All 4 comments

Having a schema => Markdown transformer would help. Better to have good doc than good completion.

Proof of concept schema fragment:

    "test": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "not": { "enum": [ "pancake", "waffle" ] }
            },
            "options": { "type": "object" }
          }
        },
        {
          "type": "object",
          "properties": {
            "name": { "const": "pancake" },
            "options": {
              "type": "object",
              "properties": {
                "x": { "type": "number" },
                "y": { "type": "number" }
              },
              "additionalProperties": false
            }
          },
        },
        {
          "type": "object",
          "properties": {
            "name": { "const": "waffle" },
            "options": {
              "type": "object",
              "properties": {
                "a": {"type":"string"},
                "b": {"type":"boolean"}
              },
              "additionalProperties": false
            }
          }
        }
      ]
    }

Two things;

  1. This should be a wiki document that contains enough information that people can refer to.
  2. This is not a blocking issue for 6.0; the $schema property should point to a url on a server that we can update easily. This should be at (tentative) http://angular.io/schemas/angular.json/6.0.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings