Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
677bbf63
Commit
677bbf63
authored
Nov 13, 2019
by
Luke Duncalfe
Committed by
Luke Duncalfe
Nov 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Times::Type to our GraphQL docs
parent
9faa870e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
doc/development/api_graphql_styleguide.md
doc/development/api_graphql_styleguide.md
+26
-0
No files found.
doc/development/api_graphql_styleguide.md
View file @
677bbf63
...
...
@@ -507,6 +507,32 @@ found, we should raise a
`Gitlab::Graphql::Errors::ResourceNotAvailable`
error. Which will be
correctly rendered to the clients.
## Gitlab's custom scalars
### `Types::TimeType`
[
`Types::TimeType`
](
https://gitlab.com/gitlab-org/gitlab/blob/master/app%2Fgraphql%2Ftypes%2Ftime_type.rb
)
must be used as the type for all fields and arguments that deal with Ruby
`Time`
and
`DateTime`
objects.
The type is
[
a custom scalar
](
https://github.com/rmosolgo/graphql-ruby/blob/master/guides/type_definitions/scalars.md#custom-scalars
)
that:
-
Converts Ruby's
`Time`
and
`DateTime`
objects into standardized
ISO-8601 formatted strings, when used as the type for our GraphQL fields.
-
Converts ISO-8601 formatted time strings into Ruby
`Time`
objects,
when used as the type for our GraphQL arguments.
This allows our GraphQL API to have a standardized way that it presents time
and handles time inputs.
Example:
```
ruby
field
:created_at
,
Types
::
TimeType
,
null:
false
,
description:
'Timestamp of when the issue was created'
```
## Testing
_full stack_
tests for a graphql query or mutation live in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment