Skip to content

Fix constraints for inputs with defaults - #810

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

ranjithguggilla wants to merge 2 commits into
runpod:mainfrom
ranjithguggilla:fix/validator-default-constraints

Conversation

@ranjithguggilla

Copy link
Copy Markdown

Summary

Ensure validator constraints run for supplied values that match their schema's declared type, even when the schema also defines a default. Previously, a default-type shortcut skipped both type validation and constraints.

Values accepted only because their type matches a default of another type remain exempt from constraints, and invalid input types are reported without being passed to typed constraints. This PR includes the prerequisite invalid-input guard from fix(serverless): report invalid input instead of raising from validator constraints.

Adds regression tests for constrained optional inputs with defaults, valid values, default application, and None defaults.

Validation

  • uv run --group test -- pytest -q --no-cov tests/test_serverless/test_utils/test_validate.py — 15 passed, 5 subtests passed
  • uv run --group dev -- ruff check runpod/serverless/utils/rp_validator.py tests/test_serverless/test_utils/test_validate.py — passed

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