You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The swagger json from this particular API declares return codes, but does not fully define the response spec:
"responses": {
"200": {
"description": ""
}
}
The response definition without defining content is not technically invalid - the swagger spec validates at swagger.io and w/ 3rd party tools. (that being said, I understand that an empty response schema basically says it response should be empty, but that leads to the next point)
As a user of 3rd party APIs over which I have no control, it would be really great to have more control over how my client lib handles responses, so as to work around situations like these, which are painfully common.
If combined with validate_reponses: False, enforcing a schema for the response serves no purpose since we don't need a schema if we're not validating the response content, ergo why would a defined schema be required?
My suggested change would be simple - if validate_responses is False, simply ignore the response schema, whether it's there or not, and return the response as is currently done for non-JSON replies.
Thoughts?
The text was updated successfully, but these errors were encountered:
unmarshal_response takes care of converting the received response into a python object.
The method returns None because the specs does not specify any content of the response, so from a spec prospective the response body "does not exists".
So a possible workaroud could be to manually extract the response body in case unmarshal_response is None.
I immagine that you're ending up in that call due to bravado, if so bravado has a request option that allows you to receive the marshaled response and the raw response, here is the doc.
After a bit of digging, I found that a "None" response I was getting from an API was a result of this snippet in bravado_core/response.py:
The swagger json from this particular API declares return codes, but does not fully define the response spec:
Perhaps most importantly, IMHO:
validate_reponses: False
, enforcing a schema for the response serves no purpose since we don't need a schema if we're not validating the response content, ergo why would a defined schema be required?My suggested change would be simple - if validate_responses is False, simply ignore the response schema, whether it's there or not, and return the response as is currently done for non-JSON replies.
Thoughts?
The text was updated successfully, but these errors were encountered: