-
Notifications
You must be signed in to change notification settings - Fork 60
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
Merge + Ref combination doesn't work #88
Comments
Thanks for the repro, that's really useful. Just to note, your workaround pokes at something internal which could change/go away at any time. The problem is one of ordering. Aero attempts to automatically figure out what order to run dependencies in. In this case, your dependency tree looks like so:
This essentially forms a circular dependency chain (which Aero gives up on and prints that warning). This EDN is essentially self-referential (it depends on the merging of itself to complete in order for it to be able to refer to itself). I'm not sure if this is a use-case Aero should support. I can think of a fairly specific solution, but it is not generally applicable. It requires |
Resolving refs after configuration is merged is a very common use-case. Usually you have a
Then you have I also cannot, for instance, have a dev name defined in dev overrides and have it apply in the properties in the core config. Or to put in in simpler, more synthetic, example: given your idea of how Aero should work and the following config file:
It would yield:
Which I don't think is what people would expect. |
I would discourage this kind of config, because it detracts from Aero's aim of being explicit and intentional. To be explicit, you could instead do this:
Aero doesn't aim to support override files, so I don't think a change to fix that would make much sense. If there's another use-case which requires this behaviour, it would make sense to revisit then. |
Ok but each developer on the team has a different s3 bucket name prefix, thus overrides are needed, and simply having a |
There's also #user for that use case. |
It's broken even without self-references within the same (aero.core/read-config (char-array "{:v {:y 2}, :a #merge [{:x 1} #ref [:y]]}"))
WARNING: Unable to resolve "#ref [:y]" at [:a :form 1]
=> {:v {:y 2}, :a {:x 1}} It used to work just fine in Aero 1.1.3. I checked it and the regression was made by e333a30. |
@p-himik I think there's a bug in your example, you don't have a top-level
|
Oh shoot, you're right. 🤦♂️ Oversimplified my config beyond being correct. |
Given this edn:
You'll get:
This is because the ref tag seems to operate on some different representation. The following edn renders correctly though:
results in:
Having to name the index of reffed item in the merges decreases the value of the
ref
a lot and it will introduce breakage when people move items around.I think this is the same problem as experienced in #85
The text was updated successfully, but these errors were encountered: