Clever / wag

sWAGger - Web API Generator
Apache License 2.0
77 stars 6 forks source link

When client encounters an unknown status code, response body is lost #426

Open taylor-sutton opened 2 years ago

taylor-sutton commented 2 years ago

For example: https://github.com/Clever/wag/blob/e1e9b5bbdd8c9b945e00c2be9d4fe5d19ebda906/samples/gen-go/client/client.go#L552

This makes adding a new response status code to an existing endpoint on the server side particularly painful. If using an old client on a new server, it's reasonable to have some incompatibilities, as adding a new response code is, in some ways, a breaking change, but in practice we at Clever sometimes convert classes of 5xx into 4xx and would like to make this a bit smoother. Today, converting a 5xx into a 4xx in our API on the server-side and using an old client means the client doesn't understand the new status code, so it spits out an Internal Error (that's reasonable) BUT if the client is going to do so, it at least should not lose the response body.