Expose a list of all valid Emoji through GraphQL
Problem to solve
Expose list of emoji in GraphQL
We know the complete list of valid emoji available in GitLab through methods on Gitlab::Emoji
.
We should expose this list through GraphQL so clients (like our front end) can use this list when allowing the user to choose an emoji.
A new top-level GraphQL query :award_emoji
should return all Gitlab::Emoji.emoji_names
as Types::AwardEmojis::AwardEmojiType
s.
If the front-end needs to be initialized with this data, rather than wait for an AJAX request, then Rails could execute the :award_emoji
query against the schema in the page load request and make the data available to the front-end for its initialization.
Types::AwardEmojis::AwardEmojiNameEnum
Providing a new Currently the name
argument on Mutations::AwardEmojis::Base
accepts a String
. However, it would be great if this instead accepted an EnumType
generated from the list of valid emoji names.
This would mean the GraphQL AwardEmoji
mutations could never accept an invalid emoji name.
This idea was explored in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/29919#note_185382299 where the complexities were discussed and a possible solution around the complexities were suggested.
The name
value of each emoji name would need to be identical to the list we expose in the :award_emoji
query.