Skip to content

🔧 Support multiple --mappings-file flags and merge their contents automatically #66

@httpdss

Description

@httpdss

🧩 Feature Request

Add support for passing multiple --mappings-file flags to the struct generate command. When more than one is provided, the CLI should merge all the provided mapping files into a single internal structure before processing.

✅ Expected Behavior

Allow users to define reusable and environment-specific mappings like so:

```sh
# Example: Combine shared and environment-specific mappings
struct generate \
  --mappings-file ./mappings/common.yaml \
  --mappings-file ./mappings/${ENVIRONMENT}.yaml \
  file://infrastructure.yaml \
  ./output
```

This would result in all mappings being merged and applied as if they were defined in a single file.

🚀 Why This Is Useful

  • Enables clean separation of common vs environment-specific configuration
  • Greatly improves CI/CD automation, as shown in the example
  • Promotes DRY (Don't Repeat Yourself) principles

🛠️ Notes for Implementation

  • Preserve order of application: first file should be overridden by the second in case of key conflicts
  • Validate merged YAML structure before continuing with generation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions