Remove lazy definition initialization in SchemaValidator
Issue #245
resolved
That lazy initialization is a possible source of a false positive validation error. The method setupSchemaDefinitionRefs
, which loads the definition
on first validation, might throw an:
JsonParseException
leading tovalidation.{keyPrefix}.schema.invalidJson
IOException
leading tovalidation.{keyPrefix}.schema.unknownError
Both is wrong as not the tested schema is wrong but the (OpenAPI) api
.
The calculation of definitionsContainAllOf
seems wrong, too. It is repeatedly set on a for-loop. So it might be set to true
and on the next iteration it is set back to false
again.
Plus there are several unneccessary conversions from an Object
to a JSON string back to an Object (JsonNode)
instead of just converting it directly to the JsonNode
.
There is potential to improve the SchemaValidator
.
Comments (2)
-
reporter -
- changed status to resolved
Available in v2.7.1
- Log in to comment
And the
SchemaValidator
has an additional constructor which is only used for testing. But there is no (visible?) reason why those tests can’t be simply called with the other constructor.