You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 20, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/types/objects/defining_objects.md
+21-2Lines changed: 21 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ struct Person {
50
50
```
51
51
52
52
Objects and fields without doc comments can instead set a `description`
53
-
in the `graphql` attribute. The following example is equivalent to the above:
53
+
via the `graphql` attribute. The following example is equivalent to the above:
54
54
55
55
!FILENAME GraphQL descriptions via attribute
56
56
@@ -186,5 +186,24 @@ struct Person {
186
186
```
187
187
188
188
The `name`, `description`, and `deprecation` arguments can of course be
189
-
combined. Some restrictions from the GraphQL spec stil applies though; you can
189
+
combined. Some restrictions from the GraphQL spec still applies though; you can
190
190
only deprecate object fields and enum values.
191
+
192
+
## Skipping fields
193
+
194
+
By default all fields in a `GraphQLObject` are included in the generated GraphQL type. To prevent including a specific field, annotate the field with `#[graphql(skip)]`:
195
+
196
+
```rust
197
+
# externcrate juniper;
198
+
# #[macro_use] externcrate juniper_codegen;
199
+
#
200
+
#[derive(GraphQLObject)]
201
+
structPerson {
202
+
name:String,
203
+
age:i32,
204
+
#[graphql(skip)]
205
+
password_hash:String, // This cannot be queried or modified from GraphQL
0 commit comments