oas-validator
Advanced tools
Comparing version 5.0.2 to 5.0.3
20
index.js
@@ -480,2 +480,7 @@ // @ts-check | ||
} | ||
for (let k in link) { | ||
if (!k.startsWith('x-')) { | ||
should(['operationRef','operationId','parameters','requestBody','description','server'].indexOf(k)).be.greaterThan(-1,'link object cannot have additionalProperty: '+k); | ||
} | ||
} | ||
if (options.lint) options.linter('link',link,'link',options); | ||
@@ -526,2 +531,7 @@ } | ||
} | ||
for (let k in header) { | ||
if (!k.startsWith('x-')) { | ||
should(['description','required','deprecated','allowEmptyValue','style','explode','allowReserved','schema','example','examples','content'].indexOf(k)).be.greaterThan(-1,'header object cannot have additionalProperty: '+k); | ||
} | ||
} | ||
if (options.lint) options.linter('header',header,'header',options); | ||
@@ -569,2 +579,7 @@ } | ||
} | ||
for (let k in response) { | ||
if (!k.startsWith('x-')) { | ||
should(['description','headers','content','links'].indexOf(k)).be.greaterThan(-1,'response object cannot have additionalProperty: '+k); | ||
} | ||
} | ||
if (options.lint) options.linter('response',response,key,options); | ||
@@ -672,2 +687,7 @@ } | ||
} | ||
for (let k in param) { | ||
if (!k.startsWith('x-')) { | ||
should(['name','in','description','required','deprecated','allowEmptyValue','style','explode','allowReserved','schema','example','examples','content'].indexOf(k)).be.greaterThan(-1,'parameter object cannot have additionalProperty: '+k); | ||
} | ||
} | ||
if (options.lint) options.linter('parameter',param,index,options); | ||
@@ -674,0 +694,0 @@ options.context.pop(); |
{ | ||
"name": "oas-validator", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Parser/validator for OpenAPI 3.x definitions", | ||
@@ -22,4 +22,4 @@ "main": "index.js", | ||
"oas-kit-common": "^1.0.8", | ||
"oas-linter": "^3.2.0", | ||
"oas-resolver": "^2.5.1", | ||
"oas-linter": "^3.2.1", | ||
"oas-resolver": "^2.5.2", | ||
"oas-schema-walker": "^1.1.5", | ||
@@ -37,3 +37,3 @@ "reftools": "^1.1.6", | ||
}, | ||
"gitHead": "31af52d282bb1bc3312f2948135fe64b7d81e57e" | ||
"gitHead": "30b3b500f4534cc6e92eecabbfab7bb76fe99c42" | ||
} |
@@ -8,10 +8,16 @@ # oas-validator | ||
const options = {}; | ||
validator.validate(openapi, options, function(err, options){ | ||
// options.valid contains the result of the validation | ||
// options.context now contains a stack (array) of JSON-Pointer strings | ||
validator.validate(openapi, options) | ||
.then(function(options){ | ||
// options.valid contains the result of the validation, true in this branch | ||
}) | ||
.catch(function(err){ | ||
console.warn(err.message); | ||
if (options.context) console.warn('Location',options.context.pop()); | ||
}); | ||
``` | ||
If the callback argument of `validate` is omitted, a Promise is returned instead. | ||
If a third `callback` argument to `validate` is provided, the callback will be called instead of a Promise being returned. | ||
`oas-validator` is an assertion-based validator, which stops on the first error, as structural errors may otherwise cause further (spurious) errors to be reported. If the `lint` option is set, multiple `warnings` may be reported. | ||
See here for complete [documentation](/docs/options.md) of the `options` object. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67036
1366
23
Updatedoas-linter@^3.2.1
Updatedoas-resolver@^2.5.2