Closed madiganz closed 1 year ago
@madiganz could you clarify the usage/examples?
Currently there is no way, and I think it would break the behavior since we just use __to_json_value__()
to create the payload to be sent in the variables block sent to the server.
You could dynamically patch some of the basic classes to wrap the provided method with an extension, but I don't think it fits in the library. But if you share some reasonable use case, this could be done without much trouble.
An example could be that I query data from my GraphQL API, then I get some data from an external source and want to add it to the type without creating an entirely new wrapper type.
I was able to solve this by creating a to_json
wrapper that calls __to_json_value__()
ok, I'll close this issue. If possible share some example on how you did, so if someone reaches this issue they can see how you solved it.
I have a couple of cases where I am adding extra data onto the schema types. I would like this data to still be JSON serializable via
__to_json_value__()
. Is it possible to have new properties added to the class so that they are also serializable and added to the___json_data___
property?Basically what I'm trying to do is have non-graphql attributes be accessible through
__to_json_value__()
.