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

Argument deserialization #56

Open
mstijak opened this issue Oct 19, 2016 · 3 comments
Open

Argument deserialization #56

mstijak opened this issue Oct 19, 2016 · 3 comments

Comments

@mstijak
Copy link

mstijak commented Oct 19, 2016

I'm playing with graphql-net and I really like it.
One thing that I can't figure out is how args are deserialized.
It seems that camelCase/pascalCase conversion is not working for args.
Also, is it possible to get a plain JSON object (patch)?

patchUser(id: 1, patch: { displayName: "X" }) {
  id,
  displayName
}

A patch would be very useful as it includes information which fields should be updated. That's not available with strongly typed models.

@mstijak mstijak changed the title Patch arguments Argument deserialization Oct 19, 2016
@chkimes
Copy link
Owner

chkimes commented Oct 20, 2016

Currently, args do not undergo any name transformation like properties do. There's not a particular reason for this, and I'm open to changing it.

We do support input objects (https://facebook.github.io/graphql/#sec-Input-Values), but we may not handle optional fields very well. Deserializing an input object with arbitrary fields (say to a Dictionary<string, object>) is not currently supported, but also would not be terribly hard to do.

@mstijak
Copy link
Author

mstijak commented Oct 20, 2016

Do you have any plans for working on a feature like this?
I'm not very familiar with the codebase yet, but I'll look into it and try to hack something on my own. Would you accept a PR if it works out?

@chkimes
Copy link
Owner

chkimes commented Oct 21, 2016

I think adding deserialization to a Dictionary is a sensible thing to do. We've considered how to handle optional fields when deserializing to an object and it's a bit tricky, since I think we would need to introduce our own attributes and reflect over them (e.g. how to handle non-nullable reference types).

Also, I'm happy to accept any PRs that add features within the scope of the project.

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

No branches or pull requests

2 participants