INNER CODE UNIT · Python

clean_jsonschema

jupyterhub/zero-to-jupyterhub-k8s · tools/generate-json-schema.py:25

def clean_jsonschema(d, parent_key=""):
    """
    Modifies a dictionary representing a jsonschema in place to not contain
    jsonschema keys not relevant for a values.schema.json file solely for use by
    the helm CLI.
    """
    JSONSCHEMA_KEYS_TO_REMOVE = {"description"}

    # start by cleaning up the current level
    for k in set.intersection(JSONSCHEMA_KEYS_TO_REMOVE, set(d.keys())):
        del d[k]

    # Recursively cleanup nested levels, bypassing one level where there could
    # be a valid Helm chart configuration named just like the jsonschema
    # specific key to remove.
    if "properties" in d:
        for k, v in d["properties"].items():
            if isinstance(v, MutableMapping):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…