-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from samply/feature/add-json-schema
Feature/add json schema
- Loading branch information
Showing
11 changed files
with
469 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
tsc --resolveJsonModule --esModuleInterop options_tester.ts | ||
mv options_tester.js options_tester.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var options_schema_json_1 = __importDefault(require("./packages/lib/src/interfaces/options.schema.json")); | ||
var schemasafe_1 = require("@exodus/schemasafe"); | ||
var options_json_1 = __importDefault(require("./packages/demo/public/options.json")); | ||
console.log("Checking Lens options"); | ||
var parse = (0, schemasafe_1.parser)(options_schema_json_1.default, { | ||
includeErrors: true, | ||
allErrors: true, | ||
}); | ||
var validJSON = parse(JSON.stringify(options_json_1.default)); | ||
if (validJSON.valid === true) { | ||
console.log("Options are valid"); | ||
} | ||
else if (typeof options_json_1.default === "object") { | ||
console.error("Lens-Options are not conform with the JSON schema", validJSON.errors); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import optionsSchema from "./packages/lib/src/interfaces/options.schema.json"; | ||
import { parser } from "@exodus/schemasafe"; | ||
|
||
import options from "./packages/demo/public/options.json"; | ||
|
||
console.log("Checking Lens options"); | ||
|
||
const parse = parser(optionsSchema, { | ||
includeErrors: true, | ||
allErrors: true, | ||
}); | ||
const validJSON = parse(JSON.stringify(options)); | ||
if (validJSON.valid === true) { | ||
console.log("Options are valid"); | ||
} else if (typeof options === "object") { | ||
console.error( | ||
"Lens-Options are not conform with the JSON schema", | ||
validJSON.errors, | ||
); | ||
process.exit(1); | ||
} |
Oops, something went wrong.