Open RangelReale opened 1 month ago
If we register an operation where the output struct don't have a "Body" field, the output is completely ignored and nothing is written to the http connection.
This is a surprising behavior, maybe Register should panic if the output structure don't have this field? This will for sure generate nasty bugs in big codebases.
Also just to add to this, all of the fields in the struct will automatically become 'headers'. Which you can see in the docs
In addition, returning nil
as a response body causes the package to error due to some Serialization issue. Now you could argue you should be instead returning No Content
, however I don't necessarily agree because you could be expecting a pointer to something, return it, oops accidently nil and then get a 500.
If we register an operation where the output struct don't have a "Body" field, the output is completely ignored and nothing is written to the http connection.
This is a surprising behavior, maybe Register should panic if the output structure don't have this field? This will for sure generate nasty bugs in big codebases.