Add mapbox matrix - #48
Open
mattpodwysocki wants to merge 1 commit into
Open
mattpodwysocki wants to merge 1 commit into
mattpodwysocki wants to merge 1 commit into
Conversation
This was referenced Sep 24, 2026
mattpodwysocki
force-pushed
the
feat/map-matching-api
branch
from
September 25, 2026 14:56
21ec4b4 to
232803a
Compare
mattpodwysocki
force-pushed
the
feat/matrix-api
branch
from
September 25, 2026 15:01
6d0181f to
fde2abd
Compare
Fourth of the Navigation-category APIs with no prior CLI coverage. Same
shape as directions/isochrone/map-matching: hand-authored into
custom-openapi/ since openapi-specs has no spec for this API either,
reusing ARG_NAME_OVERRIDES for the same profile-vs-global-flag collision
(fourth row, not a fourth mechanism).
Named `compute` rather than the API-naming doc's proposed `get`, matching
the precedent set by the three commands before it (route/contours/match) —
this returns a matrix computed fresh from the request, not a stored
resource.
Verified a real discrepancy against production while testing: the API
answers a comma-separated --sources/--destinations list with a 422
("may be \"all\" or semicolon-separated list of 0-based integer indices"),
unlike this CLI's own convention elsewhere of comma-separating index lists.
Documented in the spec and in --help, not just discovered and left as a
surprise.
Also fixes a --help truncation on --fallback-speed ("Legacy." as a leading
sentence, same class of bug as directions.yaml's earlier ones) by moving
the qualifier to the end of the description.
Smoke-tested against production: a full 3x3 matrix and a subsetted 1x2
matrix via --sources/--destinations, both verified to return the
documented shape.
487 tests, fmt and clippy clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mattpodwysocki
force-pushed
the
feat/matrix-api
branch
from
September 25, 2026 15:02
fde2abd to
edb5d60
Compare
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.
Same stacking situation as #44 on #43 and #45 on #44. This reuses the
flattening mechanism (
spec::FLATTENED_SERVICES),ARG_NAME_OVERRIDES,and the
path_segment_for/UNESCAPED_PATH_PARAMSfix #43 introduces,since every one of these Navigation APIs'
profilepath parameter hitsthe same global-flag collision and needs the same free-form profile. Once
#43/#44/#45 merge in order, this should be retargeted to
main(gh pr edit --base main). Everything below is scoped to what this PR actuallyadds on top of #45.
What
mapbox matrix, the fourth Navigation-category API with no prior CLIcoverage. Same shape as #43/#44/#45: hand-authored into
custom-openapi/since openapi-specs publishes no spec for it either.
No subcommand: like
mapbox directions,mapbox isochrone, andmapbox map-matching, this API has one operation, so there's nothing a secondword (the old
compute) would disambiguate. Same shapemapbox usagealready has.
Travel time and/or distance between every pair in a set of up to 25
coordinates, in one call. An N×N table, useful for ranking or filtering
many candidates by reachability before committing to a route through any
of them (as opposed to
mapbox directions, a route through fixed stops inorder).
Routing profile is free-form here too
Same fix as #43, #44, and #45: an earlier version of this command
validated
profileagainst the four documented values client-side, via aclap enum. Some OEM accounts have additional profiles that aren't
published, so that validation would have broken this command for exactly
the accounts that most need it.
profileis now sent exactly as typed,and reaches the URL unescaped through
UNESCAPED_PATH_PARAMS(
("matrix", "profile")).A real discrepancy found and documented, not just worked around
--sources/--destinationstake semicolon-separated indices, not comma,confirmed by testing, not assumed. A comma-separated list gets a 422 from
the live API (
"may be \"all\" or semicolon-separated list of 0-based integer indices"), which is the opposite of most other index/value listson this CLI's Navigation commands. Documented in the spec's own
description and in
docs/commands.md, called out explicitly rather thanleft as a surprise for the next person to hit.
Also fixes a
--helptruncation on--fallback-speed("Legacy."as aleading sentence, same class of bug fixed in
directions.yamlearlier),by moving the qualifier to the end of the description.
Verification
Smoke-tested against production: a full 3x3 matrix and a subsetted 1x2
matrix via
--sources/--destinations, both verified to return thedocumented shape, plus the bare
mapbox matrixcommand shape itself (nosubcommand accepted,
--schemareflects the new name).490 tests,
cargo fmt --checkandcargo clippy --all-targets -- -D warningsboth clean.🤖 Generated with Claude Code