Skip to content

Migrate to Geocodio API v2#4

Merged
MiniCodeMonkey merged 2 commits into
mainfrom
feat/api-v2
Jun 5, 2026
Merged

Migrate to Geocodio API v2#4
MiniCodeMonkey merged 2 commits into
mainfrom
feat/api-v2

Conversation

@MiniCodeMonkey

Copy link
Copy Markdown
Member

Summary

Migrates the Geocodio CLI to the Geocodio API v2. This is a breaking change targeting release v3.0.0 (tagging/release will be done separately — not in this PR).

Changes

  • Default base URL: https://api.geocod.io/v1.9https://api.geocod.io/v2 (internal/config/config.go).
  • Removed top-level input object from /geocode and /reverse responses. The parsed address now lives in each result's address_components (removed GeocodeInput type and the Input field on GeocodeResponse in internal/api/types.go).
  • Renamed address_components keys (JSON tags + Go field names):
    • zippostal_code (ZipPostalCode)
    • statestate_province (StateStateProvince)
    • secondaryunitunit_type (SecondaryUnitUnitType)
    • secondarynumberunit_number (SecondaryNumberUnitNumber)
  • Test fixtures: updated all go-vcr cassettes (internal/api/testdata/*.yaml) — request URIs v1.9v2 and response bodies transformed to the v2 shape (top-level input removed, address keys renamed). The list-job status.state field is unrelated and was left untouched. Bumped the hardcoded base URL in internal/api/testutil_test.go.
  • Added CHANGELOG.md with a v3.0.0 entry dated 2026-06-05.

Notes

  • The CLI accepts a single address string for input, so there was no structured state input parameter to alias to state_province.
  • README.md had no API URL or response-JSON examples referencing v1.9 or the old keys (its v1.x/v2.x references are about the CLI version), so no README changes were needed.

Verification

  • make test (go test -race ./...): all packages pass — 190 tests, 0 failures, 0 skips. Tests are cassette replay-only, so no API key is required.
  • make build: succeeds.

Breaking changes for the Geocodio API v2 migration:

- Change default base URL from https://api.geocod.io/v1.9 to
  https://api.geocod.io/v2.
- Remove the top-level `input` object from /geocode and /reverse
  responses; the parsed address now lives in each result's
  address_components.
- Rename address_components keys: zip -> postal_code,
  state -> state_province, secondaryunit -> unit_type,
  secondarynumber -> unit_number (Go fields renamed to match).
- Update go-vcr cassettes: request URIs v1.9 -> v2, response bodies
  transformed to the v2 shape (input removed, keys renamed); list job
  status `state` left untouched.
- Add CHANGELOG.md entry for v3.0.0.
The integration-test fixtures in testdata/*.json still carried the
v1 shape (top-level input object, zip/state/secondaryunit/
secondarynumber keys). Tests passed only because assertions don't
touch the renamed component fields. Bring them in line with v2:
remove top-level input, rename address_components keys to
postal_code/state_province/unit_type/unit_number.
@MiniCodeMonkey MiniCodeMonkey merged commit de44169 into main Jun 5, 2026
4 checks passed
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