I have a schema design question. My object graph is a DAG with a few potential root types. I have been exposing those root objects as queries, but I find myself now replicating the same set of args on the object and the corresponding query, e.g. for queries by indexed fields, and it feels redundant. I almost want to introduce a single synthetic root query and have all of the root object types available off of it to eliminate this redundancy. Has anyone else experienced this dissonance? I can’t tell if I’m using graphql poorly or if this is just a typical redundancy.
Do you mean you can query your objects by any and all their fields?
You aren’t able to share attributes between input objects (your query arguments) and the returned objects - but you could easily write some Clojure code to do it for you.
That is, construct the schema programmatically
There are a subset of fields which are both arguments for filtering objects as well as arguments for filtering their corresponding queries… so these queries are just pure projections of their corresponding objects.
Yeah if you get annoyed by repetition I’d just write some code that patches up the schema Lacinia expects with the repetitive stuff. Not sure if there are any hooks for this, but you don’t exactly need them.
Sorry if I’m being vague, typing on a phone :)