In shared preset repositories, some users will use a mix of Inherit
Config and Repo Config options with the existing JSON Schema.
As part of Renovate 43, we're removing the ability for any global
options to be usable in Repo Config, which would also mean that it's now
either a case of "ignoring warnings in my editor" and "using Global
Config JSON Schema", which isn't a great option.
We can instead create a third JSON Schema, one which is focussed on
shared presets that can include Inherit Config options.
This makes it clear that the repo config's JSON Schema should not be
used for anything Inherit Config.
chore(deps): update dependency ajv to v8
| datasource | package | from | to |
| ---------- | ------- | ------ | ------ |
| npm | ajv | 6.12.6 | 8.17.1 |
As part of this upgrade we must:
- use `schemaId: $id`, as `auto` no longer exists
- update type imports
- import `format: uri` validation from `ajv-imports`
- remove now unnecessary `await`
- add `ajv-validation` before compiling the schema (in
`check-fenced-code`)
- migrate to the new `error.instancePath` property
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
As noted in #38727, it would be convenient to distribute a separate JSON
Schema that is explicitly for "global" / "admin" / "self-hosted"
configuration, separate to the repository configuration in our current
`renovate-schema.json`.
This gets wired in as an additional JSON file, and will have a different
set of configuration options in the future, noted by the `isGlobal`.
Closes#38727.
As noted in #38749, we need to upgrade to draft-07 of JSON Schema to
upgrade our dependency on AJV.
To do so, we "just" need to update the `$schema`, as we're not using
anything that's been deprecated/removed/changed as part of draft-07.
This doesn't impact anything user-facing (as these are schemas for
internal data files), and the schema doesn't change.
This appears to be supported by `vscode-json-languageservice`, which is
used by several IDEs (including VSCode) and editors to perform JSON
Schema validation in-editor.
To ensure that our `lib/data` files match the JSON schemas that we have
defined, we can also introduce these into the `tools/validate-schema.ts`
file.
This loops through the known files and the JSON Schema that defines
them, then validates them with AJV.
Note that this also requires the following schema changes:
- using draft-04 everywhere (for ease, as we're not using draft-07
functionality)
- using a consistent `$schema` identifier, to match the document `$id`
- make sure that the top-level `all` key doesn't get matched by
`patternProperties`
The core of this - as little code as it is - was generated via GPT-4.1,
based on existing code in this file.
Co-authored-by: gpt-4.1 <jamie.tanna+github-copilot@mend.io>
To ensure that our JSON Schema is always correctly formed, we can use
`ajv`'s inbuilt metaschema validation to perform.
We also wire this into the `test-schema` script, to make sure that we're
always validating it in CI.
This applies to both the core JSON Schema for configuration, and any of
our other JSON Schema files for internal configuration.
The core of this - as little code as it is - was generated via GPT-4.1.
Co-authored-by: gpt-4.1 <jamie.tanna+github-copilot@mend.io>