Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ] Spec: allow including partial specs #375

Open
1 task
cpuguy83 opened this issue Sep 18, 2024 · 2 comments
Open
1 task

[REQ] Spec: allow including partial specs #375

cpuguy83 opened this issue Sep 18, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@cpuguy83
Copy link
Member

What kind of request is this?

New feature

What is your request or suggestion?

Sometimes there's a lot of shared things between specs, especially if multiple versions of a package need to be supported.
This can end up with a lot of duplication and is potentially prone to errors due to out-of-sync specs.

I think it could be possible at every object to allow something like an @include field to pull in a spec using any source type, which would be pulled in, unmarshalled, and merged into the main spec. The included type must match the type where its being included in.
e.g.

dependencies:
  @include:
     - context: {}
        path: path/to/deps.partial.yml

Multiple @includes can be used here and merged together with the base.

Are you willing to submit PRs to contribute to this feature request?

  • Yes, I am willing to implement it.
@cpuguy83 cpuguy83 added the enhancement New feature or request label Sep 18, 2024
@adamperlin
Copy link
Contributor

adamperlin commented Oct 2, 2024

A few questions here.

  1. Can included spec fragments reference other includes themselves? Or I guess to be very specific, are recursive includes allowed? I don't necessarily see a problem with this, but it might complicate the feature a bit. We may have to consider things like circular includes for example.

  2. How to handle conflicting spec fields? When merging in fields from other partial specs, it is possible that multiple different partial specs will specify a value for the same field (which will need to be unique in its section of the spec). Is that case simply an error?

@cpuguy83
Copy link
Member Author

cpuguy83 commented Oct 2, 2024

  1. I would not start with recursive includes
  2. Agree, error on merge conflict is best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants