You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a special case, having objects with different levels of depth (we have about 6 levels) and we have mappings at different levels, for example this case, I added a mapping from Beta1 to Alpha and in that order we also want to generate that reverse mapping in Alpha to Beta1, do you have any thoughts?
There was a related ticket that is resolved in the community discussion with mappings between specific level of depth.This is bit more complex case. cuelang/cue#907
// This final output matches what we are hoping to achieve
// but is hardcoded to work, need a dynamic solution
_TEMP: {
// If we define a mapping here, the inverse should show up at that mapping
// ie, Alpha.Alpha1.id should now map to Beta.Beta1.id
// (are there potential recursive infinite loop problems?)
#Object: {...}
Beta: #Object & {
Beta1: #Object & {
id: "B1234"
// would like to keep string1, string2, and mappedId hidden
// or ideally, just use the "to" definition to access the right values
mappings: [{to: Alpha.Alpha1.id},{to: Alpha.id}]
}
}
// Object we want to map back to Beta.Beta1.id
Alpha: #Object & {
id: "A1"
//mappings: [{to: Beta.Beta1.id}] //we also want to generate this dynamically
Alpha1: #Object & {
id: "A1234"
//mappings: [{to: Beta.Beta1.id}] //we want to generate this dynamically
}
}
}
let lookup = {
for string1, x in _TEMP
for string2, y in x {
"\(y.id)": [string1, string2]
}
}
TEMP2: _TEMP
TEMP2: {
for x in _TEMP {
for y in x {
if y.mappings != _|_ {
for m in y.mappings {
let path = lookup[m.to]
"\(path[0])": "\(path[1])": mappings: [{to: y.id}]}
}
}
}
}
We want something like this output (The mappings from Alpha and Alpha1 were generated automatically):
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Originally opened by @rlopez-plenty in cuelang/cue#953
Hello Community.
We have a special case, having objects with different levels of depth (we have about 6 levels) and we have mappings at different levels, for example this case, I added a mapping from Beta1 to Alpha and in that order we also want to generate that reverse mapping in Alpha to Beta1, do you have any thoughts?
There was a related ticket that is resolved in the community discussion with mappings between specific level of depth.This is bit more complex case.
cuelang/cue#907
We want something like this output (The mappings from Alpha and Alpha1 were generated automatically):
I really appreciate any help in this case.
Have a nice day!
Beta Was this translation helpful? Give feedback.
All reactions