tamasfe/aide

Inconsistent response inference for operation functions `get` vs `get_with`, `post` vs `post_with`, etc.

dnut opened this issue · 1 comments

dnut commented

This issue tracks the tangential problem that was described in #81 (comment) after it was closed.

Using get (and analogous operation functions), response types are inferred, but using get_with does not infer the response types unless you globally enable them with infer_responses(true). Ideally, these operation functions would have the same inference behavior, or this could be better documented.

Would it be better if both used the global configuration (like get_with), or if both would automatically infer response types (like get)? Consolidating to either approach would be a breaking change.

On the one hand, I believe that the preferable default for both functions is to infer response types by default. Having the library infer the response type is the "I don't want to worry about it" approach that is consistent with not needing to explicitly configure anything. If you want manual control over the response types, that should be the explicit case.

On the other hand, if you have a global configuration that is supposed to decide whether responses should be inferred, then these functions should probably respect that, unless it is explicitly overridden in a narrower scope. Currently, the global default is false which means inference would be disabled for both of these, unless explicitly enabled.

One way to reconcile these conflicting priorities would be by changing the default global configuration to true.

Wicpar commented

It makes no sense to me to disable response inferrence by default. If infer response global option has no use we should remove it.

get_with should definitely infer responses by default.