Skip to content

fix: mark Role's colors property as nullable#8199

Closed
Akenove wants to merge 2 commits into
discord:mainfrom
Akenove:fix/role-colors-nullable
Closed

fix: mark Role's colors property as nullable#8199
Akenove wants to merge 2 commits into
discord:mainfrom
Akenove:fix/role-colors-nullable

Conversation

@Akenove

@Akenove Akenove commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #8132

The colors property on the Role object can be null in practice, but the documentation currently marks it as non-nullable. This causes deserialization failures in typed API clients (e.g. Swift, Rust, Go) that rely on the documented types.

Changes

  • permissions.mdx: Role Object table — colors type changed to ?[role colors] (nullable)
  • guild.mdx: Create Guild Role params — colors type changed to ?[role colors] (nullable)
  • guild.mdx: Modify Guild Role params — colors type changed to ?[role colors] (nullable)

Context

As reported in #8132, the API returns null for the colors field on certain roles, but the docs describe it as non-nullable. This PR aligns the documentation with the actual API behavior.

@Akenove Akenove requested a review from a team as a code owner March 9, 2026 05:46
@Akenove Akenove requested review from markmandel and removed request for a team March 9, 2026 05:46

@almostSouji almostSouji left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In its current state this PR does not address the linked issue.

Comment thread developers/resources/guild.mdx Outdated
| permissions | string | bitwise value of the enabled/disabled permissions |
| color* | integer | **Deprecated** RGB color value |
| colors | [role colors](/developers/topics/permissions#role-object-role-colors-object) object | the role's colors |
| colors | ?[role colors](/developers/topics/permissions#role-object-role-colors-object) object | the role's colors |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Already documented in

<Info>
All parameters to this endpoint are optional and nullable.
</Info>

| name | string | role name |
| color* | integer | **Deprecated** integer representation of hexadecimal color code |
| colors | [role colors](/developers/topics/permissions#role-object-role-colors-object) object | the role's colors |
| colors | ?[role colors](/developers/topics/permissions#role-object-role-colors-object) object | the role's colors |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As the linked issue mentions, this is only the case in the inner role payloads of template guilds in the GET /guilds/:id/templates response.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch on the Modify Guild Role endpoint reverted that change since the Info block already covers it. kept the fix on the Role Object definition (permissions.mdx) and Create Guild Role params since that's where typed clients pick up the type for deserialization. the template guild roles from GET /guilds/:id/templates is where this surfaces as mentioned in #8132

The `colors` property on the Role object can be `null` in practice,
but the documentation currently marks it as non-nullable. This causes
deserialization failures in typed API clients.

Fixes discord#8132
The Modify Guild Role endpoint already documents all parameters as
optional and nullable via the Info block. Kept the fix scoped to
the Role Object definition and Create Guild Role params.
@Akenove

Akenove commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

Consolidating all fixes into a single comprehensive PR. Sorry for the noise.

@Akenove Akenove closed this Mar 9, 2026
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.

Role's colors property is nullable

3 participants