openapi-police
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -14,3 +14,2 @@ import { Schema, ValidationOptions } from 'jsonpolice'; | ||
protected typeValidator(data: any, spec: any, path: string, opts: SchemaObjectOptions): any; | ||
protected formatValidator(data: any, spec: any, path: string, opts: SchemaObjectOptions): any; | ||
protected discriminatorValidator(data: any, spec: any, path: string, opts: SchemaObjectOptions): any; | ||
@@ -17,0 +16,0 @@ protected anyOfValidator(data: any, spec: any, path: string, opts: SchemaObjectOptions): any; |
@@ -37,3 +37,3 @@ "use strict"; | ||
'oneOf', | ||
'not' | ||
'not', | ||
]); | ||
@@ -82,11 +82,2 @@ } | ||
} | ||
formatValidator(data, spec, path, opts) { | ||
if (typeof data === 'string') { | ||
if (typeof spec.format !== 'string') { | ||
throw jsonpolice_1.Schema.error(spec, 'format'); | ||
} | ||
// TODO validate format | ||
} | ||
return data; | ||
} | ||
discriminatorValidator(data, spec, path, opts) { | ||
@@ -99,3 +90,3 @@ if (spec.discriminator === null || typeof spec.discriminator !== 'object' || typeof spec.discriminator.propertyName !== 'string') { | ||
throw new jsonpolice_1.ValidationError(path, jsonpolice_1.Schema.scope(spec), 'discriminator', [ | ||
new jsonpolice_1.ValidationError(`${path}/${spec.discriminator.propertyName}`, jsonpolice_1.Schema.scope(spec), 'required') | ||
new jsonpolice_1.ValidationError(`${path}/${spec.discriminator.propertyName}`, jsonpolice_1.Schema.scope(spec), 'required'), | ||
]); | ||
@@ -118,3 +109,3 @@ } | ||
const alts = spec.anyOf || spec.oneOf; | ||
subSpec = alts.find(s => jsonpolice_1.Schema.scope(s) === disc); | ||
subSpec = alts.find((s) => jsonpolice_1.Schema.scope(s) === disc); | ||
} | ||
@@ -131,3 +122,3 @@ else { | ||
const scope = jsonpolice_1.Schema.scope(spec); | ||
subSpec.allOf = subSpec.allOf.filter(s => jsonpolice_1.Schema.scope(s) !== scope); | ||
subSpec.allOf = subSpec.allOf.filter((s) => jsonpolice_1.Schema.scope(s) !== scope); | ||
} | ||
@@ -134,0 +125,0 @@ try { |
{ | ||
"name": "openapi-police", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "OpenAPI v3 validators and utilities", | ||
@@ -73,3 +73,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"jsonpolice": "^9.0.0", | ||
"jsonpolice": "^10.0.0", | ||
"jsonref": "^7.0.0" | ||
@@ -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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
31625
793
+ Addedjsonpolice@10.0.1(transitive)
- Removedjsonpolice@9.0.0(transitive)
Updatedjsonpolice@^10.0.0