bigcommerce / widget-builder

MIT License
18 stars 39 forks source link

fix: add text setting to allowed list of settings #146

Closed loganwoolf closed 10 months ago

loganwoolf commented 12 months ago

Issue

When using the UI type of text, an error is thrown stating that the it is not in the list of allowed values. The UI type is valid.

{
  "type": "text",
  "id": "text",
  "label": "Text",
  "default": "Lorem ipsum dolor sit amit"
},

Error

[
  {
    "start": {
      "line": 1,
      "column": 1013,
      "offset": 1012
    },
    "end": {
      "line": 1,
      "column": 1266,
      "offset": 1265
    },
    "error": "/0/sections/0/settings/2: oneOf should match exactly one schema in oneOf",
    "path": "/0/sections/0/settings/2"
  },
  {
    "start": {
      "line": 1,
      "column": 1021,
      "offset": 1020
    },
    "end": {
      "line": 1,
      "column": 1027,
      "offset": 1026
    },
    "error": "/0/sections/0/settings/2/type should be equal to one of the allowed values: alignment, boolean, boxModel, code, color, element, imageManager, input, number, productId, productImage, range, regexInput, select, toggle, typography, visibility",
    "path": "/0/sections/0/settings/2/type"
  }
]

Solution

In file src/services/schema/schemaValidator/jsonSchema.ts, the definitions.labeledSchemaSetting.oneOf array is missing the value for definitions.textSetting. Reinstalling after making this change fixes the error.