This is an automated email from the ASF dual-hosted git repository.

Miretpl pushed a commit to branch chart/v1-2x-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/chart/v1-2x-test by this push:
     new b47745eb97f [chart/v1-2x-test] Fix Helm chart parameter examples that 
fail the chart's own schema (#72698) (#73047)
b47745eb97f is described below

commit b47745eb97f2e5c80509bea6b043ba025dd61008
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Sep 22 23:28:54 2026 +0200

    [chart/v1-2x-test] Fix Helm chart parameter examples that fail the chart's 
own schema (#72698) (#73047)
    
    * [chart/v1-2x-test] Fix Helm chart parameter examples that fail the 
chart's own schema (#72698)
    (cherry picked from commit 3931d6ab6dc16c4d3ef0d93a12706fae373e2c5a)
    
    Co-authored-by: PoAn Yang <[email protected]>
    Signed-off-by: PoAn Yang <[email protected]>
    
    * Fix values schema examples for workers.volumeClaimTemplates
    
    ---------
    
    Signed-off-by: PoAn Yang <[email protected]>
    Co-authored-by: PoAn Yang <[email protected]>
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
---
 chart/values.schema.json                           | 94 +++++++++++++---------
 .../helm_tests/airflow_aux/test_chart_quality.py   | 32 +++++++-
 2 files changed, 85 insertions(+), 41 deletions(-)

diff --git a/chart/values.schema.json b/chart/values.schema.json
index 142de64f9f5..d1cbd1f09aa 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -2862,26 +2862,34 @@
                     },
                     "examples": [
                         {
-                            "name": "data-volume-1",
-                            "storageClassName": "storage-class-1",
-                            "accessModes": [
-                                "ReadWriteOnce"
-                            ],
-                            "resources": {
-                                "requests": {
-                                    "storage": "10Gi"
+                            "metadata": {
+                                "name": "data-volume-1"
+                            },
+                            "spec": {
+                                "storageClassName": "storage-class-1",
+                                "accessModes": [
+                                    "ReadWriteOnce"
+                                ],
+                                "resources": {
+                                    "requests": {
+                                        "storage": "10Gi"
+                                    }
                                 }
                             }
                         },
                         {
-                            "name": "data-volume-2",
-                            "storageClassName": "storage-class-2",
-                            "accessModes": [
-                                "ReadWriteOnce"
-                            ],
-                            "resources": {
-                                "requests": {
-                                    "storage": "20Gi"
+                            "metadata": {
+                                "name": "data-volume-2"
+                            },
+                            "spec": {
+                                "storageClassName": "storage-class-2",
+                                "accessModes": [
+                                    "ReadWriteOnce"
+                                ],
+                                "resources": {
+                                    "requests": {
+                                        "storage": "20Gi"
+                                    }
                                 }
                             }
                         }
@@ -4067,26 +4075,34 @@
                             },
                             "examples": [
                                 {
-                                    "name": "data-volume-1",
-                                    "storageClassName": "storage-class-1",
-                                    "accessModes": [
-                                        "ReadWriteOnce"
-                                    ],
-                                    "resources": {
-                                        "requests": {
-                                            "storage": "10Gi"
+                                    "metadata": {
+                                        "name": "data-volume-1"
+                                    },
+                                    "spec": {
+                                        "storageClassName": "storage-class-1",
+                                        "accessModes": [
+                                            "ReadWriteOnce"
+                                        ],
+                                        "resources": {
+                                            "requests": {
+                                                "storage": "10Gi"
+                                            }
                                         }
                                     }
                                 },
                                 {
-                                    "name": "data-volume-2",
-                                    "storageClassName": "storage-class-2",
-                                    "accessModes": [
-                                        "ReadWriteOnce"
-                                    ],
-                                    "resources": {
-                                        "requests": {
-                                            "storage": "20Gi"
+                                    "metadata": {
+                                        "name": "data-volume-2"
+                                    },
+                                    "spec": {
+                                        "storageClassName": "storage-class-2",
+                                        "accessModes": [
+                                            "ReadWriteOnce"
+                                        ],
+                                        "resources": {
+                                            "requests": {
+                                                "storage": "20Gi"
+                                            }
                                         }
                                     }
                                 }
@@ -7861,12 +7877,10 @@
                     "type": "array",
                     "default": [],
                     "examples": [
-                        [
-                            {
-                                "name": "FORWARDED_ALLOW_IPS",
-                                "value": "*"
-                            }
-                        ]
+                        {
+                            "name": "FORWARDED_ALLOW_IPS",
+                            "value": "*"
+                        }
                     ],
                     "items": {
                         "type": "object",
@@ -11020,7 +11034,7 @@
                             "user": "...",
                             "pass": "...",
                             "host": "...",
-                            "port": "..."
+                            "port": 9200
                         }
                     ]
                 }
@@ -11083,7 +11097,7 @@
                             "user": "...",
                             "pass": "...",
                             "host": "...",
-                            "port": "..."
+                            "port": 9200
                         }
                     ]
                 }
diff --git a/helm-tests/tests/helm_tests/airflow_aux/test_chart_quality.py 
b/helm-tests/tests/helm_tests/airflow_aux/test_chart_quality.py
index 81c52322053..cae3eef8281 100644
--- a/helm-tests/tests/helm_tests/airflow_aux/test_chart_quality.py
+++ b/helm-tests/tests/helm_tests/airflow_aux/test_chart_quality.py
@@ -18,11 +18,28 @@ from __future__ import annotations
 
 import json
 from pathlib import Path
+from typing import Any
 
+import pytest
 import yaml
-from jsonschema import validate
+from jsonschema import validate, validators
+from jsonschema.exceptions import best_match
 
 CHART_DIR = Path(__file__).parents[4] / "chart"
+VALUES_SCHEMA = json.loads((CHART_DIR / "values.schema.json").read_text())
+
+
+def _iter_schemas_with_examples(schema: dict[str, Any], path: str = ""):
+    if schema.get("examples"):
+        yield path, schema
+    for name, child in (schema.get("properties") or {}).items():
+        yield from _iter_schemas_with_examples(child, f"{path}.{name}" if path 
else name)
+    for key, suffix in (("items", "[]"), ("additionalProperties", ".*")):
+        if isinstance(schema.get(key), dict):
+            yield from _iter_schemas_with_examples(schema[key], 
f"{path}{suffix}")
+
+
+SCHEMAS_WITH_EXAMPLES = dict(_iter_schemas_with_examples(VALUES_SCHEMA))
 
 
 class TestChartQuality:
@@ -39,3 +56,16 @@ class TestChartQuality:
 
         # shouldn't raise
         validate(instance=values, schema=schema)
+
+    @pytest.mark.parametrize("path", SCHEMAS_WITH_EXAMPLES)
+    def test_schema_examples_validate_against_their_own_schema(self, path):
+        """Examples are rendered verbatim into the parameters reference, so 
they must be valid values."""
+        schema = SCHEMAS_WITH_EXAMPLES[path]
+        validator = validators.validator_for(VALUES_SCHEMA)(
+            {**schema, "definitions": VALUES_SCHEMA["definitions"]}
+        )
+        for example in schema["examples"]:
+            # chart/docs/conf.py renders each example of an array parameter as 
a single list element
+            instance = [example] if schema.get("type") == "array" else example
+            error = best_match(validator.iter_errors(instance))
+            assert error is None, f"{path}: {error.message}"

Reply via email to