dstandish commented on a change in pull request #19267:
URL: https://github.com/apache/airflow/pull/19267#discussion_r743322065



##########
File path: airflow/models/param.py
##########
@@ -49,18 +50,37 @@ class Param:
     """
 
     __NO_VALUE_SENTINEL = NoValueSentinel()
+    CLASS_IDENTIFIER = '__class'
 
     def __init__(self, default: Any = __NO_VALUE_SENTINEL, description: str = 
None, **kwargs):
+
         self.value = default
         self.description = description
         self.schema = kwargs.pop('schema') if 'schema' in kwargs else kwargs
 
-        # 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 TypeError:
+            warnings.warn(
+                "The use of non-json-serializable params is deprecated and 
will be removed in a"
+                " future release",
+                DeprecationWarning,
+                stacklevel=2,
+            )

Review comment:
       ok sure.




-- 
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]


Reply via email to