swagger-schema
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -55,3 +55,3 @@ /** | ||
this.env.addTypeCoercion('number', function(v) { | ||
if (typeof v === 'string' && v.match(/^(\d+|\d*\.\d+|\d+\.\d*)$/)) { | ||
if (typeof v === 'string' && v.match(/^\-?(\d+|\d*\.\d+|\d+\.\d*)$/)) { | ||
return parseFloat(v); | ||
@@ -58,0 +58,0 @@ } |
{ | ||
"name": "swagger-schema", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Swagger schema helpers", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
# Swagger Schema | ||
This is a helper library for [Swagger Framework][framework] and [Swagger Agent][agent]. | ||
This is a helper library for [Swagger Framework][framework]. | ||
@@ -9,3 +9,2 @@ ## License | ||
[agent]: https://github.com/silas/swagger-agent | ||
[framework]: https://github.com/silas/swagger-framework |
@@ -31,3 +31,16 @@ 'use strict'; | ||
}); | ||
it('should convert negative number', function() { | ||
var schema = { | ||
type: 'object', | ||
properties: { one: { type: 'number' } }, | ||
}; | ||
var number = -23.5; | ||
var data = { one: '' + number }; | ||
this.env.validateThrow(schema, data, { coerce: true }); | ||
data.one.should.equal(number); | ||
}); | ||
}); | ||
}); |
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
59465
2029
10