Repository navigation
Read mapbox usage's spec from openapi-specs, and add --dimensions - #115
Merged
Merged
Conversation
The Statistics API team now publishes the spec in openapi-specs (mapbox/api-analytics/openapi/statistics-api.yaml). It is vendored into openapi/ by the maintainer sync like every other spec, and replaces the hand-written custom-openapi/statistics/ copy. Its new dimensions parameter becomes --dimensions, since the pinning test requires every spec parameter to have a flag. Without the flag the request is unchanged.
mattpodwysocki
approved these changes
Oct 23, 2026
mattpodwysocki
left a comment
Contributor
There was a problem hiding this comment.
Thanks Mofei, this is a nice cleanup. Dropping the hand-written spec for the upstream one is where we wanted to end up, and I like that a request without --dimensions stays byte-for-byte the same, with a test pinning it.
A few small things, none blocking:
- The comment above the
is_booleanbranch infetchstill says "today's three parameters". It's four now. - Could
--dimensionsget a clap value parser (comma delimiter plusbrowsers/countries/hostsas possible values)? A typo would then fail right away instead of costing a round trip and a 422, and the values would show up in help and completions. - The 422 hint mentions
--dimensionseven when it wasn't passed. Fine as is, but it could check whether the flag was set. - The sample JSON in
docs/commands.mdpredates the opt-in breakdown. The note covers it, but a fresh capture would be nicer when you get a chance.
Approving, happy to see these in a follow-up.
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.
The Statistics API team now publishes the spec in openapi-specs (
mapbox/api-analytics/openapi/statistics-api.yaml). It is vendored intoopenapi/by the maintainer sync like every other spec, and replaces the hand-writtencustom-openapi/statistics/copy.The spec adds a
dimensionsquery parameter, and the API returns the per-browser/country/host breakdown only when asked.mapbox usagegets a matching--dimensionsflag: the pinning test requires every spec parameter to have one, and without it a debug build panics onmapbox usage. Without the flag the request is unchanged. The text tips and the 422 hint now mention--dimensions.Verified against the real API with a dev build: without the flag the request is the same as before and each product's
dimensionsis{};--dimensions hostsreturns onlyhosts; an invalid value returns 422 with the message the spec documents. Not verified: the content of a non-empty breakdown, because the test account's requests have no host, browser or country.