Skip to content

Merge group members when same group is defined across multiple files #34

@melipass

Description

@melipass

If a group group-name is defined in two different files, the group members won't be combined into a single group definition. This will throw an error:

duplicate name "group:group-name" in object (lines X:Y and Z:Y)

I believe it is expected that a combiner does the following if a group name is encountered multiple times:

  1. Collect all members from each occurrence
  2. Merge them into a single group definition (deduplicating members, if needed)
  3. Then, include the group in the final combined output

Groups with the same name defined across multiple files should have their members merged into a single group definition in the combined output. Merging groups would enable much more flexible organizational structures in child files.

Example

companies/company-1/groups.hujson:

{
    "groups": {
        "group:group-name": [
            "member-1@company.com",
            "member-2@company.com",
        ]
    }
}

companies/company-2/groups.hujson:

{
    "groups": {
        "group:group-name": [
            "member-3@company.com",
            "member-4@company.com",
        ]
    }
}

Expected combined output:

{
    "groups": {
        // from `companies/company-1/groups.hujson`
        // and  `companies/company-2/groups.hujson`
        "group:group-name": [
            "member-1@company.com",
            "member-2@company.com",
            "member-3@company.com",
            "member-4@company.com",
        ]
    }
}

Current output:

{
    "groups": {
        // from `companies/company-1/groups.hujson`
        "group:group-name": ["member-1@company.com", "member-2@company.com"],
        // from `companies/company-2/groups.hujson`
        "group:group-name": ["member-3@company.com", "member-4@company.com"],
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions