You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Generate documentation from for the ["modularized schema"](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modularizing) of graphql-tools
42
+
43
+
```bash
44
+
> graphdoc -s ./schema.js -o ./doc/schema
45
+
```
46
+
47
+
> [`./schema.graphql`](https://github.com/2fd/graphdoc/blob/master/test/starwars.graphql) must be able to be interpreted with [graphql-js/utilities#buildSchema](http://graphql.org/graphql-js/utilities/#buildschema)
48
+
49
+
50
+
### Generate documentation from json file
51
+
52
+
```bash
53
+
> graphdoc -s ./schema.json -o ./doc/schema
54
+
```
55
+
56
+
> `./schema.json` contains the result of [GraphQL introspection query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
57
+
58
+
### Puts the options in your `package.json`
59
+
60
+
```javascript
61
+
// package.json
62
+
63
+
{
64
+
"name": "project",
65
+
// [...]
66
+
"graphdoc": {
67
+
"endpoint": "http://localhost:8080/graphql",
68
+
"output": "./doc/schema",
69
+
}
70
+
}
71
+
```
72
+
73
+
And execute
74
+
75
+
```bash
76
+
> graphdoc
77
+
```
78
+
79
+
### Help
80
+
81
+
```bash
82
+
83
+
> graphdoc -h
84
+
{{{bash"node ./bin/graphdoc.js --help"}}}
85
+
```
86
+
87
+
## Plugin
88
+
89
+
In graphdoc a plugin is simply an object that controls the content that is displayed
90
+
on every page of your document.
91
+
92
+
This object should only implement the [`PluginInterface`](https://github.com/2fd/graphdoc/blob/master/lib/interface.d.ts#L12-L117).
93
+
94
+
### Make a Plugin
95
+
96
+
To create your own plugin you should only create it as a `plain object`
97
+
or a `constructor` and export it as `default`
98
+
99
+
If you export your plugin as a constructor, when going to be initialized,
100
+
will receive three parameters
101
+
102
+
* `schema`: The full the result of [GraphQL instrospection query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
103
+
* `projectPackage`: The content of `package.json` of current project (or the content of file defined with `--config` flag).
104
+
* `graphdocPackag`: The content of `package.json` of graphdoc.
105
+
106
+
> For performance reasons all plugins receive the reference to the same object
107
+
> and therefore should not modify them directly as it could affect the behavior
108
+
> of other plugins (unless of course that is your intention)
0 commit comments