def Yaml.res

bend-kube-runtime@0.2.0.0 · src/yaml.bend:1085

import bend-kube-runtime@0.2.0.0/src/yaml.bend as Yaml
import Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J

1085# The document with anchors recorded, aliases replaced and merges applied.
1086def Yaml.res(j: J.Json, +a: Map<&2, J.Json>) -> YR:
1087  match j:
1088    case J.JStr{+s}:
1089      Yaml.res.str(s, a, Yaml.is_alias(s))
1090    case J.JObj{J.JMem{+k, v, J.JNil{}}}:
1091      Yaml.res.single(k, Yaml.anchor_name(k), Yaml.res(v, a), J.JNil{}, a)
1092    case J.JObj{ms}:
1093      Yaml.res.obj(Yaml.res(ms, a))
1094    case J.JArr{xs}:
1095      Yaml.res.arr(Yaml.res(xs, a))
1096    case J.JCons{h, t}:
1097      +rh = Yaml.res(h, a)
1098      Yaml.res.cons(rh, Yaml.res(t, YR.anchors(rh)))
1099    case J.JMem{k, v, t}:
1100      +rv = Yaml.res(v, a)
1101      Yaml.res.mem(k, rv, Yaml.res(t, YR.anchors(rv)))
1102    case x:
1103      YR{x, a}

Uses (12)

Used by (1)