Created
September 9, 2019 15:58
-
-
Save Lily418/0fb96b6dd4ae87885f0c788b070383ac to your computer and use it in GitHub Desktop.
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
const Ajv = require("ajv"); | |
const pack = require("ajv-pack"); | |
const ajv = new Ajv({ | |
sourceCode: true, | |
schemaId: "auto", | |
allErrors: true, | |
jsonPointers: true, | |
errorDataPath: "property", | |
verbose: true | |
}); | |
const drugSchema = require("schema.json"); | |
const fs = require("fs"); | |
const validate = ajv.compile(drugSchema); | |
const moduleCode = pack(ajv, validate); | |
fs.writeFileSync("./validate_schema.js", moduleCode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment