Commit f3c5fa2
authored
Fix JSON Schema (#6973)
## What's the problem this PR addresses?
`"type": "mixed"` is not valid JSON Schema. This results in errors in
features such as VS Code's automatic validation:
```
Schema 'Yarn Config (.yarnrc.yml) - Yarnrc configuration files (yarnrc.json)' is not valid:
/properties/httpTimeout/type : must be equal to one of the allowed values
/properties/httpTimeout/type : must be array
/properties/httpTimeout/type : must match a schema in anyOfYAML(768)
```
Resolves #6972
## How did you fix it?
`type` could be omitted completely (it's redundant with `oneOf`) but is
required by the Docusaurus configuration (via
https://github.com/arcanis/react-json-doc?), so I added it as an array.
To prevent further regressions, I added validation of the JSON Schemas
using [AJV](https://ajv.js.org/). If there's a better place for this
test to reside, please let me know.
## Checklist
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.
<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.1 parent b65d527 commit f3c5fa2
File tree
5 files changed
+36
-5
lines changed- packages/docusaurus
- static/configuration
- tests
5 files changed
+36
-5
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| |||
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
864 | | - | |
| 864 | + | |
865 | 865 | | |
866 | 866 | | |
867 | 867 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5957 | 5957 | | |
5958 | 5958 | | |
5959 | 5959 | | |
| 5960 | + | |
5960 | 5961 | | |
5961 | 5962 | | |
5962 | 5963 | | |
| |||
5982 | 5983 | | |
5983 | 5984 | | |
5984 | 5985 | | |
| 5986 | + | |
5985 | 5987 | | |
5986 | 5988 | | |
5987 | 5989 | | |
| |||
6848 | 6850 | | |
6849 | 6851 | | |
6850 | 6852 | | |
6851 | | - | |
| 6853 | + | |
6852 | 6854 | | |
6853 | 6855 | | |
6854 | 6856 | | |
| |||
0 commit comments