-
Notifications
You must be signed in to change notification settings - Fork 13
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
How to handle json data types? #52
Comments
Have you seen https://github.com/byme8/ZeroQL/wiki/User-scalars? If you want to create your own serialization for a custom scalar, you need to do the next steps:
// something like that
namespace MyCustom;
public class jsonb : JsonElement
{
}
Looks like you skipped the first and the last step. |
Thank you for your patience! We tired doing the first and last step you mentioned, but it did not work in our earlier attempts But we've figured it out. What we experienced: The project we were working in had only installed When we tried generating without the json file, using the --scalars arg, it gave us an error:
And told us it it was on v4.0. After installing the |
I suppose I need to add a validation so if some additional properties in zeroql.json are detected but not recognized the generation should fail. |
Is your feature request related to a problem? Please describe.
My graphQL has a JSON* field that I would like to handle; but I cannot find a way to do this with ZeroQL; haven't had much luck with custom serializers yet.
*(Technically JSONB; we are using Hasura w/ Postgres)
For example I'd like to turn this data:
{ "name": "john", "address": { "street": 1234, "zip": 45567, } }
and put it into a shape like:
So far we've tried the code below, but we haven't had any success. Was wondering if you had any examples you could share or could help us figure out what we are missing.
Out of the box the code generation creates this scalar in the generated code.
But we are unable to use it as it chokes on the opening curly brace ('StartObject') during deserialization.
So we have tried to create a custom converter, but we are unable to get any of the Console.WriteLine statements to occur; suggesting it's not registering correctly with ZeroQL?
The text was updated successfully, but these errors were encountered: