Deprecate the validate_legacy()
function
#1353
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #1352 and in particular #1352 (comment).
I reproduce the content bellow so that we can discuss this, and provide an implementation.
Context
validate_legacy()
was used with a data type and a validation function. If the value was matched by both the data type and the validation function, it produced no warning, otherwise it produced a warning if the new data type was matched but the legacy validation function was not accepting the value or an deprecation message if the data type was not matched but the legacy validation was accepted. The validation functions used are the ones being removed by this PR, sovalidate_legacy()
needs to be taken care of.The table bellow summarize the current behavior of
validate_legacy()
:Assumptions
The last line (fail/fail) is not expected to be seen into the wild because the compilation failure makes modules unusable.
For the 3 first line, only the first one does not produce annoying deprecation warning / notice, so we expect that such issues have been fixed.
Proposal
Update the function to always emit a deprecation message, and only validate the value against the provided data type. The validation function is therefore completely ignored (but the function prototype is not changed for backwards compatibility).
The table bellow summarize the proposed behavior of
validate_legacy()
: