Commit 4b0a8765 authored by Evan Read's avatar Evan Read

Merge branch 'ld-graphql-document-copy_field_description' into 'master'

Add documentation of GraphQL API copy_field_description helper

See merge request gitlab-org/gitlab!32611
parents 179ef1f8 1ebbcfa9
...@@ -470,6 +470,23 @@ field :confidential, GraphQL::BOOLEAN_TYPE, description: 'Indicates the issue is ...@@ -470,6 +470,23 @@ field :confidential, GraphQL::BOOLEAN_TYPE, description: 'Indicates the issue is
field :closed_at, Types::TimeType, description: 'Timestamp of when the issue was closed' field :closed_at, Types::TimeType, description: 'Timestamp of when the issue was closed'
``` ```
### `copy_field_description` helper
Sometimes we want to ensure that two descriptions will always be identical.
For example, to keep a type field description the same as a mutation argument
when they both represent the same property.
Instead of supplying a description, we can use the `copy_field_description` helper,
passing it the type, and field name to copy the description of.
Example:
```ruby
argument :title, GraphQL::STRING_TYPE,
required: false,
description: copy_field_description(Types::MergeRequestType, :title)
```
## Authorization ## Authorization
Authorizations can be applied to both types and fields using the same Authorizations can be applied to both types and fields using the same
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment