hasura / hasura/graphql-engine

Support composite types and/or generate input types for Postgres custom function INPUT args.

Open
#7,078 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Currently custom function input arguments are treated as "args" instead of "objects". This prevents the use of an array of objects to construct multiple distinct custom function mutations in a single request.

This may be partially solved by generating an input type based in the arguments to the custom function AND/OR allowing the use of custom Postgres (composite) types as input(s) to functions.

pseudo:
`mutation CustomFunction($objects: [cool_custom_function_input!] = {}) {
coolCustomFunction(objects: $objects) {
whatevs
}
}`

If a composite type is supplied as an argument to a custom function, Hasura will track the function but treats the composite input arg as a scalar String type.

Adjunct to this request is to allow for additional strong typing of input arguments wrt enums (hasura and/or postgres "enums").

Contributor guide

Open the contributing guide

Research direction

Start by tracing custom function tracking and generated GraphQL input handling, then inspect how PostgreSQL composite and enum arguments are represented. Reproduce the shown mutation with a composite argument and verify whether an array of distinct objects can be accepted with strong input typing. Clarify whether input-type generation, composite support, and enum typing are all required before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgres
Domain
api, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.