Code Monkey home page Code Monkey logo

dociql's Introduction

DociQL

npm downloads builds coverage Quality Gate Status

A nice fork of Spectacle

DociQL generates beautiful static HTML5 documentation from a GraphQL endpoint using the introspection query.

The goal of DociQL is help you "save time and look good" by providing an extensible platform for auto generating your API documentation. The default layout is a three column single page, similar to those employed by Stripe and Intercom.

See a demo of DociQL in action here: https://wayfair.github.io/dociql/


Demo Screenshot


Features

  • Uses the introspection query to fetch a schema of GraphQL and generates documentation on the fly.
  • Generates an example request and response with "Try it now" links.
  • Allows the user to define use cases and group them by domain.
  • Highly configurable: Easily configurable Handlebars templates and SCSS styles so you can add your own design and flavour without going bald. See Custom Builds.
  • Markdown support: Render markdown written in any of your API descriptions.
  • Clean, responsive design: Responsive HTML5 and CSS3 layout built with Foundation 6 that looks great on all devices and screen sizes.
  • Embed into your existing website: An embedded option so that you can generate partial docs without a HTML <body> tag for convenient integration into your existing website.
  • Live preview developer mode: Development mode that starts a local HTTP server with a file watcher and live reload, so you can preview live changes in your browser as you update your specification.

Usage

Install DociQL from npm:

npm install -g dociql

Define config.yml template to help generate beautiful docs:

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

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

Pass your config.yml document to generate your documentation:

dociql -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/.

Docker

Coming soon!

Configuration Options

The basic CLI options are detailed below:

$ dociql -h

  Usage: dociql [options] <dociql.yaml>

  Options:

    -h, --help                   output usage information
    -H, --header                 specify a custom auth token for the header (default: none)
    -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)
    -1, --one-file               embed all resources (CSS and JS) into the same file (default: false)
    -u, --introspection-url <url>              specify a custom url to use for introspection (default: none)
    -c, --config-file <file>     specify a custom configuration file (default: app/lib/config.js)

Most options are self explanatory, but the following options warrant some further explanation:

  • --development-mode -d: This option starts a development server with a file watcher, and will automatically regenerate your docs when any of your spec or app files change.

  • --development-mode-live -D: This option starts a development server with a file watcher and live reload, and will automatically regenerate your docs when any of your spec or app files change.

  • --start-server -s: This option starts a production server without any development options enabled that serves the contents of your --target-dir.

  • --embeddable -e: This option lets you build a minimal version of the documentation without the HTML <body> tags, so you can embed DociQL into your own website template. More info on Custom Builds here.

  • --app-dir -a: This option overrides the default directory which contains all the Handlebars templates, SCSS, and JavaScript source files. This option is useful for development because you can copy the contents of app to a remote location or a separate repo for custom builds.

  • --target-dir -t: This option specifies where the generated documentation HTML files will be output.

Custom Builds

The best option for building your own custom functionality into DociQL is to fork DociQL on GitHub and make your own modifications in the source. This way, you can keep up-to-date by merging changes from the master branch and you can also contribute your updates back to master by creating a Pull Request, especially if you think they'll be an improvement for DociQL.

To fork DociQL go to https://github.com/wayfair/dociql and press the 'Fork' button. Now you can git clone [email protected]:<yourname>/dociql.git to make your own changes.

Alternatively, you can just copy the contents of app from the main repo which contains all of the source files such as templates, stylesheets, and JavaScripts. Now, just pass the path from your custom app path to the CLI like so: dociql -a dociql.json.

Optimizing Your Workflow

Using an API spec to generate your documentation has a number of great advantages, such as:

  • Maintain a single source: Save time by removing the need to maintain a separate API spec and API documentation.
  • No more out-of-date documentation: Your documentation will always be up-to-date with your API spec.
  • Be a better developer: Your entire API system will be more stable and robust when built around your spec as a single source of truth.

Development

Testing

Coming soon!

Testing is powered by Mocha/Chai and automated testing is run via CircleCI.

At this stage, unit tests have not been written for all parts of the codebase. However, new code should be tested, and unit tests for the existing code will be added in the future.

Run npm test on the repository to start the automated tests. Some parts of testing can be configured using environment variables.

  • OFFLINE=true Some tests use HTTP connections to test, giving DociQL remote API specifications. Use OFFLINE=true to skip tests that require an internet connection.

Include environment variables before calling npm test. For example, OFFLINE mode can be enabled via OFFLINE=true npm test.

License

DociQL is licensed under the Apache License 2.0 – see the LICENSE.md for specific details.

More Information

More info is available on the DociQL homepage.

Please use the GitHub issue tracker if you have any ideas or bugs to report.

All contributions are welcome.

Good luck and enjoy DociQL!

dociql's People

Contributors

andrewdonkin avatar auscaster avatar codelenny avatar draco2003 avatar fenech avatar glb avatar idoub avatar itsmefox avatar josa42 avatar kalafut avatar lionelvillard avatar martwz avatar maxwellsmart84 avatar mpaktiti avatar natalisucks avatar offbeatful avatar oshinkaramian avatar oskard avatar ouadie-lahdioui avatar ptte avatar qinfeng avatar renovate[bot] avatar schursin avatar svisser avatar theidco-scottleckie avatar userlarsb avatar yetithefoot avatar yyamano avatar zak-cloudnc avatar zakhenry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dociql's Issues

Ability to generate documentation from an already fetched graphql schema

Imagine a GraphQL service where introspection is disabled or where introspection takes so long that it makes the service unstable.

I suggest that it would be convenient to be able to generate the documentation from an already-generated and locally available schema.json.

What do you think?

Getting error on setting up: Cannot read property 'name' of undefined

npx dociql -d gql-doc.yml

Error: Cannot read property 'name' of undefined

gql-doc.yml content:

# To fetch schema from
introspection: http://127.0.0.1:4000/graphql

# 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

logo + target directory cli options does not work?

I'm trying to run dociql with the following command line options but it seems it just use the default?

dociql -l test.png -t docs -s config.yml

Above line executes but instead of generating it under /docs it just generates under the default target dir which is /public and also it does not generate the logo on the index.html

Any idea why it does not work?

Handle union return types

I have requests that can have 2 return types using union.
Example:

union SuccessOrError = GraphqlError | Success

mutation deleteAccount($accountId: String!) {
  deleteAccount(accountId: $accountId) {
      ... on Success {
          success
          message
      }
      ... on GraphqlError {
          success
          message
          code
      }
  }
}

Dociql displays that:

{
  "data": {}
}

I tried to expand fields without success.
Do you have an idea of how can I make it works?

Reconfigure CI

Wayfair generally uses GitHub Actions for CI in GitHub. This repository was an exception until we found that travis has had multiple incidents in the last couple months -- including one that exposed an NPM token we use in CI.

We will not be continuing use of Travis. This issue is to track migration to GitHub Actions for CI.

Reading description from schema introspection.

Is there a way to configure it to read the description of a query from the schema instead of the YAML configuration file? I tried removing the the description from the configuration file, but it's not showing the description from the introspection.

Get Child Field

How to getting doc from query like this ?

query getProducts {
  brands(IDs: ["brandID"]) {
    products {
      items {
        ID
        ...
      }
    }
  }
}

Bump node-sass version to 5.0.0 to support additional Linux distros?

❯ npx dociql ./config.yml 
/home/fty/.npm/_npx/162264e87682f5f4/node_modules/node-sass/lib/binding.js:13
      throw new Error(errors.unsupportedEnvironment());
      ^

Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1

Installing with npm also fails.

Running node 15.5.0 on rhel7

Authorization Headers not added to request

I've noticed that the authorization header is not added to the outgoing introspection request when using the -H cli option. Running something like:

dociql -s config.yml --header testing

has the following headers on the request:

 {
  'content-length': '1765',
  'content-type': 'application/json',
  'accept-encoding': 'gzip,deflate',
  host: 'localhost',
  connection: 'close'
}

I've looked at the code and it should be working but wanted to check in and see.

Task error: [TypeError: cheerio is not a function

The latest version when installed (npm install -g dociql) globally throws compilation errors.

Some notes:

it appears that the function cheerio() as defined in /usr/local/lib/node_modules/dociql/app/lib/common.js does not seem to have compatible import. So, any suggestions on how to resolve? I have updated cheerio package as well.

var $ = cheerio("<root>" + html + "</root>")
var highlightGraphQl = require('../dociql/graphql-hl')
var cheerio = require('cheerio')
...
    if (stripParagraph) {
      var $ = cheerio("<root>" + html + "</root>")
Running "sass:foundation_scss" (sass) task

Running "concat:foundation_css" (concat) task

Running "sass:scss" (sass) task

Running "concat:css" (concat) task

Running "cssmin:minify" (cssmin) task
>> 2 files created. 148.02 kB → 117.84 kB

Running "concat:js" (concat) task

Running "uglify:js" (uglify) task
>> 1 file created 6.79 kB → 2.96 kB

Running "clean:html" (clean) task
>> 0 paths cleaned.

Running "compile-handlebars:compile" (compile-handlebars) task
Task error: [TypeError: cheerio is not a function
  at Object.markdown (/usr/local/lib/node_modules/dociql/app/lib/common.js:24:15)
  at Object.module.exports (/usr/local/lib/node_modules/dociql/app/helpers/md.js:14:21)
  at Object.wrapper (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
  at eval (<anonymous>:11:137)
  at Object.prog [as fn] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:268:12)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/if.js:29:22)
  at Object.wrapper (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
  at Object.eval (<anonymous>:21:47)
  at main (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
  at Object.ret (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
  at Object.ret [as swagger/operation] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
  at Object.invokePartialWrapper [as invokePartial] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:88:46)
  at eval (<anonymous>:10:31)
  at prog (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:268:12)
  at execIteration (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19)
  at /usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:89:13
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:91:11)
  at Object.wrapper (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
  at Object.eval (<anonymous>:13:49)
  at main (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
  at Object.ret (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
  at Object.ret [as swagger/path] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
  at Object.invokePartialWrapper [as invokePartial] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:88:46)
  at eval (<anonymous>:10:31)
  at prog (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:268:12)
  at execIteration (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19)
  at /usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:89:13
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:91:11)
  at Object.wrapper (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
  at eval (<anonymous>:10:52)
  at Object.prog [as inverse] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:268:12)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/if.js:27:22)
  at Object.wrapper (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
  at Object.eval (<anonymous>:11:47)
  at main (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
  at Object.ret (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
  at Object.ret [as swagger/paths] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
  at Object.invokePartialWrapper [as invokePartial] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:88:46)
  at eval (<anonymous>:10:31)
  at Object.prog [as inverse] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:268:12)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/helpers/if.js:27:22)
  at Object.wrapper (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
  at Object.eval (<anonymous>:17:47)
  at main (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
  at Object.ret (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
  at Object.ret [as layout/content] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
  at Object.invokePartialWrapper [as invokePartial] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:88:46)
  at Object.eval (<anonymous>:14:28)
  at main (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
  at Object.ret (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
  at Object.ret [as layout/page] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
  at Object.invokePartialWrapper [as invokePartial] (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:88:46)
  at Object.eval (<anonymous>:13:28)
  at main (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
  at ret (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
  at ret (/usr/local/lib/node_modules/dociql/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
  at compile (/usr/local/lib/node_modules/dociql/node_modules/grunt-compile-handlebars/tasks/compile-handlebars.js:243:15)
  at /usr/local/lib/node_modules/dociql/node_modules/grunt-compile-handlebars/tasks/compile-handlebars.js:277:13
  at Array.forEach (<anonymous>:null:null)
  at /usr/local/lib/node_modules/dociql/node_modules/grunt-compile-handlebars/tasks/compile-handlebars.js:276:20
  at Array.forEach (<anonymous>:null:null)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt-compile-handlebars/tasks/compile-handlebars.js:264:11)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/grunt/task.js:252:15)
  at Object.thisTask.fn (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/grunt/task.js:70:16)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:294:30)
  at Task.runTaskFn (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:244:24)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:293:12)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:223:9)
  at Task.runTaskFn (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:247:9)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:293:12)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:223:9)
  at Timeout._onTimeout (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:234:33)
  at listOnTimeout (internal/timers.js:551:17)
  at processTimers (internal/timers.js:494:7)
]

Running "predentation" task
Task error: [Error: ENOENT: no such file or directory, open '/var/folders/pm/y9cmfxwx3pj1zb3n1q478bd0tls5kj/T/spectacle-154091hlXZQm3HtC5/index.html'
  at Object.openSync (fs.js:465:3)
  at Object.readFileSync (fs.js:368:35)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/index.js:96:23)
  at Object.thisTask.fn (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/grunt/task.js:70:16)
  at Object.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:294:30)
  at Task.runTaskFn (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:244:24)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:293:12)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:223:9)
  at Task.runTaskFn (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:250:7)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:293:12)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:223:9)
  at Task.runTaskFn (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:247:9)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:293:12)
  at Task.<anonymous> (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:223:9)
  at Timeout._onTimeout (/usr/local/lib/node_modules/dociql/node_modules/grunt/lib/util/task.js:234:33)
  at listOnTimeout (internal/timers.js:551:17)
  at processTimers (internal/timers.js:494:7)
] {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/var/folders/pm/y9cmfxwx3pj1zb3n1q478bd0tls5kj/T/spectacle-154091hlXZQm3HtC5/index.html'
}

Arrays are not marked as "required"

Arrays (and fields in the array) are not marked as required even if they are marked as non-null in the schema.

type Test {
    foos: [Foo!]!
    bars: [Bar]!
    bazs: [Baz!]
}

None of these will receive the red "Required" bubble in the documentation.

-H Header option is not documented

hello! I noticed that in the code there is an option to apply a header to your requests but it is not documented on the readme!

I was unable to get this working until I looked through the source code and saw the option, you guys should add this to the readme and possibly document how this can be done as well with the config.yml file.

I believe the change was made with this PR:
#11

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm codecov Unavailable
npm node-sass Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency commander to v12
  • fix(deps): update dependency marked to v14
  • fix(deps): update dependency node-sass to v9
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • node 8-alpine
github-actions
.github/workflows/renovate_linting.yml
  • actions/checkout v3
  • suzuki-shunsuke/github-action-renovate-config-validator v0.1.2
npm
package.json
  • bluebird 3.7.2
  • cheerio 1.0.0-rc.12
  • clarify 2.1.0
  • coffeescript 2.7.0
  • commander 6.2.1
  • foundation-sites 6.7.5
  • graphql 14.7.0
  • graphql-2-json-schema 0.9.1
  • graphql-json-schema 0.1.2
  • grunt 1.5.3
  • grunt-compile-handlebars 2.0.2
  • grunt-contrib-clean 2.0.1
  • grunt-contrib-concat 1.0.1
  • grunt-contrib-connect 2.1.0
  • grunt-contrib-copy 1.0.0
  • grunt-contrib-cssmin 3.0.0
  • grunt-contrib-handlebars 2.0.0
  • grunt-contrib-jshint 2.1.0
  • grunt-contrib-uglify 4.0.1
  • grunt-contrib-watch 1.1.0
  • grunt-embed 0.2.1
  • grunt-prettify 0.4.0
  • grunt-sass 3.1.0
  • handlebars 4.7.7
  • highlight.js 9.18.5
  • js-yaml 3.14.1
  • json-refs 3.0.15
  • json-stable-stringify 1.0.1
  • lodash 4.17.21
  • marked 0.8.2
  • node-sass 6.0.1
  • sync-request 6.1.0
  • tmp 0.2.1
  • trace 3.1.1
  • chai 4.3.6
  • codecov 3.8.2
  • mocha 8.4.0
  • nyc 14.1.1
  • node >=8

  • Check this box to trigger a request for Renovate to run again on this repository

Ability to configure the host for dev mode server

The development mode server starts at localhost on 4400 by default which is fine. However, imagine we can configure the host to say 0.0.0.0, then it becomes possible to configure dociql to run in docker container even thought it does not have docker support yet

Generates invalid link closing tag for "Try it now"

In some cases (I have no idea about the reason) the app generates invalid closing tag for "try it now" link. This causes invalid page markup.

For instance, here goes the example of invalid link

 <h5>Variables</h5>
                    <!-- <div class="hljs"> -->
                    <html>
                    <head></head>
                    <body><pre><code class="hljs language-json">{
  <span class="hljs-attr">"product_id"</span>: <span class="hljs-string">"integer"</span>,
  <span class="hljs-attr">"guestCartId"</span>: <span class="hljs-string">"string"</span>
}
</code></pre> </body>
                    </html>
                    <!-- </div> -->
                    <a href="https://project.dev/graphql?query=mutation%20removeComparedProduct(%24product_id%3A%20Int!%2C%20%24guestCartId%3A%20String)%7B%0A%20%20removeComparedProduct(product_id%3A%20%24product_id%2C%20guestCartId%3A%20%24guestCartId)%0A%7D" target="_blank">Try it now
                      <a/>

As you can see instead of a closing tag (</a>) it generates <a/> tag.

TypeError: Cannot read property 'name' of undefined

My server is GraphQL-Java. I am trying to generate documentation and getting some exception. The introspection query is sent to the server and GraphQL schema is sent back to dociql. However below exception is raised while preparing documentation. I am very new to nodejs and could not debug the issue in detail. Basically graphQLSchema.getQueryType() returns undefined value which is cause of the issue.
Any help really appreciated.

The following is usecase

usecases:
- name: 'branchPlantsUpdates' # Operation name
description: Testing # Opearation description
query: query.branchPlantsUpdates(start:"2020-01-01T12:00:00Z", end:"2021-10-01T01:00:00Z", page:"3") page # Query example - fetching single field
- name: Invoke Mutation # Mutation
description: Markdown enabled description for operation
query: mutation.mutateSome # Mutation example - invoke mutation

and error is

_C:\InstalledSoftware\GraphQLDoc>dociql -d config.yml
graphQLSchema __validationErrors,extensions,astNode,extensionASTNodes,__allowedLegacyNames,_queryType,_mutationType,_subscriptionType,_directives,_typeMap,_possibleTypeMap,_implementations
statement branchplantsupdates
statement [object GraphQLSchema]
statement Query
C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\app\dociql\compose-paths.js:45
field: target.name,
^
TypeError: Cannot read property 'name' of undefined
at composePath (C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\app\dociql\compose-paths.js:45:27)
at C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\app\dociql\compose-paths.js:100:59
at Array.forEach (:null:null)
at C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\app\dociql\compose-paths.js:100:25
at Array.forEach (:null:null)
at module.exports (C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\app\dociql\compose-paths.js:99:13)
at module.exports (C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\app\dociql\index.js:34:16)
at loadData (C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\index.js:57:76)
at module.exports (C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\index.js:61:70)
at Object. (C:\Users\nethi\AppData\Roaming\npm\node_modules\dociql\bin\dociql.js:40:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module.load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47

`yarn.lock` and `package-lock.json`?

The project now contains both a yarn.lock and a package-lock.json, which is causing yarn to complain to me with the following after pulling the latest and running yarn:

warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.

I'm not sure what the right move is here and how a project steers developers towards yarn or npm these days...but it seems like something's off here? Maybe the yarn.lock need to be removed? Or the package-lock.json? Not sure which is the better move.

🧹 Add Renovate

Description

👋 This repository is not currently configured for Renovate. This issue proposes the steps necessary to add Renovate to this project!

💡 Not familiar with Renovate, or are confused about what advantages it holds over GitHub's Dependabot? Learn more here!

Steps to Add

  1. Review the guide for Adding Renovate to Existing Projects.
  2. Assign yourself to this issue to signal to others that you intend to work on it. If you ultimately decide not to pursue this, please remember to un-assign yourself so that others may participate!
  3. If the renovate[bot] account has already auto-filed a Configure Renovate PR against this repository, feel free to reference the proposed changes in your own Pull Request. If you are contributing to this project as a Hacktoberfest participant, you must file your own PR in order to get credit for your contribution!
  4. You may find that the CI build for this project is failing for unrelated reasons. If you are not already a contributor to this project and don't feel comfortable attempting to fix the build, that's okay! There's plenty of other ways you can contribute to Wayfair's open source projects :) Feel free to consult the list of our other participating repositories here!
  5. In order to catch potential JSON syntax errors or other mis-configurations, please add Renovate linting to this project's existing GitHub Workflow CI pipeline, or create a new one (eg. .github/workflows/lint.yml). See here for an example.
  6. If this repository is currently configured to use GitHub's Dependabot, you must also deprecate support for Dependabot in order to avoid conflicts with Renovate. This is typically as simple as removing the .github/dependabot.yml file. See here for an example.

Checklist

  • I have read the Adding Renovate to Existing Projects guide.
  • I have assigned this issue to myself avoid duplicating efforts with other potential contributors.
  • I have verified this repository does not already have Renovate configured (or proposed in an open PR by another contributor).
  • If the renovate[bot] account has already auto-filed a Configure Renovate PR in this repository, I confirm that I will create a separate PR under my own GitHub account, using the initial PR as inspiration.
  • I confirm that I have added Renovate linting to this project's existing CI pipeline, or have created a new linting workflow if one doesn't already exist.
  • If this repository is currently configured to use GitHub's Dependabot, my PR will also deprecate support for Dependabot in order to avoid conflicts with Renovate.

Error: ECONNRESET after 2 minutes waiting for introspection query

path\node_modules\dociql\node_modules\sync-rpc\lib\index.js:146
      throw new Error(
      ^

Error: nodeNC failed:

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read'
}

The above error gets thrown if the introspection query takes longer than 2 minutes (I have a very large schema so it takes just over 2 minutes to return). After some investigation it looks like this is a bug from the sync-rpc library see here so there is a fix but it requires editing the sync-rpc library itself.

Is there a way around this? I think allowing us to point to a json with the introspection results directly would solve this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.