-
Notifications
You must be signed in to change notification settings - Fork 18
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
Shared config objects #54
Comments
Agree with your observation. This is a weak point in the tool. Here's a basic idea toward providing support for this:
or:
Something like the above should not be too difficult to implement, but I'm not sure when I'll have the time. In the mean time, any reactions to the above would be most welcome. Thanks! |
The However, we could consider an option, say The adjustments to your input example would be:
(*) An optional |
I actually just used However, it gets a bit tricky when combined with object merging (a conceivable use case would be to extend another spec object, e.g. But if we can disregard those edge cases, your input example, combined with a feature option to be backwards compatible, seems like a great solution. |
Just did a quick test of having
But this is not too bad actually. The idea now is even simpler (for the user): The example input config would look like this:
Thoughts? |
Interesting that it's not allowed to not resolve substitutions.
Wow, I really like this idea. It fits the style much better than the substitution "hack". On Where would it be allowed to define these objects? For my use limiting them to the spec root would suffice, but I guess for very large specs it could make sense to define them local to their use. I.e.
On the other hand it would raise questions about scoping etc., so it's probably not worth the hassle. |
Yeah, scoping, recursion (eg., a |
0.9.94 just released, please give it a try when you get a chance. Thanks! |
Sorry, haven't had a chance to try this out before now. There seems to be an issue related to naming. This works
This does not work
All I'm running with is Similar behavior can be achieved by modifying the shared type name. I can't seem to get get the project to run from source to test, but it feels like it's related to hashing? |
Thanks for catching that! I just reproduced it. |
Is there any way to use an object multiple times in a spec and have it generate a shared config type?
E.g.
Where
shared
could be something like:I often run into this use case, where different parts of the config share a common object.
The above generates two differently named types for
shared
, forcing you to implement whatever logic consumes the shared object twice.Is there a way around this, or do you have a recommended approach for such scenarios?
The text was updated successfully, but these errors were encountered: