laravel-graphql icon indicating copy to clipboard operation
laravel-graphql copied to clipboard

Truely nested relation resolvers

Open lorado opened this issue 6 years ago • 1 comments

On defining mutable fields, it is currently possible to simply define which relation should be updated. Input type of this relation is automatically used, as input type of the defined field.

But what I faced today - for the relations transformation there is pretty simple code, that is not using something from definitions of this relation at all.

What I was trying: Let's say we have User and Location models. User can have many Locations. Location has a custom input "shape", which could be either a polygon, or simple point with lat/long and radius in meters, for creation circle on the map. On the server side this field is always converted so, that DB stores only polygons.

If I create Location directly, my custom input works properly. But when I am using nested mutation, it doesn't work, because relations transformation is processed on its own, and has nothing in common with definition.

So it would be really nice, when on defining custom input in definition, this custom input would be respected also on nested mutations (relations).

I did a quick look on code, and didn't find any quick solution. So what du you think? As idea - good/bad? And if its good, how would you like to implement it? May be if you could give me some advices, I could try to code it on my own

lorado avatar Mar 24 '19 23:03 lorado

I don't really understand the whole thing, neither have a lot of time to test, I'm sorry for this.

I don't know if it can help you, but we use GIS data in our app with a GeometryType like this.

drasill avatar Mar 26 '19 11:03 drasill