File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ Supported Options:
31
31
* Support for Enum values via [ ` EnumType ` ] ( #query-with-enum-values )
32
32
* Support for variables via [ ` __variables ` ] ( #query-with-variables )
33
33
* Support for simple directives (such as ` @client ` ) via [ ` __directives ` ] ( #query-with-directives )
34
+ * Support for inline fragments via [ ` __on ` ] .[ ` __fragmentName ` ] ( #query-with-inline-fragments )
34
35
35
36
## Recent Changes
36
37
@@ -341,6 +342,38 @@ query {
341
342
}
342
343
```
343
344
345
+ ### Query with Inline Fragments
346
+
347
+ ``` typescript
348
+ import { jsonToGraphQLQuery } from ' json-to-graphql-query' ;
349
+
350
+ const query = {
351
+ query: {
352
+ Posts: {
353
+ __on: {
354
+ __fragmentName: " ConfigurablePost" ,
355
+ id: true
356
+ },
357
+ title: true
358
+ }
359
+ }
360
+ };
361
+ const graphql_query = jsonToGraphQLQuery (query , { pretty: true });
362
+ ```
363
+
364
+ Resulting ` graphql_query `
365
+
366
+ ``` graphql
367
+ query {
368
+ Posts {
369
+ ... on ConfigurablePost {
370
+ id
371
+ }
372
+ title
373
+ }
374
+ }
375
+ ```
376
+
344
377
## TO-DO List
345
378
346
379
* Support Named Queries / Mutations
You can’t perform that action at this time.
0 commit comments