I had proposed a different approach that would let us cache the implementers map for as long as the schema is immutable, so it could be reused for different query validations. That approach had an issue that made Valid::assume_valid_ref very, very subtle to use, so we are not doing that right now.
This is a less ideal version but it does solve the immediate problem. We had an OperationValidationConfig structure that contains contextual information about the current operation. This extends that idea to have an ExecutableValidationContext for the whole document, and "child" OperationValidationContexts for each operation.
The included benchmark goes from 200ms of validation time to 2ms.
Fixes #862.
I had proposed a different approach that would let us cache the implementers map for as long as the schema is immutable, so it could be reused for different query validations. That approach had an issue that made
Valid::assume_valid_ref
very, very subtle to use, so we are not doing that right now.This is a less ideal version but it does solve the immediate problem. We had an
OperationValidationConfig
structure that contains contextual information about the current operation. This extends that idea to have anExecutableValidationContext
for the whole document, and "child"OperationValidationContext
s for each operation.The included benchmark goes from 200ms of validation time to 2ms.