Skip to content

Commit e7aad0c

Browse files
committed
Updated docs
1 parent fe9f4f1 commit e7aad0c

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

docs/configuration/config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ API_URL=http://localhost:4000/graphql
5656
`.sgtsrc.js`
5757

5858
```javascript
59+
/**
60+
* @type { import("simple-graphql-to-typescript").SgtsConfig }
61+
*/
5962
module.exports = {
6063
endpoint: process.env.API_URL,
6164
output: './generated.ts',

docs/options/codegen-functions.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,20 @@ const commentFragment = gql`
6666
body
6767
}
6868
`
69-
// OR a simple string
69+
// Or a simple string
7070

7171
const commentFragment = `
7272
id
7373
name
7474
body
7575
`
7676

77-
const commentsQuery = sgts.comments().$fragment(commentFragment);
77+
const commentsQuery = sgts.comments(commentFragment);
78+
// Or
79+
const commentsQuery = sgts.comments(); // This will take the auto-generated fragment by default
7880

79-
commentsQuery.$args({postId: 5}).$fetch().then(data => console.log(data))
81+
82+
const result = await commentsQuery.$args({postId: 5}).$fetch();
8083

8184
// You can cancel your request any time
8285

docs/options/gen-fragments.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
### Type: `boolean`
44

55
::: warning
6-
**This option is still in alpha and still buggy, do not use in production**
6+
**This option is still in alpha can still be buggy, use with care**
77
:::
88

9-
Enable fragment generation and queries/mutations auto-fragments so you don't have to pass any
9+
Enable fragment generation and queries/mutations auto-fragments so you don't have to pass any.
10+
11+
For classic GraphQL types, this will generate the fragment up to 2 levels deep to avoid circulars types.
12+
For Connection fragments, it will go to 4 levels deep.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simple-graphql-to-typescript",
3-
"version": "0.10.10",
3+
"version": "0.10.11",
44
"description": "Simple Typescript interface generator from GraphQL Schemas",
55
"main": "dist/index.js",
66
"typings": "types/index.d.ts",
@@ -80,7 +80,6 @@
8080
"eslint": "^7.21.0",
8181
"eslint-config-prettier": "^8.1.0",
8282
"eslint-plugin-prettier": "^3.3.1",
83-
"inquirer": "^7.3.3",
8483
"jest": "^26.6.3",
8584
"lodash": "^4.17.21",
8685
"rimraf": "^3.0.2",
@@ -94,6 +93,7 @@
9493
"commander": "^6.2.0",
9594
"custom-env": "^2.0.1",
9695
"dotenv": "^8.2.0",
96+
"inquirer": "^7.3.3",
9797
"figlet": "^1.5.0",
9898
"graphql": "^15.5.0",
9999
"mkdirp": "^1.0.4",

0 commit comments

Comments
 (0)