This commit is contained in:
Vlad Barosan 2019-05-08 14:21:25 -07:00 коммит произвёл GitHub
Родитель 2743fdbd9a
Коммит bed0b058a0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -136,12 +136,12 @@ function validateDiscriminator (report, schema, json) {
// to conform to the Azure specs, we accept a lenient discriminator. if the type is missing in the
// payload we use the base class. Also if the type doesn't match anything, we use the base class.
var basePolymorphicSchemaDiscriminatorType =
var basePolymorphicSchemaDiscriminatorValue =
basePolymorphicSchema.__$refResolved.properties[discriminatorPropertyName].enum[0]
var jsonDiscriminatorValue =
json[discriminatorPropertyName] ||
basePolymorphicSchemaDiscriminatorType
basePolymorphicSchemaDiscriminatorValue
var schemaToValidate =
schema.oneOf.find(
@ -153,7 +153,7 @@ function validateDiscriminator (report, schema, json) {
// if the schema to validate is the base schema, we dont need to validate the discriminator enum value.
if (schemaToValidate === basePolymorphicSchema) {
json[discriminatorPropertyName] = basePolymorphicSchemaDiscriminatorType
json[discriminatorPropertyName] = basePolymorphicSchemaDiscriminatorValue
}
ZSchemaValidator.validate.call(this, report, schemaToValidate, json)
return true

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "yasway",
"version": "1.7.1",
"version": "1.7.2",
"description": "A library that simplifies Swagger integrations.",
"main": "index.js",
"types": "index.d.ts",
@ -81,4 +81,4 @@
"swagger-methods": "^1.0.8",
"swagger-schema-official": "2.0.0-bab6bed"
}
}
}