GithubHelp home page GithubHelp logo

Comments (12)

helfer avatar helfer commented on May 1, 2024 2

Yep, sure does!

from graphql-tools.

helfer avatar helfer commented on May 1, 2024 1

@petebrowne I agree 100% that it would be much nicer to have comments turn into descriptions. The reason it doesn't is that we use the parser from graphql-js, and that parser doesn't support it yet. The best way to get it to happen is probably to put your voice behind this PR (or a modified version thereof): graphql/graphql-js#427

from graphql-tools.

helfer avatar helfer commented on May 1, 2024 1

@peterbrowne: guess what, descriptions just landed in graphql-js 0.7.0.

from graphql-tools.

helfer avatar helfer commented on May 1, 2024

And to answer your question on how to do this with graphql-tools currently: you have to pass the descriptions in resolvers like so:

const resolvers = {
  User: {
    __description: "A user with an account",
    username: {
      description: "A unique name for the user",
      resolve: user => user.username,
    }
  }
};

Please note that for types you have to use __description while for fields you just use description.

from graphql-tools.

petebrowne avatar petebrowne commented on May 1, 2024

Thanks for the info! I'll follow the graphql-js parser for updates.

from graphql-tools.

stubailo avatar stubailo commented on May 1, 2024

@helfer does graphql-tools support the feature now?

from graphql-tools.

tonyxiao avatar tonyxiao commented on May 1, 2024

@helfer @stubailo I can't find any docs on how to use the description still. Mind pointing me to the right place?

from graphql-tools.

stubailo avatar stubailo commented on May 1, 2024

Just put a comment in the schema above the relevant field. We don't have docs for it yet.

from graphql-tools.

tonyxiao avatar tonyxiao commented on May 1, 2024

Hmm that's exactly what I tried though. But doesn't seem to work. I'm using "graphql-tools": "^0.6.6", should be correct?

image

from graphql-tools.

DxCx avatar DxCx commented on May 1, 2024

Hi @tonyxiao,
Looking at @helfer 's medium post
That is correct (single hashtag)
Are you using graphql-js v 0.7.0?

from graphql-tools.

tonyxiao avatar tonyxiao commented on May 1, 2024

@DxCx Oh sweet, thanks for the pointer. I assumed that I needed to upgrade graphql-tools, but turns out I actually need to upgrade graphql instead (peerDependency of graphql-tools). Upgraded and working, thanks!

from graphql-tools.

DxCx avatar DxCx commented on May 1, 2024

great @tonyxiao happy to hear it as i didn't had to the time to test it myself, so i assume we can close this issue =)

from graphql-tools.

Related Issues (20)

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.