Skip to content

Support array configurations for multi config #92

Closed

Description

@pi0

When the default export is an array we need to support resolving multi configs (might be a new export loadConfig)

Activity

  1. sadeghbarati commented on Feb 13, 2024

    @sadeghbarati
  2. mrlubos commented on May 15, 2024

    @mrlubos
  3. pi0 commented on Jun 11, 2024

    @pi0
    Author
  4. added
    enhancement
    on Jun 11, 2024
  5. mrlubos commented on Aug 27, 2025

    @mrlubos
    Contributor

    @pi0 what are your latest thoughts on this? Still looking to add this? Let us know if there's any guidance, @carson2222 could work on it

  6. pi0 commented on Aug 27, 2025

    @pi0
    MemberAuthor

    @mrlubos Can you share an example of input config and desired returned value in your case? 🙏🏼

  7. mrlubos commented on Aug 27, 2025

    @mrlubos
    Contributor

    Our request comes from this thread hey-api/hey-api#564

    All of those use cases can be handled on our end as long as the root is an object. That leaves us with one exception: arrays.

    export default [
      {
        input: 'input1.yaml',
        output: 'output1',
      },
      {
        input: 'input2.yaml',
        output: 'output2',
      },
    ];

    This is a c12 constraint, right?

  8. mrlubos commented on Aug 27, 2025

    @mrlubos
    Contributor

    We could hack around it by wrapping the array in another object.

    export default {
      multi: [
        {
          input: 'input1.yaml',
          output: 'output1',
        },
        {
          input: 'input2.yaml',
          output: 'output2',
        },
      ],
    };

    But this isn't ergonomic + there's a challenge with how to name the array.

  9. mrlubos commented on Aug 27, 2025

    @mrlubos
    Contributor

    If you agree that this is a limitation and it should be resolved (it appears you do since you created this issue), just let us know how you're thinking about it and what roughly needs to be done to support it. We're eager to resolve it and can properly dedicate resources to it now.

  10. pi0 commented on Aug 27, 2025

    @pi0
    MemberAuthor

    Thanks for examples. Keyed array in object should but already possible but indeed top level array might make sense too.

    Main thing to solve before attempting implementation is figure out how we are going to merge different sources. For example if configrc is enabled, or we have extending layers, should they apply to all? or should they be applied to one? if layer also exports and array how to merge then?

  11. mrlubos commented on Aug 27, 2025

    @mrlubos
    Contributor

    Can you point me to those features or show examples for the 3 scenarios you described? I am not familiar with them, I've always used a single config file. By extension, I assume 99% of our users do the same since we guide towards that in the documentation. So these "edge cases" don't really apply to us specifically, but of course happy to think through them

  12. carson2222 commented on Sep 5, 2025

    @carson2222
    Contributor

    Hey @pi0, Your answer would be very helpful 🙂

  13. carson2222 commented on Sep 9, 2025

    @carson2222
    Contributor

    As i guess we don't really need to support all those extension/cases you mentioned, I just created a fork with basic update of the c12 to simply support array on configs

    https://github.com/carson2222/c12

  14. pi0 commented on Sep 11, 2025

    @pi0
    MemberAuthor
  15. carson2222 commented on Sep 11, 2025

    @carson2222
    Contributor

    There you go!
    #272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions