mdn / mdn/data

The "better-ajv-errors" package fails to report a schema error

Open
#441 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

idle
Dominant language
JavaScript
Stars
787
Forks
216
Avg merge
1d 5h
Merged PRs (30d)
6

Description

When linting https://github.com/mdn/data/blob/master/css/at-rules.json, a schema error was detected for the `@property` object (https://github.com/mdn/data/blob/3a92ce8348e83a0ce7beef84b45accf151645f92/css/at-rules.json#L331):
```json
"@property": {
"syntax": "@property {\n \n}",
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@property"
},
```
because it was missing the `groups` property per https://github.com/mdn/data/blob/3a92ce8348e83a0ce7beef84b45accf151645f92/css/at-rules.schema.json#L39
Although the error output reports `JSON Schema – 1 error(s)`, the detailed error message is blank:
```
...
css/at-rules.json
Style – OK
JSON Schema – 1 error(s)

css/at-rules.schema.json
Style – OK
...
```

This seems to be a problem in the `better-ajv-errors` npm package.

NOTE (to self): The value of `ajv.errors` at https://github.com/mdn/data/blob/3a92ce8348e83a0ce7beef84b45accf151645f92/test/lint.js#L75 was:
```json
[
{
keyword: 'required',
dataPath: '/@property',
schemaPath: '#/additionalProperties/required',
params: { missingProperty: 'groups' },
message: "should have required property 'groups'"
}
]
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test/lint.js at the reported line and reproduce linting css/at-rules.json against css/at-rules.schema.json. Inspect how the recorded ajv.errors entry is passed to better-ajv-errors; done means the existing missing-property error is rendered with a non-blank detailed message.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.