Migrate to Geocodio API v2#4
Merged
Merged
Conversation
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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
https://api.geocod.io/v1.9→https://api.geocod.io/v2(internal/config/config.go).inputobject from/geocodeand/reverseresponses. The parsed address now lives in each result'saddress_components(removedGeocodeInputtype and theInputfield onGeocodeResponseininternal/api/types.go).address_componentskeys (JSON tags + Go field names):zip→postal_code(Zip→PostalCode)state→state_province(State→StateProvince)secondaryunit→unit_type(SecondaryUnit→UnitType)secondarynumber→unit_number(SecondaryNumber→UnitNumber)internal/api/testdata/*.yaml) — request URIsv1.9→v2and response bodies transformed to the v2 shape (top-levelinputremoved, address keys renamed). The list-jobstatus.statefield is unrelated and was left untouched. Bumped the hardcoded base URL ininternal/api/testutil_test.go.CHANGELOG.mdwith a v3.0.0 entry dated 2026-06-05.Notes
stateinput parameter to alias tostate_province.README.mdhad no API URL or response-JSON examples referencingv1.9or the old keys (itsv1.x/v2.xreferences 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.