Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 21:18
    StevenACoffman commented #1404
  • 21:17
    StevenACoffman closed #1404
  • 21:17
    StevenACoffman closed #1403
  • 21:02
    coveralls commented #1404
  • 20:59
    StevenACoffman commented #1626
  • 20:58
    StevenACoffman commented #1626
  • 20:48
    JohnMaguire commented #1626
  • 20:33
    JohnMaguire commented #1173
  • 20:32
    JohnMaguire commented #1173
  • 08:09
    danielvladco synchronize #1404
  • Oct 23 20:08
    vikstrous2 commented #518
  • Oct 22 23:21
    kdawgwilk commented #1670
  • Oct 22 21:03
    duckbrain commented #743
  • Oct 22 20:26
    duckbrain commented #592
  • Oct 22 20:25
    carldunham commented #1670
  • Oct 22 14:48
    murnux edited #1673
  • Oct 22 14:48
    murnux opened #1673
  • Oct 22 11:02
    vincenzopalazzo commented #1672
  • Oct 22 10:26
    vincenzopalazzo opened #1672
  • Oct 22 04:47
    CoreyWinkelmann commented #1665
cpunekar
@cpunekar
I tried making resolver and generated.go pkg names as main but got some cycle error, guess it's not that way
Jon Lundy
@JonLundy
hmm should only give you cycle if its trying to import its own package i think
is resolver trying to import the generated ?
cpunekar
@cpunekar
nope.. no references of generated in resolver
Jon Lundy
@JonLundy
what about server.go?
or rather what does it say is cycleing
cpunekar
@cpunekar
user-MacBook-Pro:test-gql user$ go run .
import cycle not allowed
package test-gql
    imports test-gql
Jon Lundy
@JonLundy
imports itsself?
try removing that :)
cpunekar
@cpunekar
package name is "main" in resolver, generated and server
ah yes.. I did import "tets-gql" in server.go (sleep deprived).. not sure how should I write below line since the server.go needs to in the folder as generated.go and resolver.go
cpunekar
@cpunekar
srv := handler.NewDefaultServer(test-gql.NewExecutableSchema(test-gql.Config{Resolvers: &test-gql.Resolver{}}))
Jon Lundy
@JonLundy
just remove the test-gql. from everything
its all defined in the same package
importing from the same directory is a python convention.. its not like that in Go
cpunekar
@cpunekar
the joy when your code works.. thanks to you @JonLundy
Jon Lundy
@JonLundy
np
cpunekar
@cpunekar
just for general knowledge.. what's the folder structure you guys follow for production servers?
Jon Lundy
@JonLundy
I typically have
  • pkg/generated/generated.go
  • pkg/model/model_gen.go
  • pkg/resolvers/...go
Just to keep them separate
I have seen in examples where the generated/models are subdirectory of resolvers
cpunekar
@cpunekar
@JonLundy that makes more sense.. thanks!
Tassios Marios
@mariosttass
Hi guys,
Basically I have a simple question, in case that we have a very complicated schema there is a work around to generate that using gqlgen library?
Thank you.
Jon Lundy
@JonLundy
@mariosttass how do you mean?
like its a large schema? or there are many interconnected types and queries?
Tassios Marios
@mariosttass
  Hi, I was meaning that in case that there are many types and queries. 
Jon Lundy
@JonLundy
is it failing to generate the source files?
Tassios Marios
@mariosttass
No, basically I am asking if there is a way to generate the schema from structs.
Jon Lundy
@JonLundy
ah.. i think some of the other projects for graphql do some things like that. this project is designed around the other way, taking a schema and building a server for it.
Thunder is an example of a struct first approach https://github.com/samsarahq/thunder
Tassios Marios
@mariosttass
Thank you very much @JonLundy
Slava
@m0sth8
Hi. Is it possible to use resolver in Go code to get json object? I have a use case when I need to return graphql object via rpc channel.
Slava
@m0sth8
Seems like I can do this with an Executor exposed in 0.11
Jon Lundy
@JonLundy
Graphql typically returns a json object for requests. Do you mean having the json embedded in a value?
Like {"res":"{\"a\":1}"}
Julien
@juleur
hi
is someone encounter problems with extensions errors ?
Tassios Marios
@mariosttass
Hi guys,
I have a question, I am using gqlgen library with gorm library and I want to use only one model, how I can setup the gqlgen to use the already defined model ?
Thanks !
David Douglas
@ddouglas

Hello All, been using GQLGen for a while now. Just started a fresh project today and I am getting the following error when generating the schema.

validation failed: packages.Load: -: no matching versions for query "latest"

I did some research and i think this is an error from a dependency of gqlgen

Any tips?
Andy Grunwald
@andygrunwald
Hey everyone,

First, thanks a lot for this awesome project. It helps a lot and makes a lot of fun.
I am curious, is there support for multiple GraphQL Schemas? I am not talking about splitting your Schema into multiple files. I am talking about two GraphQL schemas. One intended for a public interface and one for a backend service (e.g., an admin dashboard).
In an admin dashboard, you typically want to expose more data than in the public interface. The scenario is also described here: https://spectrum.chat/graphql/general/splitting-a-graphql-api-between-public-private~d84a2d9c-e052-422f-aedc-21c0ecc642eb

An alternative would be to create a second service from scratch and keep it 100% independent. Con here would be code duplication or it is getting tricky to share code/models.
E.g.

Client ---> Public GraphQL Service ---> Database <--- Private GraphQL Service <---Backend/Admin-Dashboard

How do you think about this?
Let me know (also if this is the wrong place to ask and I should open a feature request to support multiple schemas in one instance)

Andy Grunwald
@andygrunwald
I opened up an issue to discuss this: 99designs/gqlgen#1126
Adrien D.
@dtrckd
Hello. Is it possible to access a Resolver object from within a directive handle ?
I only see the parameter next graphql.Resolver...
Adrien D.
@dtrckd
...or the gqlgen Config object (which typically contains the Resolvers) ?
Adrien D.
@dtrckd
... As I am asking about directives management, I take this opportunity to ask, do the directive function handlers are executed in parallel ? What would be a good approach to use object shared by all the handlers, and call a final method when all directives passed to kind of "reduce" the result ?
John Forstmeier
@forstmeier

Hi everyone, I've getting started using gqlgen and I had a couple questions on configuration:

  • Under what circumstances is a schema.resolvers.go file generated?
  • Is it possible to control the naming/location of this output file?
  • Where can I find an example YML file that contains all of the settings options available? E.g. other options for the resolver.layout: follow-schema field.

I also have just a general question on GraphQL:

  • Is there a way to set a default value for one of the fields on an input type? E.g. with two mutations one for creating a user on an application having the default role set to USER and another where a user is created as part an org being created in which case their role is set to ADMIN.