mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Defintions for xsd-schema-validator (#13392)
* Added definition for async-polling * async-polling tests with noImplicitAny * Definitions for xsd-schema-validator
This commit is contained in:
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for xsd-schema-validator 0.5
|
||||
// Project: https://github.com/nikku/node-xsd-schema-validator#readme
|
||||
// Definitions by: Zlatko Andonovski <https://github.com/Goldsmith42/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare namespace XsdSchemaValidator {
|
||||
export function validateXML(xml: string|NodeJS.ReadableStream|{file: string}, pathToXsd: string, callback: (err: Error, result: {
|
||||
valid: boolean;
|
||||
messages: string[];
|
||||
result: string;
|
||||
}) => void): void;
|
||||
}
|
||||
|
||||
export = XsdSchemaValidator;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"xsd-schema-validator-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -0,0 +1,15 @@
|
||||
import fs = require("fs");
|
||||
import validator = require("xsd-schema-validator");
|
||||
|
||||
|
||||
validator.validateXML("<foo:bar />", 'resources/foo.xsd', function(err, result) {
|
||||
if (err) {
|
||||
throw err;
|
||||
} else return result.valid;
|
||||
});
|
||||
validator.validateXML(fs.createReadStream('some.xml'), "schema.xsd", (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
validator.validateXML({ file: "some.xml" }, "schema.xsd", (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Reference in New Issue
Block a user