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:
Goldsmith42
2016-12-16 19:06:58 -08:00
committed by Andy
parent 3144f061c3
commit 22a0d56c2e
4 changed files with 51 additions and 0 deletions
+16
View File
@@ -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;
+19
View File
@@ -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"
]
}
+1
View File
@@ -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;
});