User representations don't match #6299
Labels
authentication
Relating to login, registration, passwords, tokens, etc.
improvement
The functionality exists but it could be improved in some way.
medium difficulty
the estimated level of effort to resolve this issue is medium
medium impact
impacts a significant portion of a CDN, or has the potential to do so
Traffic Ops
related to Traffic Ops
This Improvement request (usability, performance, tech debt, etc.) affects these Traffic Control components:
Current behavior:
The representations of Users are different depending on the API endpoint used to view them, e.g.
/user/current
uses the fieldroleName
to hold the name of the User's Role, while/users
shows the same information in therolename
property.The current model for users (API v3.0, 4.0 makes some structural changes in some contexts) is such that requests and responses have different "shapes" depending on the request method - and some fields are even renamed between requests and responses.
A TypeScript model of Users in APIv3
tenantID
, responses havetenantId
confirmLocalPasswd
but GET representations never doregistrationSent
but GET requests always dolocalUser
, but /user/current always doesnewUser
to benull
, but that's actually not allowed in the database, and GET requests will always show an actual boolean value. Plus, ifnewUser
wasnull
in a POST or PUT to /users, it will benull
in the response, but if it wasnull
in a PUT to /user/current the response will properly show false like a subsequent GETand then of course we have the pervasive issue where things are allowed to be missing from the request as a synonym for "null", but that's more an issue just because in TS/JS
undefined
andnull
are different, but Go makes no such distinction without jumping through someencoding/json.RawMessage
hoops.New behavior:
Users should be represented consistently in a single way throughout the API.
The text was updated successfully, but these errors were encountered: