growthbook / growthbook/cli

Nullable scalar fields generate as JSON flags — bare strings and RFC3339 dates rejected

Open
#50 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1
Forks
0
Avg merge
1d 5h
Merged PRs (30d)
18

Description

**Behavior:** nullable scalar body fields (spec `anyOf: [string|date-time, null]`) generate as `FlagKindJSON`, so bare values fail flag-parse: `--base-config sweep-cfg-a` → `invalid character 's'`, `--start-date 2027-01-01T00:00:00Z` → `invalid character '-'`. Only JSON-quoted values (`'"…"'`) worked. Affected (verified): `--base-config`, `--default-value-config` (features create/update), `--start-date`/`--cutoff-date` (ramp-schedules create/update), `--scheduled-publish-at` (feature-revisions request-review), `--population-id`, `--entity-id` (nullable variants). The same spec property can bind differently per op (schedule-publish got `FlagKindDateTime`; request-review's nullable variant got JSON).

**Root cause:** the generator maps `OptionalNullable[time.Time]` / nullable strings to `FlagKindJSON` instead of the scalar flag kinds.

**Carried fix:** `.speakeasy/patches/internal/flagutil/metadata.go.patch` (PR #48) — `buildJSONField` re-interprets invalid JSON as a JSON string, so bare scalars parse; object/array targets still type-error as before.

**Retire when:** the generator dispatches nullable scalars to their scalar flag kinds (string/datetime) instead of JSON.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with .speakeasy/patches/internal/flagutil/metadata.go.patch and reproduce the listed CLI commands using bare strings and RFC3339 dates. Trace generator handling of OptionalNullable[time.Time] and nullable strings, then verify nullable scalars use string or datetime flags while object and array inputs still reject invalid JSON.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.