Inconsistent API schema of user info
The endpoints of users/me
and users/{user_id}
uses the same User
model. See below.
But data is acquired from different sources.
users/me
uses token to retrieve payload, and creates a corresponding User
. https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR/-/blob/develop/nomad/infrastructure.py#L203
return datamodel.User(
user_id=user_id,
username=payload.get('preferred_username', None),
email=payload.get('email', None),
first_name=payload.get('given_name', None),
last_name=payload.get('family_name', None))
users/{user_id}
omits email. https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR/-/blob/develop/nomad/app/v1/routers/users.py#L116
async def get_user(user_id: str):
user = datamodel.User.get(user_id=str(user_id)).m_copy()
user.email = None
return user
Users do not get affiliation
, email
, or other fields as shown in schema, which causes confusion.
{
"name": "string",
"first_name": "string",
"last_name": "string",
"email": "string",
"affiliation": "string",
"affiliation_address": "string",
"user_id": "string",
"username": "string",
"created": "2022-11-07T13:02:03.036Z",
"repo_user_id": "string",
"is_admin": true,
"is_oasis_admin": false
}