kvin API: add explicit success/error envelopes#49
Conversation
…arency, and expand contract tests
|
Thank you for the PR. It is good to have structured JSON responses for errors :-) I would argue that always returning an envelope is unnecessary as HTTP already has return codes. Furthermore, I would propose to use plain JSON objects for error responses instead of wrapping them within an envelope: I understand that it is maybe easier to extract response codes from the JSON data but nonetheless the HTTP code needs to be checked first to decide if an error has been occurred or not. |
kenwenzel
left a comment
There was a problem hiding this comment.
Thank you for proposing the changes. I have some minor remarks.
…ation, plain errors, UncheckedIOException)
|
Thanks for the review @kenwenzel ! I added the changes requested and also removed the additional JSON fields from the DELETE response (so now it matches the old behavior and the requested adaptations for the POST). Updates after Review:
|
|
@wmehling Thank you for the update. Maybe we should communicating the deletion count completely?! |
Summary
This PR improves KVIN API explicitness for clients by returning structured success/error envelopes and by making non-404 HTTP failures in KvinHttp explicit instead of silently empty.
Why
What Changed
Old vs New Behavior (with Test Evidence)
1) POST /linkedfactory/values
2) DELETE /linkedfactory/values
3) Invalid POST payload
4) Limit overflow on GET values
5) Unsupported response type
6) KvinHttp non-200 behavior
7) Envelope content type stability
Backward compatibility
This behavior is now different in client-visible ways (POST body no longer empty, structured JSON errors, and non-404 in KvinHttp now throws instead of silently empty).
@kenwenzel Is that a change that would break code that uses lf-pod or is this explicit behavior acceptable as the new default?