Over 10% of GraphQL descriptions are missing
We have a lot of GraphQL descriptions missing from the documentation.
$ without=$(grep '"description": null' doc/api/graphql/reference/gitlab_schema.json | wc -l); echo $without
596
$ with=$(grep '"description": ' doc/api/graphql/reference/gitlab_schema.json | grep -v null | wc -l); echo $with
5563
$ echo -e "scale=3\n$without / $with" | bc
.107
Ideally, we want descriptions for everything and to avoid introduction of more empty descriptions without having to rely on reviewers noticing it.
Proposal
-
Add missing descriptions (see below if you want to contribute an MR). -
Prioritise GraphQL description cop misses missing description from declaration methods. -
Prioritise Cop to enforce GraphQL type description presence. -
While the above isn't in place, request that reviewers flag missing GraphQL documentation as a blocking MR issue. -
Recommend SSOT for documentation of GraphQL Enum
types used in multiple places. This can be made easier by usingDeclarativeEnum
. Example: GraphQL Type, Active Record model. -
Refactor existing GraphQL Enum
types (see below if you want to contribute).
Help wanted
Everyone can contribute! If you can afford to spend some time helping, please place your name next to one of the items so others know you're working on it.
If you're an engineer and believe one of the suggested refactors is worth doing, please link your WIP MR so no one else picks it up.
Missing descriptions
This list might not be complete. Once the cop is working, we could find others.
Review generated descriptions
These have been generated using values from other fields. Some of them could do with a better explanation of what the choice means/does.
Suggested refactoring
DRY-up app/graphql/types/todo_action_enum.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/3a671200233b6d7b83ef247884e70bc7f905c47f/app/models/todo.rb#L19-20
- https://gitlab.com/gitlab-org/gitlab/-/blob/3a671200233b6d7b83ef247884e70bc7f905c47f/app/graphql/types/todo_action_enum.rb
Maybe move to ee/app/enums/
?
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/graphql/ee/types/todo_target_enum.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/todo_target_enum.rb
Maybe DRY-up?
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/snippets/visibility_scopes_enum.rb#L5
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/snippet.rb#L78-79
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/visibility_level.rb#L22-24
Maybe DRY-UP?
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/snippet_input_action.rb#L6
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/commit_action_mode_enum.rb
Maybe use DeclarativeEnum
?
Maybe use DeclarativeEnum
?
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/container_expiration_policy.rb#L41
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/container_expiration_policy_cadence_enum.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/container_expiration_policy_keep_enum.rb
Maybe use DeclarativeEnum
?
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/issue.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/issue_type_enum.rb
Maybe use DeclarativeEnum
?
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/concerns/enums/data_visualization_palette.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/data_visualization_palette/color_enum.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/types/data_visualization_palette/weight_enum.rb
Maybe use DeclarativeEnum
?