-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResponseValidator: No failure in case of not specified reponse body #17
Comments
Please have a look into the outcome of the validate step. Your |
OK, thanks for this "workaround". But I would prefer that the validation failed directly. |
In my opinion this is not a workaround this is the expected behavior. Because it is possible to create a valid response ( At least this is my understanding of the OpenAPI spec. Maybe I'm wrong, so if you can give me a link which describes your desired behavior, we can fix it. If you want to enforce an empty body, please have a look here https://community.smartbear.com/t5/Swagger-Open-Source-Tools/OAS-3-0-3-request-schema-for-an-empty-JSON-body/td-p/212245 |
I understand your point: the response content cannot be validated against a schema that does not exist. However, If the schema is not provided (no content in Response Object, I think it means that there shall have no content.
The "nullable" solution you propose is an optional behavior, but it is not mandating never content. (like for http status code: 204 case). This Swagger page explains:
|
Thanks for your link, this is very interesting. But it is from Swagger 2.0 so I don't know if this is also valid for OpenAPI 3.x. I will ask some colleagues who are working on the OpenAPI Specification, whats the intended behavior and then come back. |
When the openAPI contract does not define a Operation Reponse body:
"responses": { "200": { "description": "Successful hello message" },
But the ValidatableResponse contains a response body,
the validation passes successfully instead of Failing.
A Test Sample:
`
`
Output: "Validation Success"
The text was updated successfully, but these errors were encountered: