Closed anth0d closed 7 years ago
This is a behavior of the Swagger Fury adapter. I personally do not like the behavior exactly for the reasons you wrote - in the context of Dredd, randomly generating or not generating optional properties makes the tests random as well.
Under the hood, the adapter uses json-schema-faker and IIRC previously I had some discussions on this topic with the @apiaryio/adt, but it always ended with "this is how the faker does the generating".
At the same time, it is strange to me Gavel gives you different results according to what's generated, because it should still validate according to the same schema from which the faked body comes from 🤔 So with or without optional properties, the bodies should pass the schema.
@antkazam Could you share the whole API description? Or a minimal anonymized version of it, which still reproduces the behavior?
@antkazam Any updates on this?
Sorry about the delay, I was offline for a couple weeks there.
I have been trying to reproduce this issue but I'm not able to with the latest versions. I think we can close this for now.
Describe your problem
API specification in Swagger format - response body contains two properties, one is required, one is optional.
Actual response body contains only the required property, but intermittently Gavel.js validates against a fake response containing both properties, which fails the test intermittently. Gavel should not be including the optional property in the expected result.
The "lorem ipsum" expected response body should not be generated with optional parameters since that is causing unexpected/invalid test failures.
If you can point me to wherever the expected response body is being generated I would be happy to submit a PR to address this issue.
What command line options do you use?
What is in your
dredd.yml
?What's your
dredd --version
output?Does
dredd --level=debug
uncover something?Only that the validator is Gavel.js
Can you send us failing test in a Pull Request?
Perhaps, if my initial description doesn't convince you there is an issue.