Skip to content

Commit 498da19

Browse files
committed
Document the 'arbitrary custom scalars' and 'operation selection' features
1 parent 372786e commit 498da19

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ A typed GraphQL client library for Rust.
1414
- Subscriptions support (serialization-deserialization only at the moment)
1515
- Copies documentation from the GraphQL schema to the generated Rust code
1616
- Arbitrary derives on the generated responses
17+
- Arbitrary custom scalars
18+
- Supports multiple operations per query document
1719

1820
## Getting started
1921

@@ -90,6 +92,16 @@ The generated response types always derive `serde::Deserialize` but you may want
9092
struct SearchQuery;
9193
```
9294

95+
## Custom scalars
96+
97+
The generated code will reference the scalar types as defined in the server schema. This means you have to provide matching rust types in the scope of the struct under derive. It can be as simple as declarations like `type Email = String;`. This gives you complete freedom on how to treat custom scalars, as long as they can be deserialized.
98+
99+
## Query documents with multiple operations
100+
101+
You can write multiple operations in one query document (one `.graphql` file). You can then select one by naming the struct you `#[derive(GraphQLQuery)]` on with the same name as one of the operations. This is neat, as it allows sharing fragments between operations.
102+
103+
There is an example [in the tests](./tests/operation_selection).
104+
93105
## Examples
94106

95107
See the examples directory in this repository.

0 commit comments

Comments
 (0)