Merge 1d6f006820a443ac3fccc3840aec1f2011557de9 into 52d094d416ea0f4e0196f0a063df49646ee2d094
fdb16af4
pull/263/merge
85/3,172 ++ 181 --
Replace per-class file structure (algod/82 files + indexer/72 files + kmd/54 files + 3 __init__.py) with one module per client (algod.py, indexer.py, kmd.py). Benefits: - 211 files → 3 files - Eliminates __init__.py boilerplate (imports, model_rebuild, __all__) - Eliminates forward reference strings — topological sort enables direct class references - from __future__ import annotations handles remaining edge cases - No ruff per-file overrides needed (was 9 suppressed rules) - Import paths unchanged: `from tests.fixtures.schemas.algod import X` Generator improvements: - Topological sort of schemas by dependency order - PascalCase class names (ed25519PublicKey → Ed25519PublicKey) - Docstring escaping and truncation for ruff compliance - Cleaner module assembly — shared imports at top
Replace per-class file structure (algod/82 files + indexer/72 files + kmd/54 files + 3 __init__.py) with one module per client (algod.py, indexer.py, kmd.py). Benefits: - 211 files → 3 files - Eliminates __init__.py boilerplate (imports, model_rebuild, __all__) - Eliminates forward reference strings — topological sort enables direct class references - from __future__ import annotations handles remaining edge cases - No ruff per-file overrides needed (was 9 suppressed rules) - Import paths unchanged: `from tests.fixtures.schemas.algod import X` Generator improvements: - Topological sort of schemas by dependency order - PascalCase class names (ed25519PublicKey → Ed25519PublicKey) - Docstring escaping and truncation for ruff compliance - Cleaner module assembly — shared imports at top
Snapshots now use enum .value ("noop") instead of repr
("<OnCompletion.NOOP: 'noop'>") to match the corrected
_dataclass_to_dict serializer. Only enum formatting changed —
no mock server data diffs.
- Refactor generate_schema() to extract _root_model() and _is_byte_array() helpers, eliminating 3 copies of identical RootModel[str] template - Fix missing newline at EOF in 6 docs/config files (pre-commit)
- Refactor generate_schema() to extract _root_model() and _is_byte_array() helpers, eliminating 3 copies of identical RootModel[str] template - Fix missing newline at EOF in 6 docs/config files (pre-commit) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mirrors the TypeScript variant's pattern of calling Schema.parse(result) in every polytest to validate real API responses against OAS-generated schemas, closing the gap between spec and implementation. Schema generator improvements: - Use IdentifierSanitizer-compatible _to_snake() for field naming (handles camelCase, Python builtins, x-algokit-field-rename) - Handle string/enum types as RootModel[str] - Handle byte arrays (uint8[]) as RootModel[str] (base64) - Handle opaque empty schemas as RootModel[str] Polytest changes: - Added validate_with_schema() to 55 polytests across algod, indexer, and kmd clients - Serializer now handles Python Enum values correctly - Updated snapshots for enum serialization changes - 1 known OAS spec mismatch documented (apps-local-states required but API returns null) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mirrors the TypeScript variant's pattern of calling Schema.parse(result) in every polytest to validate real API responses against OAS-generated schemas, closing the gap between spec and implementation. Schema generator improvements: - Use IdentifierSanitizer-compatible _to_snake() for field naming (handles camelCase, Python builtins, x-algokit-field-rename) - Handle string/enum types as RootModel[str] - Handle byte arrays (uint8[]) as RootModel[str] (base64) - Handle opaque empty schemas as RootModel[str] Polytest changes: - Added validate_with_schema() to 55 polytests across algod, indexer, and kmd clients - Serializer now handles Python Enum values correctly - Updated snapshots for enum serialization changes - 1 known OAS spec mismatch documented (apps-local-states required but API returns null)
- Generator: required fields no longer get default=None (Pydantic actually validates them now) - Generator: only emit `from typing import Any` when used - Generator: add timeout and error handling to fetch_spec - Docs: fix stale import paths in README.md and VALIDATION.md after schema move to tests/fixtures/ - Lint: revert global PLC0415/FBT001/FBT002/PLW1641 suppression, restore targeted noqa comments on specific lines - Tests: provide all required fields, add test_missing_required_fields - Snapshots: update mock server snapshots to match current HAR data Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Generator: required fields no longer get default=None (Pydantic actually validates them now) - Generator: only emit `from typing import Any` when used - Generator: add timeout and error handling to fetch_spec - Docs: fix stale import paths in README.md and VALIDATION.md after schema move to tests/fixtures/ - Lint: revert global PLC0415/FBT001/FBT002/PLW1641 suppression, restore targeted noqa comments on specific lines - Tests: provide all required fields, add test_missing_required_fields - Snapshots: update mock server snapshots to match current HAR data
Implements runtime validation of API client responses using Pydantic schemas. This provides an additional layer of sanity checks on top of generated API clients. The schemas are generated from OpenAPI specifications using a new script. Adds a new `poe` task to easily regenerate schemas. Adds tests to validate the generated schemas. Pydantic is added as a development dependency. Validation schemas are optional, requiring `pydantic>=2.0` to be installed.
Bumps [setuptools](https://github.com/pypa/setuptools) from 80.9.0 to 82.0.1. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v80.9.0...v82.0.1) --- updated-dependencies: - dependency-name: setuptools dependency-version: 82.0.1 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>