Introduce enums into Workspace graphql type
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
MR: Pending
Description
As a GraphQL API user, I want to use enums where possible so that there is better type support, safety, autocompletion, etc. in GraphQL queries.
The following discussion from !105783 (merged) should be addressed:
-
@kassio started a discussion: (+1 comment) suggestion What do you think to use a type::enum here, based on
::RemoteDevelopment::States::VALID_DESIRED_STATES
(https://gitlab.com/gitlab-org/gitlab/blob/remote_dev/ee/lib/remote_development/states.rb#L16)?
Acceptance Criteria
Fix all related TODO for this issue for all enum types:
-
ee/app/graphql/mutations/remote_development/workspaces/create.rb
-
ee/app/graphql/mutations/remote_development/workspaces/update.rb
-
ee/app/graphql/types/remote_development/workspace_type.rb
-
Any other new mutations/types that have been added to the remote development domain. -
Note that we do NOT want to useenums
in the ActiveRecord models, because they break theActiveRecord#save
contract by throwing anArgumentError
on#save
, instead of#save!
. See !129708 (comment 1538946504) for more context.- UPDATE: This has been fixed in Rails as of https://github.com/rails/rails/pull/49100. If we are on a version of Rails which includes that, then we can use enums in the ActiveRecord models
Technical Requirements
Use enums where possible, and update relevant specs, docs, and queries.
Design Requirements
N/A
Impact Assessment
More efficient, user friendly, and safe usage of the GraphQL API for the remote development feature.