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
Support for Dict types #55
Comments
Unfortunately, while Since there isn't a way to express them as a GraphQL output, I'm not sure how we'd support them? |
@necaris thanks! I am (obviously) a bit of a GraphQL newbie. So many of my existing pydantic models involve dicts today, that I'll have to go back an assess. In case anyone in the future sees this, using exclude_fields seems to get me running, something like:
|
I closed this, but I will add that it would super helpful if the ConversionError output the class and field that are problematic. |
@dylanmcreynolds I know you closed this awhile ago, but in case you're still trying to figure it out. ;) Basically, you need to exclude the
It's a little more loosy than a pure dict, since from GQL's perspective it can be anything (null, boolean, int, string, list, object), but it does have the benefit of returning your dictionary in the JSON result. It's just treated in GQL as a scalar, meaning you can't use Hope this helps! |
In the following example, add the foo: Dict[str, str] member to Person model causes an error. Is there another way that I can use a Dict, which works great in pydantic?
The text was updated successfully, but these errors were encountered: