Openapi.deref: def of ezmcp@0.1.0.0 Import: import ezmcp@0.1.0.0/src/openapi.bend as Openapi Lines 360-392 of ezmcp@0.1.0.0/src/openapi.bend: https://jend.leeeet.dev/read.txt?path=ezmcp@0.1.0.0/src/openapi.bend&start_line=360&end_line=392 import Base import emerging-ezjson@1.2.0.0/src/value.bend as Value # a value with every local reference in it replaced by its target, merged # with the reference object's other members (`merge`); a reference to one # of `refs`, the references being followed, is a cycle (`cyclic`), and one # that does not resolve is left as it is. `fuel` bounds how deep values and # references nest def deref( fuel: Nat, val: Value.Json, +doc: Value.Json, +refs: List<&2, String> ) -> Value.Json: match fuel: case 0n: val case 1n+(+less): match val: case Value.JObj{+pairs}: deref.obj(ref.of(pairs), doc, refs, _u => Value.JObj{deref(1n+less, pairs, doc, refs)}, ref => target => deref(less, target, doc, ref <> refs)) case Value.JArr{items}: Value.JArr{deref(1n+less, items, doc, refs)} case Value.JCons{head, tail}: Value.JCons{deref(1n+less, head, doc, refs), deref(1n+less, tail, doc, refs)} case Value.JPair{key, item, rest}: Value.JPair{key, deref(1n+less, item, doc, refs), deref(1n+less, rest, doc, refs)} case Value.JBind{src, n, item, rest}: Value.JBind{src, n, deref(1n+less, item, doc, refs), deref(1n+less, rest, doc, refs)} case other: other Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=emerging-ezjson@1.3.0.0/src/value.bend&name=Json https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/openapi.bend&name=deref.obj https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/openapi.bend&name=ref.of