Add GraphQL Scalars to new GraphQL docs

What does this MR do and why?

This MR adds GraphQL Scalars to the new GraphQL docs.

It is part of a series of MRs to move across the work in !130378 (closed) in smaller pieces.

Previous MRs:

MR Description
!243355 (merged) Enums

References

Split GraphQL API reference documentation into ... (#593121)

How to set up and validate locally

Try changing a GraphQL scalar locally, for example:

diff --git a/app/graphql/types/time_type.rb b/app/graphql/types/time_type.rb
index 20f36bf5ad45..34048b068bbe 100644
--- a/app/graphql/types/time_type.rb
+++ b/app/graphql/types/time_type.rb
@@ -2,9 +2,9 @@

 module Types
   class TimeType < BaseScalar
-    graphql_name 'Time'
+    graphql_name 'TimeTest'
     description <<~DESC
-      Time represented in ISO 8601.
+      Time represented in ISO 8601. Test.

       For example: `2021-03-09T14:58:50+00:00`.

Then run the check docs rake task:

bundle exec rake gitlab:graphql:docs:check

It should detect that there are changes that haven't been committed to the compiled docs:

##########
#
# Experimental GraphQL documentation is outdated!
# Please update the documentation by running `bundle exec rake gitlab:graphql:docs:compile`.
#
##########

Now compile the docs:

bundle exec rake gitlab:graphql:docs:compile

It should compile successfully:

Experimental documentation compiled.

And run :check again, it should pass this time:

Experimental GraphQL documentation is up to date.

Check that the change to doc/api/graphql/reference/experimental/scalars.md looks correct:

(Note you'll see changes to enums.md - that's fine - ignore those here, just look at scalars.md)

git diff doc/api/graphql/reference/experimental/scalars.md

The diff should be:

diff --git a/doc/api/graphql/reference/experimental/scalars.md b/doc/api/graphql/reference/experimental/scalars.md
index 1af705c7d08b..f47c794d9514 100644
--- a/doc/api/graphql/reference/experimental/scalars.md
+++ b/doc/api/graphql/reference/experimental/scalars.md
@@ -1605,9 +1605,9 @@ A `TerraformStateProtectionRuleID` is a global ID. It is encoded as a string.

 An example `TerraformStateProtectionRuleID` is: `"gid://gitlab/Terraform::StateProtectionRule/1"`.

-## `Time`
+## `TimeTest`

-Time represented in ISO 8601.
+Time represented in ISO 8601. Test.

 For example: `2021-03-09T14:58:50+00:00`.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #593121

Edited by Luke Duncalfe

Merge request reports

Loading
Loading