This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including swagger-object-validator
with all npm
packages installed. Try it out:
var swaggerValidator = require('swagger-object-validator');
var validator = new swaggerValidator.Handler('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/petstore.yaml');
var pet = {
id: 'This is not a number',
foo: 'bar',
tag: [
'This is an optional argument, but it',
'Should be a String, not an Array of Strings'
]
}
validator.validateModel(pet, 'Pet', function (err, result) {
// Human readable string
console.log(result.humanReadable());
// JSON result for computational interpretation
console.log(JSON.stringify(result, undefined, 2))
});
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.