-
Notifications
You must be signed in to change notification settings - Fork 427
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
JSON Object/Map is not a valid input type #509
Comments
Why not just use a regular structured input type? |
Because I want to send something like: |
You could do something like this: mutation {
foo(pairs: [Pair!]!): Boolean
}
type Pair {
key: String!
value: String!
} |
Cool! That's may help in my project. But I still hope that JSON Scalar in Input can be in consideration. |
Wait, still get the
Error:
|
This works for me # Schema. You'll have to translate this into rust yourself but it should be pretty straight forward
type Mutation {
foo(pairs: [Pair!]!): Boolean!
}
input Pair {
key: String!
value: String!
}
# Query
mutation {
foo(pairs: [{key: "foo", value: "bar"}, {key: "foo", value: "bar"}])
} Regarding allowing raw JSON as input type. I guess it would make sense if the spec says so, otherwise I would be reluctant to adding it. What do you think @theduke @LegNeato? |
Now it works! It seems that there are some problems when writing a Scalar manually, so I just change the data structure. Sorry for bothering :-) |
See graphql/graphql-spec#584 for the RFC to support this I believe. I haven't seen where that RFC ended up though. |
Also graphql/graphql-spec#627. |
Well, I think those are two different things. The RFC want to implement ADT in GraphQL DSL, which is way much harder. What I'm wanting is just a general JSON scalar type |
In fact, #325 is exactlly what I want, hoping this PR can move on... |
Describe the bug
In GraphQL Java, JSON Scalar is supported, so I can write the following query:
But the same code in juniper will throw an error:
So JSON Object in input is not suppoerted yet?
The text was updated successfully, but these errors were encountered: