Repository navigation
fix(python-sdk): reject booleans for numeric schemas - #1696
Conversation
Reviewer's GuideImplementationExplicitly reject booleans for integer and number schemas because Python considers booleans instances of integers.
TestsCover boolean rejection for numeric schemas, acceptance of numeric values including zero, and acceptance of booleans by boolean schemas.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Automated title normalization could not complete. Please update this PR title manually using Conventional Commit format:
Allowed types: Examples: |
|
A note on the failing Normalize / Conventional title check: the workflow behind it (admin-pr-management.yml) only runs on the pull_request opened event, so this failure is from the title as it was when the PR was first opened. The current title matches the required pattern, but title edits do not retrigger the workflow, so the red check cannot clear by itself. Nothing in the PR content causes it. |
Linked issuesChecked at commit 31ecfd5 #1691 Bug: Schema guard accepts JSON booleans for numeric types · 3 of 3 met
|
Merged PR summary
Generated from the merged PR description and bounded, component-scoped file evidence. Release preparation reuses this validated summary. |
Fixes #1691.
boolsubclassesintin Python, so the schema guard'sisinstancecheck accepted JSONtrueandfalseforintegerandnumberschemas. Reject booleans explicitly for numeric schemas while preserving normal numeric values and boolean schemas.Focused tests cover both boolean literals against
integerandnumber, numeric values including zero, and the valid boolean case.tests/test_guard_schema.pyandtests/test_guard_pipeline.py: 26 passed.This AI-generated change follows OpenLIT's contribution guidance; AI assistance is disclosed.
Summary by Sourcery
Ensure Python schema validation treats booleans as distinct from numeric types.
Bug Fixes:
Tests: