json-schema-form / json-schema-form-core

Core library
MIT License
65 stars 13 forks source link

fix(canonical-title-map): add use case for enumNames #8

Open jmfrancois opened 6 years ago

jmfrancois commented 6 years ago

Description

Add support case for enumNames. Spec: https://github.com/json-schema-org/json-schema-spec/issues/57

We have some schemas with the following shape:

{
  "jsonSchema": {
    "type": "object",
    "title": "Datalist",
    "properties": {
      "test": {
        "type": "string",
        "enum": [ "a", "p", "b", "c", "l", "g" ],
        "enumNames": [ "Apple", "Pine[apple]", "Banana", "Cher[ry", "Lemo}n", "Grapefruit" ]
      }
    },
    "required": [
      "test"
    ]
  },
  "uiSchema": [
    {
      "key": "test",
      "title": "Datalist with named options",
      "widget": "datalist"
    }
  ],
  "properties": {
    "test": "Pine[apple]"
  }
}

This raise exception with the current implementation because we have an array of value for the titleMap;

Checklist

@json-schema-form/angular-schema-form-lead