Open Bug 1606570 Opened 5 years ago Updated 2 years ago

Poor error reporting if I specify a parameter of type array without providing items

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: protz, Unassigned)

Details

I have this entry in my schema:

      {
        "name": "setCustomSort",
        "type": "function",
        "description": "Sets the account order according to the list of account ids passed.",
        "async": false,
        "parameters": [
          {
            "name": "accountIds",
            "type": "array"
          }
        ]
      }

as far as I can tell, https://json-schema.org/understanding-json-schema/reference/array.html does not mandate the use of the items property. However, if I omit it, I get an error in Schemas.jsm

This line (from: ArrayType's parseSchema around line 2178)

    let items = root.parseSchema(schema.items, path, ["onError"]);

just ends up throwing later, when doing:

   if ("choices" in schema) {

at line 3298 because schema (the right-hand side of in) is undefined.

Suggested resolution: throwing a more helpful error in case the addon developer forgot to use the items property.

Thanks,

Jonathan

Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.