We are building an API Framework in PHP (Hacklang) and will be using json-schema from OPIS to implement validation of JSON input in the request body.
OWASP recommends implementing validations on minimum and maximum value range check for numerical parameters - Link
But looks like json-schema cannot perform validations on JSON encoded strings (raw input to the API) - https://opis.io/json-schema/2.x/php-validator.html
By first deserialising the input, I think we lose many of the benefits that schema validation provides. For eg., if the maxItems of an array field in the validation schema is 1 but the client provides a billion items, we would be deserialising everything only to throw an exception later.
Is there a way to perform validation without/while deserialising the raw input? How are open source API Frameworks handling this concern?