xsd-schema-validator
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -11,3 +11,6 @@ import { Readable as ReadableStream } from "stream"; | ||
xml: string | Buffer| ReadableStream | { file: string }, | ||
pathToXsd: string | ||
pathToXsd: string, | ||
options?: { | ||
insecure?: boolean | ||
} | ||
): Promise<ValidateResult>; | ||
@@ -14,0 +17,0 @@ |
@@ -17,3 +17,3 @@ const fs = require('fs'); | ||
const VALIDATOR = path.resolve(__dirname, '../support/XMLValidator'); | ||
const VALIDATOR = path.resolve(BASE_DIR, 'support/XMLValidator'); | ||
@@ -95,8 +95,9 @@ async function withJava(executable, debug) { | ||
* | ||
* @param {String|Buffer|ReadableStream|Object} xml | ||
* @param {String} schema path to schema | ||
* @param { string|Buffer|ReadableStream|Object } xml | ||
* @param { string } schema path to schema | ||
* @param { { insecure?: boolean } } [options] | ||
* | ||
* @return Promise<any> | ||
*/ | ||
Validator.prototype.validateXML = async function(xml, schema) { | ||
Validator.prototype.validateXML = async function(xml, schema, { insecure } = { }) { | ||
@@ -142,3 +143,3 @@ const cwd = this.cwd; | ||
const validator = spawn(java, [ | ||
const args = [ | ||
'-Dfile.encoding=UTF-8', | ||
@@ -148,6 +149,9 @@ '-classpath', | ||
'support.XMLValidator', | ||
insecure ? '-insecure' : null, | ||
input.file ? '-file=' + input.file : '-stdin', | ||
'-schema=' + schema | ||
], { cwd: cwd }); | ||
].filter(arg => arg); | ||
const validator = spawn(java, args, { cwd: cwd }); | ||
let result, | ||
@@ -268,6 +272,7 @@ code, | ||
* | ||
* @param {String|ReadableStream} xml | ||
* @param {String} schema | ||
* @param { string|ReadableStream|Buffer|{ file: string } } xml | ||
* @param { string } schema | ||
* @param { { insecure?: boolean } } [options] | ||
*/ | ||
module.exports.validateXML = function(xml, schema) { | ||
module.exports.validateXML = function(xml, schema, options) { | ||
@@ -278,5 +283,5 @@ const cwd = process.cwd(); | ||
return new Validator({ | ||
cwd: cwd, | ||
debug: debug | ||
}).validateXML(xml, schema); | ||
cwd, | ||
debug | ||
}).validateXML(xml, schema, options); | ||
}; |
{ | ||
"name": "xsd-schema-validator", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "A (XSD) schema validator for nodejs", | ||
@@ -30,10 +30,10 @@ "main": "lib/validator.js", | ||
"devDependencies": { | ||
"@types/mocha": "^10.0.9", | ||
"@types/node": "^20.17.6", | ||
"@types/mocha": "^10.0.10", | ||
"@types/node": "^20.17.14", | ||
"chai": "^4.5.0", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-bpmn-io": "^1.0.0", | ||
"eslint": "^9.18.0", | ||
"eslint-plugin-bpmn-io": "^2.1.0", | ||
"mocha": "^10.8.2", | ||
"npm-run-all2": "^7.0.1", | ||
"typescript": "^5.6.3" | ||
"npm-run-all2": "^7.0.2", | ||
"typescript": "^5.7.3" | ||
}, | ||
@@ -40,0 +40,0 @@ "dependencies": { |
# xsd-schema-validator | ||
[![CI](https://github.com/nikku/node-xsd-schema-validator/workflows/CI/badge.svg)](https://github.com/nikku/node-xsd-schema-validator/actions?query=workflow%3ACI) | ||
[![CI](https://github.com/nikku/node-xsd-schema-validator/actions/workflows/CI.yml/badge.svg)](https://github.com/nikku/node-xsd-schema-validator/actions/workflows/CI.yml) | ||
@@ -5,0 +5,0 @@ A (XSD) schema validator for [NodeJS](nodejs.org) that uses [Java](https://www.java.com) to perform the actual validation. [:arrow_right: Why?](#why) |
Sorry, the diff of this file is not supported yet
17899
8
346