This Improvement request (usability, performance, tech debt, etc.) affects these Traffic Control components:
- Traffic Clients (go)
- Traffic Ops
- Documentation
Current behavior:
The currently logged in user has the ability to edit various fields via a PUT request to the user/current endpoint. However, that request MUST be wrapped in a user JSON object such that the body looks something like:
{
"user": {
/* ... */
}
}
This object appears to be unnecessary, but adds a "gotcha" of sorts to the PUT requests. Even resulting in bug submissions such as #6367
New behavior:
Removing this wrapper will help reduce unnecessary code, reduce and add clarity to documentation, and help with maintainability going forward.
// lib/go-tc/users.go
// CurrentUserUpdateRequest differs from a regular User/UserCurrent in that many of its fields are
// *parsed* but not *unmarshaled*. This allows a handler to distinguish between "null" and
// "undefined" values.
type CurrentUserUpdateRequest struct {
// User, for whatever reason, contains all of the actual data.
User CurrentUserUpdateRequestUser `json:"user"` // This is the wrapper
}
Additionally the documentation for the API endpoint will need to be updated to remove the reference to the user wrapper object. docs for user/current
This Improvement request (usability, performance, tech debt, etc.) affects these Traffic Control components:
Current behavior:
The currently logged in user has the ability to edit various fields via a PUT request to the
user/currentendpoint. However, that request MUST be wrapped in auserJSON object such that the body looks something like:{ "user": { /* ... */ } }This object appears to be unnecessary, but adds a "gotcha" of sorts to the
PUTrequests. Even resulting in bug submissions such as #6367New behavior:
Removing this wrapper will help reduce unnecessary code, reduce and add clarity to documentation, and help with maintainability going forward.
Additionally the documentation for the API endpoint will need to be updated to remove the reference to the
userwrapper object. docs foruser/current