Comments (12)
Yep, sure does!
from graphql-tools.
@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.
@peterbrowne: guess what, descriptions just landed in graphql-js 0.7.0.
from graphql-tools.
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.
Thanks for the info! I'll follow the graphql-js parser for updates.
from graphql-tools.
@helfer does graphql-tools support the feature now?
from graphql-tools.
@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.
Just put a comment in the schema above the relevant field. We don't have docs for it yet.
from graphql-tools.
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?
from graphql-tools.
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.
@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.
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)
- Troubles with connectionParams on subscriptions
- Adding content-type header is not supported when fetching schema
- Query does not provide a operation name as a property in the request body causing some server configurations to reject the request
- @graphql-tools/mock 9.0.1 causes panic: Internal errors HOT 2
- @graphql-tools/merge directive arguments compare should not require identical ordering HOT 1
- load babel options in `graphql-tag-pluck`
- [mock] relayStylePaginationMock sometimes returns an incorrect value for hasNextPage
- Batch execution throws an error when Array.prototype has additional property
- Federation @join__field requires parameter handling improvement
- filterSchema argumentFilter provides incorrect typeName
- globalGqlIdentifierName is inconsistently forced lowercase so doesn't work with mixed case identifiers HOT 1
- makeExecutableSchema fails if typeDefs includes a directive named toString
- Vite plugin a la jest-transform for GraphQL?
- Nested fields of @computed parent are not resolved HOT 1
- Handle thrown values correctly even if they are not instances of `Error`.
- Federation: Interface Objects support
- Federation: Cover all the cases of override
- Remove unused dependencies
- printSchemaWithDirectives always prints subscription on schema HOT 1
- Project Roadmap
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-tools.