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

Add support for maps rather than using a scalar as a workaround #4

Closed
vtolstov opened this issue Apr 29, 2019 · 4 comments
Closed

Add support for maps rather than using a scalar as a workaround #4

vtolstov opened this issue Apr 29, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@vtolstov
Copy link

how to avoid this piece of code?

if err != nil {          
  panic("stupid map")    
}                        
@danielvladco
Copy link
Owner

Hi,

Sorry at the moment maps are not supported due to limitations of the graphQL. I added this stupid implementation as a quick solution to the problem...

I would try to avoid using maps with graphql if possible.

99designs/gqlgen#663 If this issue of gqlgen will be fixed I will be able to implement a map as a list of map entries and generate resolvers that translate the list into a go map.

@danielvladco danielvladco changed the title don't use panic Add support for maps rather than using a scalar as a workaround Apr 29, 2019
@vtolstov
Copy link
Author

thanks for info, i'm subscribe to gqlgen to check this issue

@danielvladco danielvladco added the enhancement New feature or request label May 3, 2019
@danielvladco
Copy link
Owner

If I manage to merge this PR, the issue will be pretty much fixed 99designs/gqlgen#1404

@danielvladco
Copy link
Owner

Added map support as an array of entry types.
Check for example:
https://github.com/danielvladco/go-proto-gql/blob/master/example/codegen/pb/constructs.graphqls#L281-L284
https://github.com/danielvladco/go-proto-gql/blob/master/example/codegen/pb/constructs.graphqls#L273

However if you wish to generate go-lang bindings as well, instead of using the official github.com/99designs/gqlgen generator you will need to use this fork github.com/danielvladco/gqlgen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants