Skip to content

feat(service): add email, number, and string_list schema validators - #21

Merged
ATLURI0001 merged 1 commit into
mainfrom
feat/service-email-number-and-stringlist-validators
Nov 15, 2026
Merged

ATLURI0001 merged 1 commit into
mainfrom
feat/service-email-number-and-stringlist-validators

Conversation

@ATLURI0001

Copy link
Copy Markdown
Owner

1. Architecture Overview

This change extends the transport-independent validation pipeline in python-fullstack/backend/service.py with three core schema primitives used across authentication, grading, and course taxonomy modules:

  • email(data, key, required=True): RFC-compliant email address format validation, consecutive dot rejection (..), normalization to lowercase, and optional field handling.
  • number(data, key, low=None, high=None): Finite floating-point/numeric validation with strict exclusion of boolean types and NaN/Infinity values, complete with boundary assertions.
  • string_list(data, key, min_items=0, max_items=100, item_min_len=1, item_max_len=100): Strict sequence sanitization that strips items, checks array lengths, and asserts string element typing.

2. Failure Mode & Diagnostic Analysis

Prior to this patch:

  • Email fields fell back to generic text() validation without structural address verification, allowing malformed strings like missing-domain@ or domain-traversal patterns into the database.
  • Numeric grading inputs lacked bounds enforcement, permitting float('nan') or boolean flags to pass type checks.
  • Categorical attributes like course tags and prerequisites lacked array validation, risking unhandled attribute exceptions in subsequent API layers.

3. Engineering Implementation Details

  • Handled status 422 ApiError raises matching existing framework conventions.
  • Added math.isfinite() guards on all numeric inputs.
  • Implemented item trimming and length boundary checks across string_list.

4. Verification & Test Evidence

  • Executed python -m pytest tests/ in python-fullstack/backend.
  • 14 passed in 1.01s:
    • test_email_validator verified with valid, case-folded, optional, and invalid address patterns.
    • test_number_validator verified with boundary clamps, booleans, and NaNs.
    • test_string_list_validator verified with padding, empty arrays, and item type assertions.

@vercel

vercel Bot commented Nov 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lmskl Error Error Nov 15, 2026 2:45pm UTC

@ATLURI0001
ATLURI0001 merged commit 21461af into main Nov 15, 2026
6 of 8 checks passed
@ATLURI0001
ATLURI0001 deleted the feat/service-email-number-and-stringlist-validators branch November 15, 2026 14:45

This branch had an error being deployed

1 failed deployment
Preview — 357419dc Deployed Nov 15, 2026 by vercel[bot]
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