Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Descriptions in .graphql files #12

Open
schrockn opened this issue Jul 3, 2017 · 0 comments
Open

Implement Descriptions in .graphql files #12

schrockn opened this issue Jul 3, 2017 · 0 comments

Comments

@schrockn
Copy link
Owner

schrockn commented Jul 3, 2017

Right now it is not possible to embed descriptions in the graphql files. This is bad. We should be able to write docs inline with the type declarations.

This actually requires changes to graphql-core. A similar change was made to graphql-js here graphql/graphql-js@165b9d3 . This should be mimicked in graphql-core. The idea to make comments a lexed token, make the stream of lexed tokens a doubly linked list that skips those comments by default. This allows another piece of code to consume the linked list but "peek" backwards to see if there is a comment. If there is, we can see consume that token and produce descriptions as appropriate.

Seems like the best first stab would be to indicate description versus comments by prefixing "##" for descriptions.

# this is a comment that will not appear in the description
## This is a description of User
type User {
   # this is not a description
   id: UUID!
   ## This is a description of name
   name: String!
   ## Description of TodoList
   todoLists(
      ## This is a description of first  
      first: Int = 100, 
      ## This is a description of after
      after: UUID): [TodoList!]!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant