jedcunningham commented on a change in pull request #20174:
URL: https://github.com/apache/airflow/pull/20174#discussion_r765988392
##########
File path: airflow/models/param.py
##########
@@ -57,10 +59,28 @@ def __init__(self, default: Any = __NO_VALUE_SENTINEL,
description: Optional[str
# If we have a value, validate it once. May raise ValueError.
if self.has_value:
- try:
- jsonschema.validate(self.value, self.schema,
format_checker=FormatChecker())
- except ValidationError as err:
- raise ValueError(err)
+ self._validate(self.value, self.schema)
+
+ @staticmethod
+ def _validate(value, schema):
+ """
+ 1. Check that value is json-serializable; if not, warn. In future
release we will require
+ the value to be json-serializable.
+ 2. Validate ``value`` against ``schema``
+ """
+ try:
+ json.dumps(value)
+ except Exception:
+ warnings.warn(
+ "The use of non-json-serializable params is deprecated and
will be removed in "
+ " a future release",
+ DeprecationWarning,
+ stacklevel=2,
Review comment:
Is this deep enough?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]