def generate_subset_pings()

in mozilla_schema_generator/__main__.py [0:0]


def generate_subset_pings(config, out_dir, pretty, mps_branch):
    """Read in pings from disk and move fields to new subset pings.

    If configured, also create a remainder ping with all the fields that weren't moved.

    Ignore mps_branch and use the schemas on disk, because those will be populated with probes.
    """
    if not out_dir:
        raise NotImplementedError(
            "Generating subset pings without out_dir is not supported."
        )
    out_dir = Path(out_dir)
    with open(config, "r") as f:
        config_data = yaml.safe_load(f)
    schemas = subset_pings.generate(config_data, out_dir)
    for namespace, doctypes in schemas.items():
        for doctype, versions in doctypes.items():
            for version, schema in versions.items():
                dump_schema(
                    {doctype: schema}, out_dir / namespace, pretty, version=version
                )