Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Jul 03 21:13

    StevenACoffman on v2.4.6


  • Jun 26 10:49
    StevenACoffman commented #228
  • Jun 26 10:49

    StevenACoffman on master

    Replace deprecated ioutil pkg w… (compare)

  • Jun 26 10:49
    StevenACoffman closed #228
  • Jun 26 03:16
    abhinavnair opened #228
  • Jun 25 12:49

    StevenACoffman on master

    Check for non-enum values on va… (compare)

  • Jun 25 12:49
    StevenACoffman closed #227
  • Jun 25 12:26
    coveralls commented #227
  • Jun 25 12:25
    AmeyaRao98 synchronize #227
  • Jun 25 12:22
    AmeyaRao98 edited #227
  • Jun 25 12:22
    coveralls commented #227
  • Jun 25 12:21
    AmeyaRao98 opened #227
  • Jun 13 17:05

    StevenACoffman on v2.4.5


  • Jun 06 23:46

    StevenACoffman on master

    Validate that the operation's r… (compare)

  • Jun 06 23:46
    StevenACoffman closed #225
  • Jun 06 23:46
    StevenACoffman closed #221
  • Jun 06 21:04
    StevenACoffman commented #225
  • Jun 06 20:53

    StevenACoffman on master

    Allow doubly-defined builtin di… (compare)

  • Jun 06 20:53
    StevenACoffman closed #226
  • Jun 06 20:53
    StevenACoffman closed #223
Tamal Saha
Hello, just trying to learn about GraphQL in Go.
Have you looked into using https://github.com/graphql-go/graphql/tree/master/language parser instead of writing your own?
Adam Scarr
Yeah, I looked at a bunch
the parser and lexer are actually really easy
the validation is hard
Adam Scarr
That library also doesnt use any of the schema IDL, so while there is code there its not being used for anything

also line count comparisons are interesting,

   110 ./benchutil/list_schema.go
   144 ./benchutil/wide_schema.go
  1311 ./definition.go
   148 ./directives.go
    74 ./examples/context/main.go
   141 ./examples/custom-scalar-type/main.go
    41 ./examples/hello-world/main.go
   114 ./examples/http/main.go
   138 ./examples/httpdynamic/main.go
    75 ./examples/modify-context/main.go
    24 ./examples/star-wars/main.go
   225 ./examples/todo/main.go
   872 ./executor.go
    78 ./gqlerrors/error.go
    62 ./gqlerrors/formatted.go
    39 ./gqlerrors/located.go
    30 ./gqlerrors/sortutil.go
    69 ./gqlerrors/syntax.go
    63 ./graphql.go
   763 ./introspection.go
    29 ./language/ast/arguments.go
   235 ./language/ast/definitions.go
    33 ./language/ast/directives.go
    31 ./language/ast/document.go
    22 ./language/ast/location.go
    28 ./language/ast/name.go
    45 ./language/ast/node.go
   134 ./language/ast/selections.go
   103 ./language/ast/types.go
   529 ./language/ast/type_definitions.go
   302 ./language/ast/values.go
    59 ./language/kinds/kinds.go
   682 ./language/lexer/lexer.go
    35 ./language/location/location.go
  1607 ./language/parser/parser.go
   822 ./language/printer/printer.go
    20 ./language/source/source.go
    11 ./language/typeInfo/type_info.go
   736 ./language/visitor/visitor.go
    51 ./located.go
  1892 ./rules.go
   706 ./rules_overlapping_fields_can_be_merged.go
   433 ./scalars.go
   538 ./schema.go
    99 ./testutil/introspection_query.go
   622 ./testutil/rules_test_harness.go
   468 ./testutil/testutil.go
    16 ./types.go
   276 ./type_info.go
   192 ./util.go
   287 ./validator.go
   421 ./values.go
 15985 total


   138 ./ast/collections.go
    92 ./ast/definition.go
    38 ./ast/directive.go
    65 ./ast/document.go
   159 ./ast/dumper.go
    38 ./ast/fragment.go
    29 ./ast/operation.go
    35 ./ast/selection.go
    14 ./ast/source.go
    68 ./ast/type.go
   115 ./ast/value.go
    88 ./gqlerror/error.go
    35 ./gqlparser.go
    58 ./lexer/blockstring.go
   510 ./lexer/lexer.go
   148 ./lexer/token.go
   112 ./parser/parser.go
   334 ./parser/query.go
   503 ./parser/schema.go
   138 ./parser/testrunner/runner.go
    55 ./validator/error.go
    30 ./validator/inliner/inliner.go
    39 ./validator/messaging.go
     5 ./validator/prelude.go
    86 ./validator/rules/fields_on_correct_type.go
    39 ./validator/rules/fragments_on_composite_types.go
    57 ./validator/rules/known_argument_names.go
    31 ./validator/rules/known_directives.go
    19 ./validator/rules/known_fragment_names.go
    61 ./validator/rules/known_type_names.go
    19 ./validator/rules/lone_anonymous_operation.go
    93 ./validator/rules/no_fragment_cycles.go
    28 ./validator/rules/no_undefined_variables.go
    30 ./validator/rules/no_unused_fragments.go
    30 ./validator/rules/no_unused_variables.go
   553 ./validator/rules/overlapping_fields_can_be_merged.go
    68 ./validator/rules/possible_fragment_spreads.go
    63 ./validator/rules/provided_required_arguments.go
    36 ./validator/rules/scalar_leafs.go
    30 ./validator/rules/single_field_subscriptions.go
    33 ./validator/rules/unique_argument_names.go
    24 ./validator/rules/unique_directives_per_location.go
    22 ./validator/rules/unique_fragment_names.go
    27 ./validator/rules/unique_input_field_names.go
    22 ./validator/rules/unique_operation_names.go
    23 ./validator/rules/unique_variable_names.go
   130 ./validator/rules/values_of_correct_type.go
    28 ./validator/rules/variables_are_input_types.go
    36 ./validator/rules/variables_in_allowed_position.go
   199 ./validator/schema.go
    69 ./validator/suggestionList.go
    44 ./validator/validator.go
   286 ./validator/walk.go
  5032 total
Tamal Saha
Thanks @vektah . With every release of GraphQL does the language change?
Adam Scarr
yeah, gqlparser is importing the testsuite from graphql/graphql-js to help keep up to date
there was a lot in the last spec release https://github.com/facebook/graphql/releases
Tamal Saha
This is generally the worry with hand written parsers. Writing once is easy. Keeping up with the change gets boring.
Adam Scarr
its close enough to the js implementation that it should be pretty easy
the old parser (https://github.com/graph-gophers/graphql-go/tree/master/internal) had fallen behind a fair bit
Tamal Saha
I don't want to be a downer. But say some genius at FB thinks he can rewrite the parser in some better way and does that is some future release. Now Go impl is not close.
I have seen this sort of thing.
Adam Scarr
sure, I'm not too worried
the implementation is pretty clean
Tamal Saha
That's great.
Adam Scarr
and like I said, most of the hard stuff is in validation
parser code is really pretty boring, straight forward code
Tamal Saha
Tamal Saha
Are you familiar with GRPC ? We are currently using that . I am trying to see if GraphQL can help.
Adam Scarr
we use it for a couple of things (via twirp), but have yet to expose any on the graph
it should plug straight into gqlgen
I think someone even wrote a grpc transport for graphql somewhere
Tamal Saha
hmm. Do you have any link?
Adam Scarr
not sure if he ever released it though
Tamal Saha
Have you tried to contribute back to any of the existing projects. Just as newbie with few days exploring GraphQL using GO, it is difficult to figure out what to use from the readme.
At least your project has some comparison chart.
Adam Scarr
graph-gophers is still kinda stagnant, and graphql-go is too dynamic for my tastes
it looks like recently thunder has had a lot of activity
haven't really circled back around
either way gqlgen is here to stay, 99designs has started supporting it
Tamal Saha
What does that mean? Did you use to work there from before? Or they hired you to work on this library?
Adam Scarr
I have been working there for a few years. This originally started as a side project but its got enough interest that 99 is dedicating some time and devs to work on it and maintain it
Tamal Saha
That's great!
Adam Scarr
yeah, thunder and graphql-go have a similar philosophy - write the code first (thunder a little more elegantly than graphql-go)
gophers and gqlgen are similar in the same way, they are both using the new graphql schema spec to define the schema, then bind code to that
like I said, I dont have much faith that the graphql-go parser will handle schema well, its a dead codepath as far as those projects are concerned
Tamal Saha
So, I saw that you have a separate project for the parser part. So, the plan is to write the parser and port over the validation tests from graphql-go and run the test suite in graphql-js ?
Tamal Saha
What is your general experience using Graphql over straight rest api? I see the performance side. But what about maintainability of the UI code ?
Adam Scarr
Graphql is a lot more maintainable, especially if you use Typescript + Apollo codegen to enforce types.
@vektah awesome work on the gqlgen/parser! I am just wondering if you have any recommendations on how to get started on using the parser.
I am trying to parse my schema.grraphql into an ast to do some codegen in Go.
Adam Scarr
@ppong the main package should lead you in the right direction