Skip to content

Build the services validator chains once, per route - #3562

Merged
adamtheturtle merged 2 commits into
mainfrom
adamtheturtle/pick-next-issue-v5
Sep 7, 2026
Merged

adamtheturtle merged 2 commits into
mainfrom
adamtheturtle/pick-next-issue-v5

Conversation

@adamtheturtle

Copy link
Copy Markdown
Member

Every VWS request ran around thirty validators in sequence, each working out for itself whether it applied by re-reading the body or re-checking the path and method, so Vuforia's error precedence was encoded implicitly as the call order in one function.

This declares the validators which apply to each route, in the order they apply, in a route table built once at import time in routes.py. Each validator now takes a ValidatorContext carrying the route's own facts (mandatory and optional keys, rate-limit group, whether an inactive cloud project may use it), so the applicability guards, the per-request route table in the key validator, and the path-based branches which picked between errors are gone. Validators which branched on route are split into named per-route validators, and RequestRateLimiter moves to its own module.

Refs #3371. The parse-the-body-once half of that issue is left for a later change.

🤖 Generated with Claude Code

adamtheturtle and others added 2 commits September 6, 2026 19:12
Every VWS request ran around thirty validators in sequence, and each one
worked out for itself whether it applied by re-reading the body or by
re-checking the path and the method. Vuforia's error precedence -- which
of several simultaneous problems with a request it reports -- was
therefore encoded implicitly as the order of the calls in one function,
and nothing stated it.

Declare the validators which apply to each route, in the order in which
they apply, in a route table built once at import time. Each validator
now takes a ValidatorContext which carries the route's own facts, so the
applicability guards, the per-request route table in the key validator
and the validators which could not apply are all gone.

Refs #3371

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…xt-issue-v5

# Conflicts:
#	src/mock_vws/_services_validators/__init__.py
#	src/mock_vws/_services_validators/json_validators.py
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