Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Remove user JSON object wrapper from user/current PUT requests #6396

@tcfdev

Description

@tcfdev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Traffic Ops API NextImprovements to Traffic Ops API - particularly breaking changesimprovementThe functionality exists but it could be improved in some way.low impactaffects only a small portion of a CDN, and cannot itself break onetech debtrework due to choosing easy/limited solution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions