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

Resolver wrapper should not check for sequential for custom scalar types #38

Closed
brendanyounger opened this issue Apr 12, 2017 · 4 comments

Comments

@brendanyounger
Copy link
Contributor

I added a custom JSON scalar type to my schema and I cannot return a JSON array because of the check for sequential values here:

single-result-wrapper (fn [resolved-value next-selector callback]

While this is useful for debugging, it shouldn't be applied to custom scalar types.

@hlship
Copy link
Member

hlship commented May 9, 2017

We'll need to look into using type information to figure out whether to map the results or just use the single result. Should not be impossible.

@hlship
Copy link
Member

hlship commented May 10, 2017

So you are returning a value, but it looks like an array to Lacinia, but you have a scalar for the value type such that it can be serialized into the response as is. Right?

This is, to me, an odd edge case.

Could you wrap your JSON value in a wrapper that isn't a sequential, and have your :serializer extract the nested value?

@brendanyounger
Copy link
Contributor Author

That is correct, I had a scalar JSON type that I was using which was sometimes an array. I wound up wrapping it like you suggested as a work-around. I was just surprised by the error.

It might help to have an example of this in the documentation to clarify when the :serializer functions are run.

@hlship
Copy link
Member

hlship commented Nov 2, 2017

I think this is a wont/cant fix.

@hlship hlship closed this as completed Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants