Skip to content

Simplify return type of /user/get-session-user #50484

Open

Description

@ojeytonwilliams

Right now it returns an object like this:

{ 
  user: {
     [user.username]: { // stuff including username },
     result: user.username,
     ...
   }
}

Since user.username is dynamic, it's not possible to write a serialization schema for this, which 1) reduces confidence in the data 2) likely reduces performance. Fortunately, this is not necessary. It's possible to reconstruct the above type from

{
  user: { // stuff including username }
}

if needed. But we should be able to simplify the client, too, if we use this type.

Gotchas

The api currently overwrites username with usernameDisplay if it exists. I think the simplest solution is to provide both and leave it to the client to decide which to use.

Activity

  1. moved this to Discussing in Backend APIon Aug 17, 2023
  2. 7twik commented on Sep 30, 2023

    @7twik

    I will love to solve this issue, please assign me this issue

  3. HimanshuMahto commented on Oct 29, 2023

    @HimanshuMahto

    hey can you tell me at what location do I need to make changes for this issue.

  4. ShaunSHamilton commented on Nov 3, 2023

    @ShaunSHamilton
    Member

    An issue with the help wanted Open for all. You do not need permission to work on these. or first timers only Open for anyone doing contributions for first time. You do not need permission to work on these. label is open for contribution.

    If you would like to contribute, and have not read the contributors docs, please do so here: https://contribute.freecodecamp.org/#/

    If you have any issues with contributing, be sure to join us on the contributors channel, or on the contributors sub-forum

  5. locked and limited conversation to collaborators on Nov 3, 2023
  6. added
    platform: api
    on Mar 19, 2024
  7. added
    status: on the roadmap
    on Sep 12, 2024
  8. moT01 commented on Sep 12, 2024

    @moT01
    Member

    Saving for post new API release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: apistatus: on the roadmap

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions