This commit is contained in:
Vlad Barosan 2019-05-07 21:23:32 -07:00
Родитель 348fe1ec26
Коммит 714f8dc080
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"
}
}
}