jdorn / json-editor

JSON Schema Based Editor
MIT License
5.81k stars 1.08k forks source link

patternProperties: keys are not shown and can't add additional data instances #814

Open fatbearinc opened 6 years ago

fatbearinc commented 6 years ago

I've noticed two issues when using patternProperties:

  1. The generated form does not show the value (regex actual match) for keys. In the example below, I would want to see the names Art, Bruce, and Steve on the form.

  2. In addition, there is no widget providing the ability in the form to add additional key-value pairs. For example, I have no way of adding the name Mary with the office number 6104.

I used your JSON Editor Example webpage to be able to intepret the following JSON data and schema as shown below.

data:

{
   "offices":
   {
      "Art": "3240",
      "Bruce": "4184",
      "Steve": "1175"
   }
}

schema:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Employee Offices",
  "type": "object",
  "properties": {
    "offices": {
      "title": "Offices",
      "description": "Employee Offices",
      "type": "object",
      "patternProperties": {
        "^.*$": {
          "type": "string",
          "title": "Office #",
          "description": "The person's office number"
        }
      }
    }
  }
}
schmunk42 commented 6 years ago

This repo is no longer maintained (see also https://github.com/jdorn/json-editor/issues/800)

Development is continued at https://github.com/json-editor/json-editor

For details please visit https://github.com/json-editor/json-editor/issues/5