Skip to content

Commit 0dd9ef8

Browse files
committed
Install referenced schema in "npm:validate" task
The "npm:validate" task validates the repository's `package.json` npm manifest file against its JSON schema to catch any problems with its data format. In order to avoid duplication of content, JSON schemas may reference other schemas via the `$ref` keyword. The `package.json` schema was recently updated to share resources with the "base" configuration schema, which caused the validation to start failing: schema /tmp/package-json-schema-norSGPxlCR.json is invalid error: can't resolve reference https://json.schemastore.org/base.json#/definitions/license from id https://json.schemastore.org/package.json# task: Failed to run task "npm:validate": exit status 1 The solution is to configure the task to download that schema as well and also to provide its path to the avj-cli validator via a `-r` flag.
1 parent c65c819 commit 0dd9ef8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Taskfile.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ tasks:
147147
AVA_SCHEMA_URL: https://json.schemastore.org/ava.json
148148
AVA_SCHEMA_PATH:
149149
sh: task utility:mktemp-file TEMPLATE="ava-schema-XXXXXXXXXX.json"
150+
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/base.json
151+
BASE_SCHEMA_URL: https://json.schemastore.org/base.json
152+
BASE_SCHEMA_PATH:
153+
sh: task utility:mktemp-file TEMPLATE="base-schema-XXXXXXXXXX.json"
150154
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/eslintrc.json
151155
ESLINTRC_SCHEMA_URL: https://json.schemastore.org/eslintrc.json
152156
ESLINTRC_SCHEMA_PATH:
@@ -184,6 +188,7 @@ tasks:
184188
cmds:
185189
- wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}}
186190
- wget --quiet --output-document="{{.AVA_SCHEMA_PATH}}" {{.AVA_SCHEMA_URL}}
191+
- wget --quiet --output-document="{{.BASE_SCHEMA_PATH}}" {{.BASE_SCHEMA_URL}}
187192
- wget --quiet --output-document="{{.ESLINTRC_SCHEMA_PATH}}" {{.ESLINTRC_SCHEMA_URL}}
188193
- wget --quiet --output-document="{{.JSCPD_SCHEMA_PATH}}" {{.JSCPD_SCHEMA_URL}}
189194
- wget --quiet --output-document="{{.NPM_BADGES_SCHEMA_PATH}}" {{.NPM_BADGES_SCHEMA_URL}}
@@ -197,6 +202,7 @@ tasks:
197202
--all-errors \
198203
-s "{{.SCHEMA_PATH}}" \
199204
-r "{{.AVA_SCHEMA_PATH}}" \
205+
-r "{{.BASE_SCHEMA_PATH}}" \
200206
-r "{{.ESLINTRC_SCHEMA_PATH}}" \
201207
-r "{{.JSCPD_SCHEMA_PATH}}" \
202208
-r "{{.NPM_BADGES_SCHEMA_PATH}}" \

0 commit comments

Comments
 (0)