build: Allow specifying a single file to validate (#2369)

This commit is contained in:
Edwin Kofler
2022-07-23 02:19:05 -07:00
committed by GitHub
parent 67e535d684
commit 040db01b68
2 changed files with 6 additions and 1 deletions

View File

@@ -56,7 +56,7 @@ To make sure that files are validated against your schema correctly (we strongly
1. Create a subfolder in [`src/test`](src/test) named as your schema file
2. Create one or more `.json, .yml or .yaml` files in that folder
3. Run `npm run build`
3. Run `npm run build` (to test a single schema, use `npm run build -- --SchemaName=<jsonFileName.json> default`)
If the build succeeds, your changes are valid and you can safely create a PR.

View File

@@ -119,6 +119,11 @@ module.exports = function (grunt) {
skipReadFile = true,
processOnlyThisOneSchemaFile = undefined
} = {}) {
const schemaNameOption = grunt.option('SchemaName')
if (processOnlyThisOneSchemaFile === undefined && schemaNameOption) {
processOnlyThisOneSchemaFile = schemaNameOption
}
/**
* @summary Check if the present json schema file must be tested or not
* @param {string} jsonFilename