openapi-police
Advanced tools
Comparing version 1.0.7 to 1.0.8
export * from 'jsonpolice'; | ||
export { ParameterError } from './errors'; | ||
export { ParameterObject } from './parameter'; | ||
export { SchemaObject } from './schema-object'; | ||
export { SchemaObject, SchemaObjectOptions } from './schema-object'; | ||
export { OpenAPIV3 } from './types'; |
@@ -1,3 +0,2 @@ | ||
import { ValidationOptions } from "jsonpolice"; | ||
import { SchemaObject } from "./schema-object"; | ||
import { SchemaObject, SchemaObjectOptions } from "./schema-object"; | ||
import { OpenAPIV3 } from "./types"; | ||
@@ -9,4 +8,4 @@ export declare class ParameterObject extends SchemaObject { | ||
coerceToType(data: string, type: string): any; | ||
validate(data: any, opts?: ValidationOptions, path?: string): Promise<any>; | ||
protected typeValidator(data: any, spec: any, path: string, opts: ValidationOptions): any; | ||
validate(data: any, opts?: SchemaObjectOptions, path?: string): Promise<any>; | ||
protected typeValidator(data: any, spec: any, path: string, opts: SchemaObjectOptions): any; | ||
} |
@@ -192,3 +192,3 @@ "use strict"; | ||
coerceToType(data, type) { | ||
let out = this.parseStyle(data, type); | ||
let out = data; | ||
if (typeof out === 'string') { | ||
@@ -230,2 +230,6 @@ if (type === 'boolean') { | ||
if (typeof data === 'string') { | ||
if (opts.parseStyle !== false) { | ||
data = this.parseStyle(data, spec.type); | ||
opts.parseStyle = false; | ||
} | ||
data = this.coerceToType(data, spec.type); | ||
@@ -232,0 +236,0 @@ } |
import { Schema, ValidationOptions } from 'jsonpolice'; | ||
import { OpenAPIV3 } from './types'; | ||
export interface SchemaObjectOptions extends ValidationOptions { | ||
parseStyle?: boolean; | ||
contentType?: string; | ||
} | ||
export declare class SchemaObject extends Schema { | ||
@@ -8,7 +12,7 @@ protected _spec: Promise<OpenAPIV3.SchemaObject>; | ||
protected readonly validators: Set<string>; | ||
protected typeValidator(data: any, spec: any, path: string, opts: ValidationOptions): any; | ||
protected formatValidator(data: any, spec: any, path: string, opts: ValidationOptions): any; | ||
protected discriminatorValidator(data: any, spec: any, path: string, opts: ValidationOptions): any; | ||
protected anyOfValidator(data: any, spec: any, path: string, opts: ValidationOptions): any; | ||
protected oneOfValidator(data: any, spec: any, path: string, opts: ValidationOptions): any; | ||
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; | ||
protected anyOfValidator(data: any, spec: any, path: string, opts: SchemaObjectOptions): any; | ||
protected oneOfValidator(data: any, spec: any, path: string, opts: SchemaObjectOptions): any; | ||
} |
{ | ||
"name": "openapi-police", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "OpenAPI v3 validators and utilities", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
29343
764