Giter Club home page Giter Club logo

Comments (3)

chris-ramon avatar chris-ramon commented on May 11, 2024

Hi @alpox!, thumbs up for graphql-go-gen pretty useful project 👍 & really looking forward to try it out.

In regards graphql/language/parser/parser.go ignoring comments, I think its the expected behavior, the next following points confirms it, which are based on the graphql-js reference implementation:

  • There is not a comment TokenKind listed on the possible tokens.

  • readToken from graphql-js/src/language/lexer.js ignores comments:

    This skips over whitespace and comments until it finds the next lexable token ...

    Source: https://github.com/graphql/graphql-js/blob/master/src/language/lexer.js#L139

  • There is a test for graphql-js/src/language/lexer.js which effectively includes comments on the query and they are ignored by the lexer & parser.

One workaround would be to copy lexer & parser and include those to graphql-go-gen, then extend their functionality to not ignore comments, perhaps starting from func positionAfterWhitespace(body string, startPosition int) int { ... }, similar to github.com/ForbesLindesay/graphql-schema-gen strategy.

Keep it up the great work!

from graphql.

alpox avatar alpox commented on May 11, 2024

Thanks @chris-ramon for your response. I will try to do like you suggested. It could take me a while to finish since i'm quite busy these days and i'm not familiar with compilers 😃 I'll try my best!

from graphql.

chris-ramon avatar chris-ramon commented on May 11, 2024

Alright @alpox, take it easy, keep up the great work and feel free to re-open the issue as needed.

from graphql.

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.