For checking the document itself, this would be a method that can be called on $t after construction - to enable linting mode and fail on any identified issues.
For runtime, perform linting checks at the same time as $t->validate_request or $t->validate_response and fail or warn (configurable?) with the results so found.