openapi-police
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -9,4 +9,4 @@ import { ValidationOptions } from "jsonpolice"; | ||
coerceToType(data: string, type: string): any; | ||
validate(data: any, opts?: ValidationOptions): Promise<any>; | ||
validate(data: any, opts?: ValidationOptions, path?: string): Promise<any>; | ||
protected typeValidator(data: any, spec: any, path: string, opts: ValidationOptions): any; | ||
} |
@@ -18,4 +18,4 @@ "use strict"; | ||
const stylesByLocation = { | ||
path: ['simple', 'matrix', 'label'], | ||
query: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'], | ||
path: ['simple', 'label', 'matrix'], | ||
query: ['simple', 'spaceDelimited', 'pipeDelimited', 'deepObject'], | ||
cookie: ['form'], | ||
@@ -199,3 +199,3 @@ header: ['simple'] | ||
else if (type === 'number' || type === 'integer') { | ||
out = parseInt(out); | ||
out = parseFloat(out); | ||
} | ||
@@ -208,3 +208,3 @@ } | ||
} | ||
async validate(data, opts = {}) { | ||
async validate(data, opts = {}, path = '') { | ||
if (this.parameter.content) { | ||
@@ -215,3 +215,3 @@ // TODO validate using the MediaTypeValidator for the correct media type | ||
else { | ||
return super.validate(data, opts); | ||
return super.validate(data, opts, path); | ||
} | ||
@@ -232,3 +232,3 @@ } | ||
if (this.parameter.required) { | ||
throw new jsonpolice_1.ValidationError('', jsonpolice_1.Schema.scope(spec), 'required'); | ||
throw new jsonpolice_1.ValidationError(path, jsonpolice_1.Schema.scope(spec), 'required'); | ||
} | ||
@@ -235,0 +235,0 @@ else { |
@@ -99,3 +99,3 @@ "use strict"; | ||
if (typeof subSpec === 'undefined') { | ||
throw jsonpolice_1.Schema.error(spec.discriminator, 'subschema'); | ||
throw jsonpolice_1.Schema.error(spec.discriminator, 'schema'); | ||
} | ||
@@ -102,0 +102,0 @@ else { |
{ | ||
"name": "openapi-police", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "OpenAPI v3 validators and utilities", | ||
@@ -73,3 +73,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"jsonpolice": "^8.0.2", | ||
"jsonpolice": "^8.0.3", | ||
"jsonref": "^5.1.1" | ||
@@ -76,0 +76,0 @@ }, |
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
28935
Updatedjsonpolice@^8.0.3