Sign Up for Free

RunKit +

Try any Node.js package right in your browser

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.

swagger-object-validator v1.4.5

Validate your objects against a swagger spec and receive in-depth error traces

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free