Skip to content

feat(client): add shape/flat/flat_lists to reference-data endpoints#43

Merged
vdavez merged 1 commit into
mainfrom
feat/reference-data-shape-params
Jun 4, 2026
Merged

feat(client): add shape/flat/flat_lists to reference-data endpoints#43
vdavez merged 1 commit into
mainfrom
feat/reference-data-shape-params

Conversation

@makegov-mark
Copy link
Copy Markdown
Contributor

@makegov-mark makegov-mark Bot commented Jun 4, 2026

Summary

  • The tango API has always supported the shape system on NaicsCodeViewSet, ProductServiceCodeViewSet, AssistanceListingViewSet, BusinessTypesViewSet, and MasSinsViewSet (all use ShapeOnDemandMixin), but the SDK didn't expose shape / flat / flat_lists on the corresponding methods.
  • Adds the three pass-through params to ten 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.
  • When shape is omitted the API applies its own per-resource default (e.g. code,description for NAICS list, name,code for business_types) — existing callers see no behavior change. list_business_types returns raw dicts when a shape is supplied, otherwise still yields BusinessType instances.
  • Agencies/offices/departments deliberately left out of scope.

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 expose shape whenever the viewset uses ShapeOnDemandMixin / ShapedByDefaultMixin.

Test plan

  • uv run ruff format . + uv run ruff check .
  • uv run mypy tango/ — strict, clean
  • uv run pytest tests/ -m "not integration" --ignore=tests/production — 300 passed
  • uv run python scripts/check_filter_shape_conformance.py --manifest ../tango/contracts/filter_shape_contract.json — no errors
  • Smoke against live API once merged (production-smoke saw an unrelated 504 locally)

Risks

  • Public-surface addition only (new optional kwargs with None / False defaults) — non-breaking.
  • list_business_types return type widens to BusinessType | dict when callers opt into shape; the annotation was already unparametrized PaginatedResponse, so existing typed callers are unaffected.

Next steps

  • Optional follow-up: teach the conformance script to verify shape-param exposure so this class of drift can't recur.

~ Mark

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>
@vdavez vdavez merged commit c3c03af into main Jun 4, 2026
12 checks passed
@vdavez vdavez deleted the feat/reference-data-shape-params branch June 4, 2026 22:10
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