Validation returns a false positive result when 'allOf' is used in response schema
When allOf
is used in the schema of a response the swagger rest assured plugin produces false positive validation results.
The error occurs when a response defines a schema using allOf
like in the following example:
definitions:
Foo:
properties:
foo:
type: string
required:
- foo
Bar:
properties:
bar:
type: string
required:
- bar
responses:
FooAndBar:
description: Object with properties foo and bar implemented with allOf
schema:
allOf:
- $ref: "#/definitions/Foo"
- $ref: "#/definitions/Bar"
If the above response definition is used the SwaggerValidationFilter
will accept wrong responses, for example:
{
"foo": "some value"
}
This behavior renders the rest assured plugin (and maybe the others too) pretty much useless as soon as responses or definitions make use of allOf
, therefore I classified this bug as critical
.
To give a self contained and more complete example I created a swagger file and an example test that shows this behavior. In the example test only the methods testFooAndBarWithFooBar
and testFooBarWithFooBar
should pass. But as the example shows the three other tests that involve a response schema with allOf
pass too.
Comments (2)
-
-
- changed status to closed
Closing due to inactivity. If this is still an issue in the current version of the validator, please feel free to re-open.
- Log in to comment
Thanks for raising this! I'll take a look at it in the next few days.