Khan / Khan/genqlient

Add request and response cases for `Optional` values

Open
#242 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
1.3k
Forks
144
Avg merge
4h 50m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**
Currently I'm using the Go default values for a response in a lot of fields. But currently I need to to send a **pointer** for optional values, and still receive the **value** as the response.

**Describe the solution you'd like**
On the file `genqlient.yaml` have a new config that receives the option that will be used on optional on request, and another option on response.

**Describe alternatives you've considered**
On the genqlient.yaml have the following alternatives:
```yaml
optional:
request: pointer
response: value # use value as default if empty
```

Alternative
```yaml
request:
optional: pointer
use_struct_references: true
response:
optional: value
use_struct_references: false
```

Contributor guide

Open the contributing guide

Research direction

Start with the genqlient.yaml configuration described in the issue and trace how optional fields are represented in generated request and response types. The work is done when separate request and response options support pointer input and value output, with tests covering both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, graphql
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.