Skip to content

feat: add --api-version to opt into the v4beta channel - #18

Open
mrwny wants to merge 1 commit into
Google-Health-API:mainfrom
mrwny:feat/api-version-channel
Open

mrwny wants to merge 1 commit into
Google-Health-API:mainfrom
mrwny:feat/api-version-channel

Conversation

@mrwny

@mrwny mrwny commented Oct 8, 2026

Copy link
Copy Markdown

The CLI was hardwired to Health API v4, so new features that ship on the new v4beta channel first (starting with skin temperature) were unreachable, and GHEALTH_BASE_URL alone left schema reading the v4 discovery doc.

The active version now resolves from --api-version, GHEALTH_API_VERSION, the profile's api_version, then v4 (unchanged default). The base URL, discovery doc, discovery cache file and schema endpoint paths all follow it.

Gating is generic so upcoming beta types and commands need no extra plumbing: data types carry a Channel (with optional per-operation overrides), and any other command can opt in with a Cobra "channel" annotation. Beta-only items stay discoverable on v4, marked [beta] in help and schema, and fail with a validation error that hints at --api-version v4beta. An unknown ghealth data <type> is now a validation error instead of printing help with exit 0.

JSON data responses carry _api_version and auth status reports the resolved version, its source and the base URL, so agents can tell which channel answered.

The CLI was hardwired to Health API v4, so new features that ship on
v4beta first (starting with skin temperature) were unreachable, and
GHEALTH_BASE_URL alone left `schema` reading the v4 discovery doc.

The active version now resolves from --api-version, GHEALTH_API_VERSION,
the profile's api_version, then v4 (unchanged default). The base URL,
discovery doc, discovery cache file and `schema` endpoint paths all
follow it. GHEALTH_BASE_URL still wins for the URL; when it ends in a
known version that version becomes the active channel, and a
conflicting explicit choice is rejected.

Gating is generic so upcoming beta types and commands need no extra
plumbing: data types carry a Channel (with optional per-operation
overrides), and any other command can opt in with a Cobra "channel"
annotation. Beta-only items stay discoverable on v4, marked [beta] in
help and `schema`, and fail with a validation error that hints at
--api-version v4beta. An unknown `ghealth data <type>` is now a
validation error instead of printing help with exit 0.

JSON data responses carry `_api_version` and `auth status` reports the
resolved version, its source and the base URL, so agents can tell which
channel answered. No data types are added here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant