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

Adds default custom scalar of interface{} #686

Merged
merged 5 commits into from
May 8, 2019
Merged

Conversation

qhenkart
Copy link
Contributor

@qhenkart qhenkart commented Apr 22, 2019

Given that the Map default custom scalar is automatically provided of map[string]interface{}, it seemed strange to me that interface{} itself has no scalar. These seems like a common (albeit not optimal) enough design pattern in Go that it should be included. At first I thought it might push people not to strictly type their schema, but since Map is supported, I don't see any reason why this shouldn't be.

I didn't add and link an issue because of the simplicity of this PR

I have:

  • [] Added tests covering the bug / feature (see testing)
    I can add tests if they are deemed necessary, but the other custom scalars don't have any, and this particular scalar is much simpler
  • Updated any relevant documentation (see docs)

@vektah
Copy link
Collaborator

vektah commented May 1, 2019

I'm on the fence about this, Map and Time are universal, Interface is leaking goisms.

OTOH I can see it might be useful.

Any thoughts @mathewbyrne?

@mathewbyrne
Copy link
Contributor

I don't love the name Interface in GraphQL since it's a Go-ism, we're thinking maybe Any instead?

@qhenkart
Copy link
Contributor Author

qhenkart commented May 1, 2019

@vektah @mathewbyrne I originally went with Untyped (that's what I ended up calling my custom scalar anyway). I wasn't sure what direction you guys would would want to take so I went with Interface for the PR. Any flows really nicely when writing out the schema, and is actually more of a noun than untyped which is more of an adjective. I will switch it to Any.

@vektah vektah merged commit 4e359aa into 99designs:master May 8, 2019
@vektah
Copy link
Collaborator

vektah commented May 8, 2019

Awesome, thanks for the PR.

@JulienBreux
Copy link

👏 @qhenkart for work and 🙏 @vektah for merge!

@vektah vektah added the v0.9 Fixed in 0.9.0 label May 15, 2019
cgxxv pushed a commit to cgxxv/gqlgen that referenced this pull request Mar 25, 2022
Adds default custom scalar of interface{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v0.9 Fixed in 0.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants