Skip to content

Commit a7d4070

Browse files
author
jeniffer9
authored
Update README.md
1 parent 7335915 commit a7d4070

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,43 @@ query {
374374
}
375375
```
376376

377+
### Query with multiple Inline Fragments
378+
```typescript
379+
import { jsonToGraphQLQuery } from 'json-to-graphql-query';
380+
381+
const query = {
382+
query: {
383+
Posts: {
384+
__on: [
385+
{
386+
__fragmentName: "ConfigurablePost",
387+
id: true
388+
},
389+
{
390+
__fragmentName: "UnconfigurablePost",
391+
name: true
392+
}]
393+
}
394+
}
395+
};
396+
const graphql_query = jsonToGraphQLQuery(query, { pretty: true });
397+
```
398+
Resulting `graphql_query`
399+
400+
```graphql
401+
query {
402+
Posts {
403+
title
404+
... on ConfigurablePost {
405+
id
406+
}
407+
... on UnconfigurablePost {
408+
name
409+
}
410+
}
411+
}
412+
```
413+
377414
## TO-DO List
378415

379416
* Support Named Queries / Mutations

0 commit comments

Comments
 (0)