Cache the compiled schema validators

Node · Node · intermediate · modification

Adds an in-memory memo cache to getValidator so each (schemaName, draft) pair is compiled once and reused. Repeated lookups now hit the Map instead of re-running the expensive compileSchema. Behavior is unchanged; the validators returned are identical to before, just cached.

getValidator sits on the hot path of a JSON API gateway: every inbound request looks up a validator by (schemaName, draft), and compileSchema builds it by walking the full schema graph. The same handful of pairs is requested millions of times a day.

Requirements

Files touched

Review this PR

Node practice