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



##########
File path: airflow/models/param.py
##########
@@ -49,10 +51,28 @@ def __init__(self, default: Any = NOTSET, description: 
Optional[str] = None, **k
         self.description = description
         self.schema = kwargs.pop('schema') if 'schema' in kwargs else kwargs
 
+        if self.has_value:
+            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,
+            )

Review comment:
       I experimented with different values of stacklevel and it seems it's not 
possible to make it reach the place of definition.  It's too nested it seems.




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