1.0.9 • Published 4 years ago

doc-graphql-builder v1.0.9

Weekly downloads
-
License
-
Repository
github
Last release
4 years ago

Original Bye https://github.com/wayfair/dociql Demo Screenshot

npm install -g doc-graphql-builder

Pass your config.yml document to generate your documentation:

doc-graphql-builder -d config.yml

Your generated documentation will be located in the public directory by default. You can either copy the generated HTML to your web server, or view your docs by pointing your browser to http://localhost:4400/.

Define config.yml template to help generate beautiful docs:

# To fetch schema from
introspection: https://url-to-you-graphql-endpoint
apiToken: ******* # Optional

servers: # same format as for OpenAPI Specification
  - url: https://dev-server.com
    description: Dev
  - url: https://prod-server.com
    description: Prod
    ...

info: # same format as for OpenAPI Specification
    title: Your API Title
    description: Markdown enabled description of your api.    
    ...

 # define your domains by providing a set of usecases
domains:
  - name: Top Level Menu Section # Name of the domain
    description: Description  # Description of the domain
    usecases:         
     - name: Fetch 'Some' field # Operation name
       description: Markdown enabled description for operation # Opearation description
       query: query.some # Query example - fetching single field
       select: field1 field2 # select only specific sub fields. By default - all are selected
       expand: field3(sub1, sub2, sub3),field4 # go deep by expanding specific fields.
     - name: Invoke Mutation # Mutation 
       description: Markdown enabled description for operation
       query: mutation.mutateSome # Mutation example - invoke mutation

Configuration Options

The basic CLI options are detailed below:

$ doc-graphql-builder -h

Usage: doc-graphql-builder options <doc-graphql-builder.yaml>

Options:

-h, --help                   output usage information
-V, --version                output the version number
-C, --disable-css            omit CSS generation (default: false)
-J, --disable-js             omit JavaScript generation (default: false)
-e, --embeddable             omit the HTML <body/> and generate the documentation content only (default: false)
-d, --development-mode       start HTTP server with the file watcher (default: false)
-D, --development-mode-live  start HTTP server with the file watcher and live reload (default: false)
-s, --start-server           start the HTTP server without any development features
-p, --port <port>            the port number for the HTTP server to listen on (default: 4400)
-P, --port-live <port>       the port number for the live reload to listen on (default: 4401)
-t, --target-dir <dir>       the target build directory (default: public)
-f, --target-file <file>     the target build HTML file (default: index.html)
-a, --app-dir <dir>          the application source directory (default: app)
-l, --logo-file <file>       specify a custom logo file (default: null)
-c, --config-file <file>     specify a custom configuration file (default: app/lib/config.js)```