From 2bfea0d11ca7d6d6e4b648082c8a3e862bba11b0 Mon Sep 17 00:00:00 2001 From: laststylebender Date: Mon, 12 Aug 2024 15:20:55 +0530 Subject: [PATCH] - add unwrapSingleFieldTypes in cli doc --- docs/cli.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 881b256b23..9642882833 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -142,8 +142,9 @@ To generate a TailCall GraphQL configuration, provide a configuration file to th }, "preset": { "mergeType": 1, - "consolidateURL": 0.5 - "treeShake": true + "consolidateURL": 0.5, + "treeShake": true, + "unwrapSingleFieldTypes": true } } ``` @@ -171,6 +172,7 @@ preset: mergeType: 1 consolidateURL: 0.5 treeShake: true + unwrapSingleFieldTypes: true ``` @@ -274,6 +276,7 @@ The config generator provides a set of tuning parameters that can make the gener "mergeType": 1, "consolidateURL": 0.5, "treeShake": true, + "unwrapSingleFieldTypes": true, }, } ``` @@ -286,6 +289,7 @@ preset: mergeType: 1 consolidateURL: 0.5 treeShake: true + unwrapSingleFieldTypes: true ``` @@ -409,3 +413,29 @@ preset: a: Int } ``` + +4. **unwrapSingleFieldTypes:** This setting instructs Tailcall to flatten out types with single field. + + ```graphql showLineNumbers title="Before applying the setting" + type Query { + foo: Foo + } + + # Type with only one field + type Foo { + bar: Bar + } + + # Type with only one field + type Bar { + a: Int + } + ``` + + ```graphql showLineNumbers title="After applying setting" + type Query { + foo: Int + } + ``` + + This helps in flattening out types into single field.