fix: mark Role's colors property as nullable#8199
Conversation
almostSouji
left a comment
There was a problem hiding this comment.
In its current state this PR does not address the linked issue.
| | 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 | |
There was a problem hiding this comment.
Already documented in
discord-api-docs/developers/resources/guild.mdx
Lines 1277 to 1279 in f04ece8
| | 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 | |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
c13212c to
4a3fc26
Compare
|
Consolidating all fixes into a single comprehensive PR. Sorry for the noise. |
Summary
Fixes #8132
The
colorsproperty on the Role object can benullin 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 —colorstype changed to?[role colors](nullable)guild.mdx: Create Guild Role params —colorstype changed to?[role colors](nullable)guild.mdx: Modify Guild Role params —colorstype changed to?[role colors](nullable)Context
As reported in #8132, the API returns
nullfor thecolorsfield on certain roles, but the docs describe it as non-nullable. This PR aligns the documentation with the actual API behavior.