def typed

ezmcp@0.1.0.0 · src/openapi.bend:1391

import ezmcp@0.1.0.0/src/openapi.bend as Openapi
import Base
import emerging-ezjson@1.2.0.0/main.bend as Json
import emerging-ezjson@1.2.0.0/src/value.bend as Value

1391# whether a value is of a schema's `type`: the type it names, or one of the
1392# types an array of names lists; true for a schema with no `type`
1393def typed(typ: Value.Json, +val: Value.Json) -> Bool:
1394  match typ:
1395    case Value.JStr{str}:
1396      kind(str, val)
1397    case Value.JSpan{src, +n}:
1398      kind(Value.span.str(src, n, U32.is_zero(n)), val)
1399    case Value.JArr{+cs}:
1400      kinds(Json.items(Value.JArr{cs}), val)
1401    case other:
1402      True{}

Uses (7)

Used by (2)