feat(client): add shape/flat/flat_lists to reference-data endpoints#43
Merged
Conversation
The tango API has always supported the shape system on NAICS, PSC, Assistance Listings, Business Types, and MAS SINs viewsets (all use `ShapeOnDemandMixin`), but the SDK's list/get methods for these resources didn't expose `shape` / `flat` / `flat_lists`. Adds the three params to: list_naics/get_naics, list_psc/get_psc, list_assistance_listings/ get_assistance_listing, list_business_types/get_business_type, and list_mas_sins/get_mas_sin. When `shape` is omitted, the API applies its own per-resource default — existing callers see no behavior change. `list_business_types` returns raw dicts when a shape is supplied so the caller gets exactly the shape requested (otherwise still yields `BusinessType` instances). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
NaicsCodeViewSet,ProductServiceCodeViewSet,AssistanceListingViewSet,BusinessTypesViewSet, andMasSinsViewSet(all useShapeOnDemandMixin), but the SDK didn't exposeshape/flat/flat_listson the corresponding methods.list_naics/get_naics,list_psc/get_psc,list_assistance_listings/get_assistance_listing,list_business_types/get_business_type,list_mas_sins/get_mas_sin.shapeis omitted the API applies its own per-resource default (e.g.code,descriptionfor NAICS list,name,codefor business_types) — existing callers see no behavior change.list_business_typesreturns raw dicts when ashapeis supplied, otherwise still yieldsBusinessTypeinstances.Why
NAICS was missing
shape, and a sweep of the tango viewsets found four other reference-data resources in the same boat. The existing conformance script (scripts/check_filter_shape_conformance.py) only validates filter parameters, not shape support, so this drift was invisible. A follow-up can extend that script to assert SDK methods exposeshapewhenever the viewset usesShapeOnDemandMixin/ShapedByDefaultMixin.Test plan
uv run ruff format .+uv run ruff check .uv run mypy tango/— strict, cleanuv run pytest tests/ -m "not integration" --ignore=tests/production— 300 passeduv run python scripts/check_filter_shape_conformance.py --manifest ../tango/contracts/filter_shape_contract.json— no errorsRisks
None/Falsedefaults) — non-breaking.list_business_typesreturn type widens toBusinessType | dictwhen callers opt intoshape; the annotation was already unparametrizedPaginatedResponse, so existing typed callers are unaffected.Next steps
~ Mark