Closed Licenser closed 10 years ago
Check out #73
Looked at #73, I was thinking about this approach but it comes with one problem, it looses order when it comes to translations and mappings. The only way to work around that w/o keeping priorities around would be not splitting mappings and translations but that looked even messier then keeping the priority flag.
To illustrate the issue look at the test/order_test in the PR.
The result form this PR:
[{app,[{setting,[{a,"a0"},{b,"b0"},{t2,"c0"},{c,"t0.c"},{t1,"t0.1"}]}]}].
and from #73
[{app,[{setting,[{a,"a0"},{b,"b0"},{t2,"t1.2"},{c,"t0.c"},{t1,"t1.1"}]}]}].
I only see the schema files for the order_test. I can't find the actual test.
And you are totally right, that was pretty lousy of me, added proper tests for the cases, with spec files and explanations in them.
Wanted to annoy you a bit since the overwriting of translations to mappings is a actual issue I'm running into. I'm good living of my form but it would be nicer to be in sync with the original ;). That said I'm not at all focused on this implementation but it'd be nice to have the functionality in one way or another. #73 sadly did not solve the issue entirely.
Fixing the behavior described in #70.
This patch changes the behavior of schema loading slightly, each schema gets a priority assigned, this priority is based on the alphabetical order. The priority is stored in both mappings and translations, putting them in validators would be easy but did not seem to make sense to me.
This allows mappings and transactions to be applied in any order while retaining the priority/order they had in regards to the loaded schema files. It works like this:
A mapping of variable
app.v
in00.schema
will this overwrite a mapping to variableapp.v
in01.schema
since the priority of the first mapping would be 2 which is greater 1, then the priority of mapping of the01.schema
.Even if
02.schema
would have a translation forapp.v
this would not take affect since the priority of this translation would be 0, while the mapping form00.schema
wins with a priority of 2. While the other way around a translation toapp.v
from00.schema
would overwrite both, mappings toapp.v
and translations toapp.v
from01.schema
or02.schema