hasura / hasura/graphql-engine

Computed fields with all arguments with default values still require an arg object

Open
#8,525 2 comments 0 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.6.0

### Environment

OSS

### What is the expected behaviour?

When a custom field is using a function that has all additional args with default values, the generated schema should make the args object optional.

Enabling this creates a better story around backwards-compatibility when iterating over an existing resolver that was initially created without additional arguments.

### Keywords

computed field args

### What is the current behaviour?

The computed field requires an arg object even if all of the function arguments are optional.

### How to reproduce the issue?

1. Create a postgres function with the row argument and a second one that has a default value.
2. Attach function as computed field
3. attempt to use it without passing in the args object.

### Screenshots or Screencast

image

### If the bug is confirmed, would you be willing to submit a PR?

I do not have the knowledge needed to update a haskell codebase.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reproducing the issue with a PostgreSQL function used as a computed field, then trace how its generated GraphQL schema represents arguments. Done means the args object is optional when every additional function argument has a default value, while required arguments remain enforced.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, haskell, postgresql
Domain
api, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.