Skip to content

Commit 80c036a

Browse files
committed
Use modern version of validator to validate Dependabot configuration files
The repository infrastructure validates the project's own as well as the "asset" Dependabot configuration files against the JSON schema. The ajv-cli validator is used to perform the validation. Support for the JSON schema "Draft-04" specification was dropped at the 4.0.0 release of ajv-cli. This means that the previous version (3.3.0) must be used when validating files against a JSON schema based on the "Draft 4" specification. When working with schemas based on newer specification versions, it is preferred to use the latest version of ajv-cli in order to benefit from the ongoing development on the tool. For this reason, two different versions of ajv-cli are used. At the time the system for validating the Dependabot configuration files was set up, that JSON schema was based on the "Draft-04" specification, so ajv-cli 3.3.0 was used. Since that time the schema was updated to "Draft-07" so it is now possible to use the modern ajv-cli for this validation.
1 parent 0e986a4 commit 80c036a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Taskfile.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,24 +363,22 @@ tasks:
363363
DATA_PATH: ".github/dependabot.yml"
364364
# The asset Dependabot configuration files.
365365
ASSETS_DATA_PATH: "workflow-templates/assets/dependabot/**/dependabot.yml"
366-
PROJECT_FOLDER:
367-
sh: pwd
368366
WORKING_FOLDER:
369367
sh: task utility:mktemp-folder TEMPLATE="dependabot-validate-XXXXXXXXXX"
370368
cmds:
371369
- wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}}
372370
- |
373-
cd "{{.WORKING_FOLDER}}" # Workaround for https://github.com/npm/cli/issues/3210
374-
npx ajv-cli@{{.SCHEMA_DRAFT_4_AJV_CLI_VERSION}} validate \
371+
npx ajv-cli validate \
375372
--all-errors \
373+
--strict=false \
376374
-s "{{.SCHEMA_PATH}}" \
377-
-d "{{.PROJECT_FOLDER}}/{{.DATA_PATH}}"
375+
-d "{{.DATA_PATH}}"
378376
- |
379-
cd "{{.WORKING_FOLDER}}" # Workaround for https://github.com/npm/cli/issues/3210
380-
npx ajv-cli@{{.SCHEMA_DRAFT_4_AJV_CLI_VERSION}} validate \
377+
npx ajv-cli validate \
381378
--all-errors \
379+
--strict=false \
382380
-s "{{.SCHEMA_PATH}}" \
383-
-d "{{.PROJECT_FOLDER}}/{{.ASSETS_DATA_PATH}}"
381+
-d "{{.ASSETS_DATA_PATH}}"
384382
385383
docs:generate:
386384
desc: Create all generated documentation content

0 commit comments

Comments
 (0)