зеркало из https://github.com/Azure/sway.git
Switch back to z-schema (#47)
This commit is contained in:
Родитель
0afda4f64e
Коммит
6adde9c6a0
|
@ -30,8 +30,8 @@ var formatValidators = require('./validation/format-validators');
|
||||||
var customValidators = require('./validation/custom-zschema-validators');
|
var customValidators = require('./validation/custom-zschema-validators');
|
||||||
var JsonRefs = require('json-refs');
|
var JsonRefs = require('json-refs');
|
||||||
var rewire = require('rewire');
|
var rewire = require('rewire');
|
||||||
var ZSchemaValidator = rewire('@ts-common/z-schema/src/JsonValidation');
|
var ZSchemaValidator = rewire('z-schema/src/JsonValidation');
|
||||||
var ZSchema = rewire('@ts-common/z-schema');
|
var ZSchema = rewire('z-schema');
|
||||||
// full-date from http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14
|
// full-date from http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14
|
||||||
var dateRegExp = new RegExp(
|
var dateRegExp = new RegExp(
|
||||||
'^' +
|
'^' +
|
||||||
|
|
|
@ -29,7 +29,7 @@ var helpers = require('../helpers');
|
||||||
var JsonRefs = require('json-refs');
|
var JsonRefs = require('json-refs');
|
||||||
var supportedHttpMethods = require('swagger-methods');
|
var supportedHttpMethods = require('swagger-methods');
|
||||||
var swaggerSchema = require('swagger-schema-official/schema');
|
var swaggerSchema = require('swagger-schema-official/schema');
|
||||||
var jsonSymbol = require('@ts-common/z-schema').jsonSymbol;
|
var jsonSymbol = require('z-schema').jsonSymbol;
|
||||||
|
|
||||||
function getSchemaProperties (schema) {
|
function getSchemaProperties (schema) {
|
||||||
var properties = _.keys(schema.properties); // Start with the defined properties
|
var properties = _.keys(schema.properties); // Start with the defined properties
|
||||||
|
@ -106,7 +106,11 @@ function walkSchema (api, blacklist, schema, path, handlers, response) {
|
||||||
* @returns {object} Object containing the errors and warnings of the validation
|
* @returns {object} Object containing the errors and warnings of the validation
|
||||||
*/
|
*/
|
||||||
function validateStructure (api) {
|
function validateStructure (api) {
|
||||||
var results = helpers.validateAgainstSchema(helpers.getJSONSchemaValidator(), swaggerSchema, api.definitionFullyResolved);
|
var results = helpers.validateAgainstSchema(
|
||||||
|
helpers.getJSONSchemaValidator(),
|
||||||
|
swaggerSchema,
|
||||||
|
api.definitionFullyResolved
|
||||||
|
);
|
||||||
|
|
||||||
// Make complex JSON Schema validation errors easier to understand (Issue 15)
|
// Make complex JSON Schema validation errors easier to understand (Issue 15)
|
||||||
results.errors = results.errors.map(function (error) {
|
results.errors = results.errors.map(function (error) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "yasway",
|
"name": "yasway",
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -26,18 +26,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/@ts-common/tuple/-/tuple-0.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ts-common/tuple/-/tuple-0.0.0.tgz",
|
||||||
"integrity": "sha512-4ETK16scspsJamVLbsBNTU/hnZUhY0gpTiIK2F7A/3Pr6kNg5FrPNu9x+aAx2OvfyGN+U8NiGROyaZXN4v1FHg=="
|
"integrity": "sha512-4ETK16scspsJamVLbsBNTU/hnZUhY0gpTiIK2F7A/3Pr6kNg5FrPNu9x+aAx2OvfyGN+U8NiGROyaZXN4v1FHg=="
|
||||||
},
|
},
|
||||||
"@ts-common/z-schema": {
|
|
||||||
"version": "3.24.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@ts-common/z-schema/-/z-schema-3.24.0.tgz",
|
|
||||||
"integrity": "sha512-8oE5QhJmCmUztO7HS68hy6zLRkzhY8jxmHWD56TKVsZpHemF94gYgoKRKuBs72iP78Whdc0bmtjJcaWiTh899w==",
|
|
||||||
"requires": {
|
|
||||||
"commander": "^2.7.1",
|
|
||||||
"core-js": "^2.5.7",
|
|
||||||
"lodash.get": "^4.0.0",
|
|
||||||
"lodash.isequal": "^4.0.0",
|
|
||||||
"validator": "^10.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"JSONSelect": {
|
"JSONSelect": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz",
|
||||||
|
@ -11905,6 +11893,18 @@
|
||||||
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
||||||
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=",
|
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"z-schema": {
|
||||||
|
"version": "3.24.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/z-schema/-/z-schema-3.24.1.tgz",
|
||||||
|
"integrity": "sha512-2eR8eq/v1coNqyBc5HzswEcoLbw+S33RMnR326uiuOIr97ve5vwPNMDrKS1IRCB12bZ3a8BrfGxrRwuSXUyPvw==",
|
||||||
|
"requires": {
|
||||||
|
"commander": "^2.7.1",
|
||||||
|
"core-js": "^2.5.7",
|
||||||
|
"lodash.get": "^4.0.0",
|
||||||
|
"lodash.isequal": "^4.0.0",
|
||||||
|
"validator": "^10.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "yasway",
|
"name": "yasway",
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
"description": "A library that simplifies Swagger integrations.",
|
"description": "A library that simplifies Swagger integrations.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ts-common/string-map": "0.0.26",
|
"@ts-common/string-map": "0.0.26",
|
||||||
"@ts-common/z-schema": "^3.24.0",
|
"z-schema": "^3.24.1",
|
||||||
"debug": "^3.1.0",
|
"debug": "^3.1.0",
|
||||||
"faker": "^4.1.0",
|
"faker": "^4.1.0",
|
||||||
"js-base64": "^2.4.8",
|
"js-base64": "^2.4.8",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче