Skip to content

More clearly specify when arguments can be passed multiple times #415

Description

@panozzaj

Hi, thanks for making this library, it was useful to me for inspecting a GraphQL endpoint.

I wanted to share that I had a little trouble getting it working since it wasn't totally clear how to pass multiple arguments of the same type (in my case -x for headers). I only thought to do this after seeing another library that said:

--header, -h    Add a custom header (ex. 'X-API-KEY=ABC123'), can be used multiple times

and digging into the code and seeing that it was part of a ListValueFlag. So then I tried multiple instances of -x and that seemed to work. I just kind of guessed at the format being "headername: header value".

Perhaps there is a way to make multiple parameters clearer in the documentation l like the get-graphql-schema library does? Or providing an example with multiple arguments.


Also, the error I got before providing the correct arguments was unclear:

/Users/anthony/.nvm/versions/node/v18.19.1/lib/node_modules/@2fd/graphdoc/lib/schema-loader/http.js:53
                        return resolve(body.data.__schema);
                                                 ^

TypeError: Cannot read properties of undefined (reading '__schema')
    at Request._callback (/Users/anthony/.nvm/versions/node/v18.19.1/lib/node_modules/@2fd/graphdoc/lib/schema-loader/http.js:53:50)
    at self.callback (/Users/anthony/.nvm/versions/node/v18.19.1/lib/node_modules/@2fd/graphdoc/node_modules/request/request.js:185:22)
    at Request.emit (node:events:517:28)
    at Request.<anonymous> (/Users/anthony/.nvm/versions/node/v18.19.1/lib/node_modules/@2fd/graphdoc/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:517:28)
    at IncomingMessage.<anonymous> (/Users/anthony/.nvm/versions/node/v18.19.1/lib/node_modules/@2fd/graphdoc/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (node:events:631:28)
    at IncomingMessage.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

It might have been better to say that no results were returned or there was an authentication error or something.


Version: graphdoc v2.4.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions