Skip to content

Commit ba8472d

Browse files
committed
Update CHANGELOG and README for v1.6.0
1 parent 5a1876c commit ba8472d

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

22
# json-to-graphql-query Changelog
33

4+
## 1.6.0
5+
6+
* Added support for `@client` directives (and other directives that don't need arguments). Thanks @joeflack4!
7+
* Added nicer JSON.stringify support for VariableType. Thanks @terion-name
8+
49
## 1.5.0
510

611
* Added `ignoreFields` option. Thanks @plmercereau

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Supported Options:
3030
* Support for query aliases via [`__alias`](#using-aliases)
3131
* Support for Enum values via [`EnumType`](#query-with-enum-values)
3232
* Support for variables via [`__variables`](#query-with-variables)
33+
* Support for simple directives (such as `@client`) via [`__directives`](#query-with-directives)
3334

3435
## Recent Changes
3536

@@ -270,6 +271,38 @@ query ($variable1: String!, $variableWithDefault: String = "default_value") {
270271
}
271272
```
272273

274+
### Query with Directives
275+
276+
```typescript
277+
import { jsonToGraphQLQuery } from 'json-to-graphql-query';
278+
279+
const query = {
280+
query: {
281+
__directives: {
282+
client: true
283+
}
284+
Posts: {
285+
id: true,
286+
title: true,
287+
post_date: true
288+
}
289+
}
290+
};
291+
const graphql_query = jsonToGraphQLQuery(query, { pretty: true });
292+
```
293+
294+
Resulting `graphql_query`
295+
296+
```graphql
297+
query {
298+
Posts @client {
299+
id
300+
title
301+
post_date
302+
}
303+
}
304+
```
305+
273306
### Ignoring fields in the query object
274307

275308
We sometimes want to ignore specific fields in the initial object, for instance __typename in Apollo queries.

0 commit comments

Comments
 (0)