Skip to content

feat: add endpoint to fetch singular org member#21732

Merged
Emyrk merged 1 commit intomainfrom
org_member_fetch
Feb 3, 2026
Merged

feat: add endpoint to fetch singular org member#21732
Emyrk merged 1 commit intomainfrom
org_member_fetch

Conversation

@Emyrk
Copy link
Member

@Emyrk Emyrk commented Jan 28, 2026

No description provided.

@Emyrk Emyrk marked this pull request as ready for review January 28, 2026 17:34
Copy link
Member Author

Emyrk commented Jan 28, 2026

@coder-tasks
Copy link
Contributor

coder-tasks bot commented Jan 28, 2026

Documentation Check

No Changes Needed

This PR adds a new API endpoint GET /organizations/{organization}/members/{user} to fetch a single organization member. The API documentation in docs/reference/api/members.md appears to be auto-generated from OpenAPI annotations in the Go code (as evidenced by the @Summary, @ID, @Tags, and @Router annotations in the handler).

The PR includes proper OpenAPI annotations for the new getOrganizationMember handler, which means the API documentation will be automatically updated when the docs are regenerated (likely via make gen or similar command).

No manual documentation changes are needed for this change.


Automated review via Coder Tasks

@Emyrk Emyrk changed the base branch from main to graphite-base/21732 January 28, 2026 17:49
@Emyrk Emyrk force-pushed the graphite-base/21732 branch from 264ae77 to d4b48a4 Compare January 28, 2026 17:49
@Emyrk Emyrk changed the base branch from graphite-base/21732 to list_convert January 28, 2026 17:49
@Emyrk Emyrk changed the base branch from list_convert to graphite-base/21732 January 28, 2026 19:07
@Emyrk Emyrk force-pushed the graphite-base/21732 branch from d4b48a4 to dfbd541 Compare January 28, 2026 19:08
@graphite-app graphite-app bot changed the base branch from graphite-base/21732 to main January 28, 2026 19:08
@coder-tasks
Copy link
Contributor

coder-tasks bot commented Jan 28, 2026

Documentation Check

Previous Feedback

The previous review correctly noted that API documentation is auto-generated from OpenAPI annotations.

Updates Needed

  • coderd/members.go line 150 - Fix OpenAPI annotation for getOrganizationMember handler

The @Success annotation currently shows 204 but the handler actually returns http.StatusOK (200) with JSON data. It should be:

// @Success 200 {object} codersdk.OrganizationMemberWithUserData

This will ensure the auto-generated API documentation correctly shows the response format for the new GET /organizations/{organization}/members/{user} endpoint.


Automated review via Coder Tasks

@coder-tasks
Copy link
Contributor

coder-tasks bot commented Jan 28, 2026

Documentation Check

Previous Feedback

Not yet addressed - the OpenAPI annotation issue identified in the previous review remains unfixed.

Updates Needed

  • coderd/members.go line 153 - Fix OpenAPI annotation for getOrganizationMember handler

The @Success annotation still shows 204 but the handler returns http.StatusOK (200) with JSON data on line 189. It should be:

// @Success 200 {object} codersdk.OrganizationMemberWithUserData

This will ensure the auto-generated API documentation correctly shows the response format for the new GET /organizations/{organization}/members/{user} endpoint.


Automated review via Coder Tasks

@coder-tasks
Copy link
Contributor

coder-tasks bot commented Jan 28, 2026

Documentation Check

Previous Feedback

Not yet addressed - the OpenAPI annotation issue identified in previous reviews remains unfixed.

Updates Needed

  • coderd/members.go line 153 - Fix OpenAPI annotation for organizationMember handler

The @Success annotation currently shows 204 but the handler returns http.StatusOK (200) with JSON data on line 191. It should be:

// @Success 200 {object} codersdk.OrganizationMemberWithUserData

This will ensure the auto-generated API documentation correctly shows the response format for the new GET /organizations/{organization}/members/{user} endpoint.


Automated review via Coder Tasks

@coder-tasks
Copy link
Contributor

coder-tasks bot commented Jan 28, 2026

Documentation Check

Previous Feedback

Not yet addressed - the OpenAPI annotation issue identified in previous reviews remains unfixed in the latest commits.

Updates Needed

  • coderd/members.go line 150 - Fix OpenAPI annotation for organizationMember handler

The @Success annotation currently shows 204 but the handler returns http.StatusOK (200) with JSON data (line 191 in the implementation: httpapi.Write(ctx, rw, http.StatusOK, resp[0])).

It should be:

// @Success 200 {object} codersdk.OrganizationMemberWithUserData

This will ensure the auto-generated API documentation in docs/reference/api/members.md correctly shows:

  • Status 200 instead of 204
  • The response schema for OrganizationMemberWithUserData
  • Example response body showing the member object structure

After fixing the annotation, run make gen to regenerate the Swagger docs and API reference documentation.


Automated review via Coder Tasks

@coder-tasks
Copy link
Contributor

coder-tasks bot commented Jan 30, 2026

Documentation Check

Previous Feedback

Not yet addressed - the OpenAPI annotation issue identified in previous reviews remains unfixed.

Updates Needed

  • coderd/members.go line 153 - Fix OpenAPI annotation for organizationMember handler

The @Success annotation currently shows 204 but the handler returns http.StatusOK (200) with JSON data (see line 191: httpapi.Write(ctx, rw, http.StatusOK, resp[0])).

It should be:

// @Success 200 {object} codersdk.OrganizationMemberWithUserData

This will ensure the auto-generated API documentation correctly shows:

  • Status code 200 instead of 204
  • The response schema for the returned member object
  • Example response body structure

After fixing the annotation, run make gen to regenerate the API documentation.


Automated review via Coder Tasks

@Emyrk Emyrk force-pushed the org_member_fetch branch 2 times, most recently from 36f1eb9 to ab7a276 Compare February 3, 2026 15:43
@Emyrk Emyrk requested a review from johnstcn February 3, 2026 15:47
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once linter errors are fixed.

Comment on lines +42 to +53
func TestGetMember(t *testing.T) {
t.Parallel()

t.Run("Me", func(t *testing.T) {
t.Parallel()
owner := coderdtest.New(t, nil)
first := coderdtest.CreateFirstUser(t, owner)
ctx := testutil.Context(t, testutil.WaitMedium)

member, err := owner.OrganizationMember(ctx, first.OrganizationID.String(), codersdk.Me)
require.NoError(t, err)
require.Equal(t, member.UserID, first.UserID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could move this to TestAddMember or similar; a while coderdtest.New just for this seems a bit much.

@Emyrk Emyrk force-pushed the org_member_fetch branch 2 times, most recently from 38ce00f to 6021e9b Compare February 3, 2026 17:46
Able to use idents like username, codersdk.Me, etc
@Emyrk Emyrk merged commit 6759b51 into main Feb 3, 2026
28 checks passed
@Emyrk Emyrk deleted the org_member_fetch branch February 3, 2026 18:48
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants