def set_schema_elem()

in mozilla_schema_generator/schema.py [0:0]


    def set_schema_elem(self, key: Iterable[str], elem: Any, *, propagate=True) -> dict:
        """
        @param key: The key set
        @param elem: The value to set the key to
        @param propagate: If True, creates objects until it reaches the full key.
                          If False, and the parent of the key is not in the
                          schema, then the key will not be added.
        """
        new_elem = self.schema

        for k in key[:-1]:
            if k not in new_elem:
                if not propagate:
                    return

                new_elem[k] = {}
                if k == "properties":
                    new_elem["type"] = "object"
            new_elem = new_elem[k]

        new_elem[key[-1]] = elem