Open
Description
Summary
To allow
create or replace function app._last_events(app.project, count int) returns ...
to be natively used like
query GetProjects {
projectCollection {
edges { node { id code name lastEvents(count: 1) } }
}
}
Rationale
To allow for a richer computed fields resolution logic.
Design
We already analyze computed field functions signatures to insert them into the schema.
I believe we could as well detect function argument name and type and auto-add schema input fields for additional arguments.
Drawbacks
Don't see any.
Alternatives
Certainly we can pass additional info down to computed field resolver via global variables
by doing
set_config('graphql.vars', $1->>'variables', true)
in app.graphql()
and using
coalesce(current_setting('graphql.vars', true)::jsonb->>'count', '1')::int
in the computed field function.
The above is just a lot of hackish plus it pushes to pass data beside the schema and bypasses input validation.