express-openapi-validator
Advanced tools
Comparing version
@@ -218,11 +218,17 @@ import * as ajv from 'ajv'; | ||
export type ArraySchemaObjectType = 'array'; | ||
export type SchemaObject = ArraySchemaObject | NonArraySchemaObject; | ||
export interface ArraySchemaObject extends BaseSchemaObject { | ||
type: ArraySchemaObjectType; | ||
export type SchemaObject = ArraySchemaObject | NonArraySchemaObject | CompositionSchemaObject; | ||
export interface ArraySchemaObject extends BaseSchemaObject<ArraySchemaObjectType> { | ||
items: ReferenceObject | SchemaObject; | ||
} | ||
export interface NonArraySchemaObject extends BaseSchemaObject { | ||
type: NonArraySchemaObjectType; | ||
export interface NonArraySchemaObject extends BaseSchemaObject<NonArraySchemaObjectType> { | ||
} | ||
interface BaseSchemaObject { | ||
export interface CompositionSchemaObject extends BaseSchemaObject<undefined> { | ||
allOf?: Array<ReferenceObject | SchemaObject>; | ||
oneOf?: Array<ReferenceObject | SchemaObject>; | ||
anyOf?: Array<ReferenceObject | SchemaObject>; | ||
not?: ReferenceObject | SchemaObject; | ||
discriminator?: DiscriminatorObject; | ||
} | ||
interface BaseSchemaObject<T> { | ||
type?: T; | ||
title?: string; | ||
@@ -251,8 +257,3 @@ description?: string; | ||
}; | ||
allOf?: Array<ReferenceObject | SchemaObject>; | ||
oneOf?: Array<ReferenceObject | SchemaObject>; | ||
anyOf?: Array<ReferenceObject | SchemaObject>; | ||
not?: ReferenceObject | SchemaObject; | ||
nullable?: boolean; | ||
discriminator?: DiscriminatorObject; | ||
readOnly?: boolean; | ||
@@ -259,0 +260,0 @@ writeOnly?: boolean; |
@@ -144,3 +144,3 @@ "use strict"; | ||
const type = schema.type; | ||
const hasXOf = schema.allOf || schema.oneOf || schema.anyOf; | ||
const hasXOf = schema['allOf'] || schema['oneOf'] || schema['anyOf']; | ||
const properties = hasXOf | ||
@@ -147,0 +147,0 @@ ? xOfProperties(schema) |
@@ -196,3 +196,3 @@ "use strict"; | ||
const xOf = schemaObj.oneOf ? 'oneOf' : schemaObj.anyOf ? 'anyOf' : null; | ||
if (xOf && ((_a = schemaObj === null || schemaObj === void 0 ? void 0 : schemaObj.discriminator) === null || _a === void 0 ? void 0 : _a.propertyName) && !o.discriminator) { | ||
if (xOf && ((_a = schemaObj.discriminator) === null || _a === void 0 ? void 0 : _a.propertyName) && !o.discriminator) { | ||
const options = schemaObj[xOf].flatMap((refObject) => { | ||
@@ -199,0 +199,0 @@ if (refObject['$ref'] === undefined) { |
{ | ||
"name": "express-openapi-validator", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Automatically validate API requests and responses with OpenAPI 3 and Express.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
349355
0.02%6013
0.02%