Skip to content

Validate household variables and publish OpenAPI spec#1497

Merged
anth-volk merged 3 commits into
mainfrom
codex/validate-household-variables
May 7, 2026
Merged

Validate household variables and publish OpenAPI spec#1497
anth-volk merged 3 commits into
mainfrom
codex/validate-household-variables

Conversation

@anth-volk
Copy link
Copy Markdown
Collaborator

Fixes #1496

Summary

  • validate household input and axis variable names before calculation, returning HTTP 400 with errors: string[] for unsupported variables
  • deep-copy household payloads when dropping deprecated allowlisted inputs, preserving existing warning behavior without mutating caller data
  • expose /specification and expand the calculate OpenAPI contract with request, success, and error schemas/examples

Tests

  • .venv/bin/python -m pytest -q tests/unit/endpoints/test_home.py tests/unit/endpoints/test_household.py tests/unit/utils/test_deprecated_inputs.py tests/unit/utils/test_variable_validation.py
  • .venv/bin/ruff check policyengine_household_api/api.py policyengine_household_api/endpoints/home.py tests/unit/endpoints/test_home.py

@anth-volk anth-volk marked this pull request as ready for review May 7, 2026 00:40
@anth-volk anth-volk requested a review from hua7450 May 7, 2026 00:40
@anth-volk anth-volk merged commit d087efe into main May 7, 2026
3 checks passed
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.

Validate household variables and document calculate OpenAPI schema

1 participant