File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,43 @@ query {
374
374
}
375
375
```
376
376
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
+
377
414
## TO-DO List
378
415
379
416
* Support Named Queries / Mutations
You can’t perform that action at this time.
0 commit comments