Skip to content

Fix UserSearchSort JSON tags casing#633

Merged
aviadl merged 3 commits intodescope:mainfrom
Orbsynated:fix-search-sort-casing
Dec 17, 2025
Merged

Fix UserSearchSort JSON tags casing#633
aviadl merged 3 commits intodescope:mainfrom
Orbsynated:fix-search-sort-casing

Conversation

@Orbsynated
Copy link
Contributor

Description

This PR adds missing JSON tags to the UserSearchSort struct fields in descope/types.go.

Previously, the Field and Desc fields were missing JSON tags, which caused them to be marshaled with default Go casing (capitalized).
This caused errors when using the API({"errorCode":"E011003","errorDescription":"Request is invalid","errorMessage":"The sort[0].field field is required","message":"The sort[0].field field is required"}

Must

  • Tests
  • Documentation (if applicable)

Copilot AI review requested due to automatic review settings December 1, 2025 12:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug in the UserSearchSort struct by adding missing JSON tags to the Field and Desc fields. Previously, these fields were marshaled with Go's default casing (capitalized), causing API requests to fail with error E011003 indicating that the sort[0].field field is required. The fix ensures proper JSON serialization with lowercase field names, aligning with the API's expectations and the codebase's existing JSON tagging conventions.

Key Changes

  • Added json:"field" tag to the Field string field in UserSearchSort struct
  • Added json:"desc" tag to the Desc bool field in UserSearchSort struct

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@Orbsynated Orbsynated requested a review from Copilot December 1, 2025 13:04
Copy link
Member

@aviadl aviadl left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

descope/types.go:915

  • The UserSearchOptions struct is missing JSON tags for all fields. Since this struct is serialized in API requests (as seen in makeSearchAllRequest), fields should have JSON tags to ensure proper marshaling. For example, Page should be Page int32 \json:"page"`andTenantIDsshould beTenantIDs []string `json:"tenantIds"``.
type UserSearchOptions struct {
	Page              int32
	Limit             int32
	Sort              []UserSearchSort
	Text              string
	Emails            []string
	Phones            []string
	Statuses          []UserStatus
	Roles             []string
	TenantIDs         []string
	SSOAppIDs         []string
	CustomAttributes  map[string]any
	WithTestUsers     bool
	TestUsersOnly     bool
	LoginIDs          []string
	UserIDs           []string
	FromCreatedTime   int64
	ToCreatedTime     int64
	FromModifiedTime  int64
	ToModifiedTime    int64
	TenantRoleIDs     map[string]*RoleList
	TenantRoleNames   map[string]*RoleList
	IncludeSubTenants bool

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@Orbsynated
Copy link
Contributor Author

Can this be merged? @aviadl

@aviadl aviadl disabled auto-merge December 17, 2025 19:19
@aviadl aviadl merged commit e8014c2 into descope:main Dec 17, 2025
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants