mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-17 01:01:03 +02:00
Slightly tweak the config decode so that components can over-ride the
'with' method which injects parameters.
This commit is contained in:
parent
fc0af2f900
commit
76a3417b56
1 changed files with 6 additions and 4 deletions
|
|
@ -3,9 +3,7 @@ local components = import "components.jsonnet";
|
||||||
|
|
||||||
local apply = function(p, components)
|
local apply = function(p, components)
|
||||||
|
|
||||||
local component = components[p.name];
|
local base = {
|
||||||
|
|
||||||
(component + {
|
|
||||||
|
|
||||||
with:: function(k, v) self + {
|
with:: function(k, v) self + {
|
||||||
[k]:: v
|
[k]:: v
|
||||||
|
|
@ -18,7 +16,11 @@ local apply = function(p, components)
|
||||||
self
|
self
|
||||||
),
|
),
|
||||||
|
|
||||||
}).with_params(p.parameters);
|
};
|
||||||
|
|
||||||
|
local component = base + components[p.name];
|
||||||
|
|
||||||
|
component.with_params(p.parameters);
|
||||||
|
|
||||||
local decode = function(config)
|
local decode = function(config)
|
||||||
local add = function(state, c) state + apply(c, components);
|
local add = function(state, c) state + apply(c, components);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue