kaxil commented on a change in pull request #13488:
URL: https://github.com/apache/airflow/pull/13488#discussion_r553060643



##########
File path: dev/provider_packages/prepare_provider_packages.py
##########
@@ -1152,39 +1156,78 @@ def _load_schema() -> Dict[str, Any]:
     except jsonschema.ValidationError as e:
         raise Exception(
             "Error when validating schema. The schema must be Airflow 2.0.0 
compatible. "
-            "If you added any fields please remove them via 
'remove_extra_fields' method.",
+            "If you added any fields please remove them via 
'convert_to_provider_info' method.",
             e,
         )
 
 
-def remove_logo_field(original_provider_info: Dict[str, Any]):
-    updated_provider_info = deepcopy(original_provider_info)
-    expression = jsonpath_ng.parse("integrations..logo")
-    updated_provider_info = expression.filter(lambda x: True, 
updated_provider_info)
-    return updated_provider_info
+def validate_provider_info_with_runtime_schema(provider_info: Dict[str, Any]) 
-> None:
+    """
+    Validates provider info against the runtime schema. This way we check if 
the provider info in the
+    packages is future-compatible. The Runtime Schema should only change when 
there is a major version
+    change.
+
+    :param provider_info: provider info to validate
+    """
+
+    def _load_schema() -> Dict[str, Any]:
+        with open(PROVIDER_RUNTIME_DATA_SCHEMA_PATH) as schema_file:
+            content = json.load(schema_file)
+        return content
+
+    schema = _load_schema()

Review comment:
       ```suggestion
   ```

##########
File path: dev/provider_packages/prepare_provider_packages.py
##########
@@ -1152,39 +1156,78 @@ def _load_schema() -> Dict[str, Any]:
     except jsonschema.ValidationError as e:
         raise Exception(
             "Error when validating schema. The schema must be Airflow 2.0.0 
compatible. "
-            "If you added any fields please remove them via 
'remove_extra_fields' method.",
+            "If you added any fields please remove them via 
'convert_to_provider_info' method.",
             e,
         )
 
 
-def remove_logo_field(original_provider_info: Dict[str, Any]):
-    updated_provider_info = deepcopy(original_provider_info)
-    expression = jsonpath_ng.parse("integrations..logo")
-    updated_provider_info = expression.filter(lambda x: True, 
updated_provider_info)
-    return updated_provider_info
+def validate_provider_info_with_runtime_schema(provider_info: Dict[str, Any]) 
-> None:
+    """
+    Validates provider info against the runtime schema. This way we check if 
the provider info in the
+    packages is future-compatible. The Runtime Schema should only change when 
there is a major version
+    change.
+
+    :param provider_info: provider info to validate
+    """
+
+    def _load_schema() -> Dict[str, Any]:
+        with open(PROVIDER_RUNTIME_DATA_SCHEMA_PATH) as schema_file:
+            content = json.load(schema_file)
+        return content

Review comment:
       I really think a function is not required here:
   
   ```suggestion
       with open(PROVIDER_RUNTIME_DATA_SCHEMA_PATH) as schema_file:
           schema = json.load(schema_file)
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to