Skip to content

fix(serverless): report invalid input instead of raising from validator constraints - #809

Open
ranjithguggilla wants to merge 2 commits into
runpod:mainfrom
ranjithguggilla:fix/validator-constraints-on-invalid-input
Open

ranjithguggilla wants to merge 2 commits into
runpod:mainfrom
ranjithguggilla:fix/validator-constraints-on-invalid-input

Conversation

@ranjithguggilla

Copy link
Copy Markdown

Summary

rp_validator.validate() can raise TypeError when a schema constraint receives a missing or wrong-typed value, even though validation has already collected an error. For example, lambda x: x > 0 raises when x is None or a string.

Changes

  • Run constraints only when the input is present and has the declared type.
  • Return the existing required-input or type error without calling constraints for invalid values.
  • Add regression tests for missing required/default values, wrong types, and unchanged valid-type constraint behavior.

Tests

  • uv run pytest tests/test_serverless/test_utils/test_validate.py -v --no-cov — 13 passed, 3 subtests passed.
  • Full suite with proxy variables unset — 4,852 passed, 8 skipped, 17 subtests passed; 95.61% coverage.

ranjithguggilla and others added 2 commits December 6, 2026 00:49
…or constraints

Skip schema constraints for missing or wrong-typed values so validation returns the errors already collected. Add regression tests for missing, invalid, and valid values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Point the README badge and its link to the current ci.yml workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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