bend-schema-lib Releases (3): 0.4.1.0 0x7a52b371e038cf76c1fc2e721c75bc4e indexed https://jend.leeeet.dev/files.txt?path=bend-schema-lib@0.4.1.0 0.3.0.0 0x274bae9d62416e1995c82935332bdf2f unindexed https://jend.leeeet.dev/files.txt?path=bend-schema-lib@0.3.0.0 0.1.0.0 0xa9f0119b329387bd12ab09578428fd3d unindexed https://jend.leeeet.dev/files.txt?path=bend-schema-lib@0.1.0.0 Definitions (126, 1 to 100 shown): Core.NumberBits (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=NumberBits) type NumberBits is Data: NumberBits{hi: U32, lo: U32} Core.Json (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Json) type Json is Data: JNull{} JBool{value: Bool} JNumber{value: NumberBits} JString{value: String} JArray{values: List<&2, Json>} JObject{members: List<&2, JMember>} Core.JMember (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=JMember) type JMember is Data: JMember{key: String, value: Json} Core.Int (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Int) # A whole number of either sign: IPos{n} is n, INeg{n} is -(n+1), so every # integer has exactly one form (there is no -0). type Int is Data: IPos{n: Nat} INeg{n: Nat} Core.Raw (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Raw) type Raw is Data: RNum{n: Nat} RBool{b: Bool} RNull{} RStr{s: String} RBad{} RTooBig{} RMissing{} RNil{} RCons{head: Raw, tail: Raw} REnd{} … Core.Schema (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Schema) type Schema is Data: SNat{} SNatIn{lo: Nat, hi: Nat} SStr{} SStrLen{lo: Nat, hi: Nat, s: Schema} SOpt{inner: Schema} SList{elem: Schema} SField{name: String, s: Schema, rest: Schema} SEnd{} SRule{s: Schema, tag: Nat} SStrict{s: Schema} … Core.Step (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Step) # A step of a path. Positions count what was passed on the way, so that # following a path never compares two names: AtIndex{i} is element i of a # list, AtField{skip, name} the field `skip` places after this one in the # schema, BoundAt{i, key} the bound of element i of a bounded list. The names # are for the host to print. type Step is Data: AtIndex{i: Nat} AtField{skip: Nat, name: String} BoundAt{i: Nat, key: String} AtKey{key: String} Core.Why (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Why) type Why is Data: Missing{} NotNat{} NotString{} NotBool{} NotList{} NotObject{} NoElements{} OpenNotLast{} LastNotOpen{} NotIncreasing{prev: Nat, got: Nat} … Core.Err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Err) type Err is Data: Err{path: List<&2, Step>, why: Why} Core.finite_number (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=finite_number) # JSON numbers use IEEE-754 binary64 bits. The exponent occupies the high # word's bits 20 through 30; all ones denotes infinity or NaN. def finite_number(bits: NumberBits) -> Bool: Core.valid_json (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=valid_json) # A value is valid when every number in it is finite. Whether a name repeats # in an object is not checked: RFC 8259 only says names should be unique, a # host's object cannot hold a name twice, and checking it would cost every # member a scan of the members after it. def valid_json(value: Json) -> Bool: Core.pick_raw (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=pick_raw) def pick_raw(b: Bool, +x: Raw, +y: Raw) -> Raw: Core.lookup (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=lookup) # The value under `name` in an object, or RMissing. def lookup(+name: String, r: Raw) -> Raw: Core.pick_bool (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=pick_bool) def pick_bool(b: Bool, +x: Bool, +y: Bool) -> Bool: Core.is_rnil (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_rnil) def is_rnil(r: Raw) -> Bool: Core.is_missing (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_missing) def is_missing(v: Raw) -> Bool: Core.in_names (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=in_names) def in_names(+x: String, names: List<&2, String>) -> Bool: Core.none_present (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=none_present) # None of the keys of a variant chain is in the object r. def none_present(s: Schema, +r: Raw) -> Bool: Core.key_names (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=key_names) # ---- a strict object: its keys ---- # # The names a record or variant chain declares. SStrict refuses a key that is # not one of them; wf asks that SStrict wrap such a chain. def key_names(s: Schema) -> List<&2, String>: Core.no_extra (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=no_extra) # Every key of the object r is one of ns (anything but an object has none). def no_extra(+ns: List<&2, String>, r: Raw) -> Bool: Core.drop_key (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=drop_key) # The object r without its first key k (what lookup(k, r) reads). def drop_key(+k: String, r: Raw) -> Raw: Core.is_str (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_str) def is_str(+n: String, v: Raw) -> Bool: Core.is_tag (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_tag) # The tag under k is the string n. def is_tag(+k: String, +n: String, r: Raw) -> Bool: Core.in_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=in_err) def in_err(b: Bool, w: Why) -> Maybe<&2, Err>: Core.str_len_ok (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=str_len_ok) def str_len_ok(+lo: Nat, +hi: Nat, +x: String) -> Bool: Core.num_ok (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=num_ok) def num_ok(+lo: Nat, +hi: Nat, +n: Nat) -> Bool: Core.int_le (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=int_le) # a <= b on integers. A negative is below every non-negative, and between two # negatives the larger offset is the smaller number. def int_le(a: Int, b: Int) -> Bool: Core.int_ok (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=int_ok) def int_ok(+lo: Int, +hi: Int, +i: Int) -> Bool: Core.int_raw (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=int_raw) # How an integer is written: a non-negative as RNum, a negative as RNeg. def int_raw(i: Int) -> Raw: Core.len_ok (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=len_ok) # r is a string whose length is in the bounds: what conforms reads at an # SStrLen, and what len_err refuses exactly when it fails. def len_ok(+lo: Nat, +hi: Nat, r: Raw) -> Bool: Core.str_len_in (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=str_len_in) # The same bounds as ready-made rules: a project's rule calls them by tag # (`case 0n: str_len_in(1n, 64n, r)`), since a tag carries no numbers. Each # refuses only the value it is about -- a string, a number -- and leaves any # other kind to the schema's own check; the constructors below read the tests # directly, because their bound is in the schema. def str_len_in(+lo: Nat, +hi: Nat, r: Raw) -> Maybe<&2, Err>: Core.nat_in (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=nat_in) def nat_in(+lo: Nat, +hi: Nat, r: Raw) -> Maybe<&2, Err>: Core.is_bool (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_bool) def is_bool(r: Raw) -> Bool: Core.raw_list (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=raw_list) def raw_list(r: Raw) -> Bool: Core.raw_len (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=raw_len) def raw_len(r: Raw) -> Nat: Core.count_ok (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=count_ok) def count_ok(+lo: Nat, +hi: Nat, +r: Raw) -> Bool: Core.list_len_ok (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=list_len_ok) def list_len_ok(+lo: Nat, +hi: Nat, +r: Raw) -> Bool: Core.has_key (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=has_key) # k is a key of the object r. def has_key(+k: String, r: Raw) -> Bool: Core.key_once_at (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=key_once_at) # name appears at most once among the keys of the object r. b is whether a key # read before r was already name; the flag carries forward, and a key that is # name while the flag is set is the second one -- refused here and nowhere # else. The value is the first argument because a self-call must read its # arguments left to right, unchanged until one shrinks, and only the value # shrinks; the value is matched first because a match cannot be nested inside # the branch of a match on another parameter. One pass, so a walk costs one # key per key, the same as the lookup beside it. def key_once_at(r: Raw, +b: Bool, +name: String) -> Bool: Core.key_once (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=key_once) # name appears at most once among the keys of the object r: nothing has been # read yet. def key_once(+name: String, r: Raw) -> Bool: Core.key_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=key_err) # The repeated key as check reports it: at the key's own name, with no step # after it (the second occurrence is not a place in the schema). The test is # passed in rather than read here (a match cannot scrutinize a computed value): # b is key_once(name, r), so nothing is reported exactly when key_once holds, # which is what check_exact needs. def key_err(b: Bool, +name: String) -> Maybe<&2, Err>: Core.JKind (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=JKind) type JKind is Data: KNum{} KStr{} KBool{} KList{} KObj{} KNull{} KAbsent{} KJson{} KOther{} Core.kind_eq (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=kind_eq) def kind_eq(a: JKind, b: JKind) -> Bool: Core.kind_of (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=kind_of) def kind_of(r: Raw) -> JKind: Core.has_kind (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=has_kind) def has_kind(s: Schema, +k: JKind) -> Bool: Core.apart (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=apart) # No value of kind k is claimed by both. def apart(+l: Schema, +r: Schema, +k: JKind) -> Bool: Core.disjoint (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=disjoint) def disjoint(+l: Schema, +r: Schema) -> Bool: Core.alt_ok (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=alt_ok) # An alternative is a value that is present and has a kind of its own: not an # absent field (the host writes no key, so no kind is there to pick by), and # not s.json(), which takes every kind. def alt_ok(+s: Schema) -> Bool: Core.no_alt (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=no_alt) # What an SEither would have taken, for the host to say. def no_alt(+s: Schema) -> Why: Core.conforms (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=conforms) def conforms(~rule: Nat -> Raw -> Maybe<&2, Err>, s: Schema, r: Raw, +prev: Maybe<&2, Nat>) -> Bool: Core.here (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=here) def here(w: Why) -> Maybe<&2, Err>: Core.under (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=under) # An error found under a step gets the step in front of its path. def under(+st: Step, m: Maybe<&2, Err>) -> Maybe<&2, Err>: Core.len_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=len_err) # At an SStrLen the shape comes first, as everywhere else: a value that is not # a string is NotString, a string out of its bounds is LengthNotIn, and a node # the codec refused to build or that is absent reads as it does at every kind. def len_err(+lo: Nat, +hi: Nat, r: Raw) -> Maybe<&2, Err>: Core.later_l_path (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=later_l_path) # An error found further along a list is one element further: its first # step, if it counts elements, counts one more. A plain list's steps are # AtIndex; a bounded list's are AtIndex and BoundAt. def later_l_path(p: List<&2, Step>) -> List<&2, Step>: Core.later_l (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=later_l) def later_l(m: Maybe<&2, Err>) -> Maybe<&2, Err>: Core.later_i_path (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=later_i_path) def later_i_path(p: List<&2, Step>) -> List<&2, Step>: Core.later_i (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=later_i) def later_i(m: Maybe<&2, Err>) -> Maybe<&2, Err>: Core.later_f_path (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=later_f_path) # An error found in a later field is one field further. def later_f_path(p: List<&2, Step>) -> List<&2, Step>: Core.later_f (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=later_f) def later_f(m: Maybe<&2, Err>) -> Maybe<&2, Err>: Core.first (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=first) # The first of two: the second counts only when the first found nothing. def first(m: Maybe<&2, Err>, n: Maybe<&2, Err>) -> Maybe<&2, Err>: Core.missing_or (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=missing_or) # The reason a value that is not the shape is refused, at the place it was # found: an absent slot is Missing, a node the host refused to build (RTooBig) # is TooLarge, anything else is the schema kind's own reason. check and the # defect helpers both answer through here, so the reason a path reports is the # same one for both. def missing_or(r: Raw, w: Why) -> Why: Core.pick_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=pick_err) def pick_err(b: Bool, +x: Maybe<&2, Err>, +y: Maybe<&2, Err>) -> Maybe<&2, Err>: Core.true_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=true_err) def true_err(b: Bool) -> Maybe<&2, Err>: Core.enum_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=enum_err) def enum_err(b: Bool) -> Maybe<&2, Err>: Core.dup_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=dup_err) # A second key of a variant chain in the object r: the first one found. def dup_err(s: Schema, +r: Raw) -> Maybe<&2, Err>: Core.extra_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=extra_err) # The first key of r that is not one of ns, at its own name. def extra_err(+ns: List<&2, String>, r: Raw) -> Maybe<&2, Err>: Core.tag_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=tag_err) # At the end of a tagged chain no case matched: the value is not an object, # or its tag is missing, or it names no case. def tag_err(+k: String, r: Raw) -> Maybe<&2, Err>: Core.count_err (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=count_err) # The count, as an error: at an SListLen the count is read before any element, # so a list out of bounds is CountNotIn at the list's own path. A value that is # not a list has no count to object to, and is refused as a list schema refuses # it: NotList, or Missing/TooLarge for the two nodes that are never a shape # (the same reasons check's own arms give them). def count_err(+lo: Nat, +hi: Nat, r: Raw) -> Maybe<&2, Err>: Core.check (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=check) def check(~rule: Nat -> Raw -> Maybe<&2, Err>, s: Schema, r: Raw, +prev: Maybe<&2, Nat>) -> Maybe<&2, Err>: Core.guard (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=guard) def guard(b: Bool, m: Maybe<&2, Why>) -> Maybe<&2, Why>: Core.nat_in_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=nat_in_defect) # The same two reasons at an SNatIn and an SBool, replayed along a path: the # value's own kind is the defect when the path ends here, and it is not a # defect at all further along (the walk passed it). def nat_in_defect(+lo: Nat, +hi: Nat, r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.int_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=int_defect) # The same two reasons at an SInt and an SIntIn: a number of either sign is not # the defect, and its bound is the defect only where the path ends. def int_defect(r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.int_in_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=int_in_defect) def int_in_defect(+lo: Int, +hi: Int, r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.bool_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=bool_defect) def bool_defect(r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.no_rule (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=no_rule) def no_rule(tag: Nat, r: Raw) -> Maybe<&2, Err>: Core.first_why (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=first_why) def first_why(m: Maybe<&2, Why>, +n: Maybe<&2, Why>) -> Maybe<&2, Why>: Core.step_eq (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=step_eq) def step_eq(x: Step, y: Step) -> Bool: Core.path_eq (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=path_eq) def path_eq(x: List<&2, Step>, y: List<&2, Step>) -> Bool: Core.rule_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=rule_defect) def rule_defect(m: Maybe<&2, Err>, +p: List<&2, Step>) -> Maybe<&2, Why>: Core.not_list (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=not_list) def not_list(x: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.not_object (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=not_object) def not_object(x: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.nat_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=nat_defect) def nat_defect(r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.str_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=str_defect) def str_defect(r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.pick_why (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=pick_why) def pick_why(b: Bool, +x: Maybe<&2, Why>, +y: Maybe<&2, Why>) -> Maybe<&2, Why>: Core.true_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=true_defect) def true_defect(r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.enum_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=enum_defect) def enum_defect(names: List<&2, String>, r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.no_variant (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=no_variant) def no_variant(p: List<&2, Step>) -> Maybe<&2, Why>: Core.dup_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=dup_defect) # The claim about a second key: every key passed is absent, and the key the # path names is there. def dup_defect(s: Schema, +r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.at_end (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=at_end) def at_end(w: Why, p: List<&2, Step>) -> Maybe<&2, Why>: Core.extra_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=extra_defect) # At a strict object the path is one key, and the replay checks it on its # own: the key is there, and it is not one of the names. def extra_defect(ns: List<&2, String>, +r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.tag_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=tag_defect) def tag_defect(+k: String, r: Raw, p: List<&2, Step>) -> Maybe<&2, Why>: Core.tag_key_defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=tag_key_defect) # The tag key of a tagged case, taken twice, as defect replays it. check # reports it before the case's own schema is walked -- there is no place in the # schema for the second occurrence -- so the path is one field step at the # tag's own name and nothing after it. b is whether the key is not read once, # so nothing is reported exactly when key_once holds; a path of any other shape # is the case's own report, which the walk below answers. def tag_key_defect(b: Bool, +k: String, p: List<&2, Step>) -> Maybe<&2, Why>: Core.defect (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=defect) def defect(~rule: Nat -> Raw -> Maybe<&2, Err>, s: Schema, r: Raw, +prev: Maybe<&2, Nat>, p: List<&2, Step>) -> Maybe<&2, Why>: Core.check0 (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=check0) def check0(s: Schema, r: Raw) -> Maybe<&2, Err>: Core.conforms0 (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=conforms0) def conforms0(s: Schema, r: Raw) -> Bool: Core.is_chain (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_chain) def is_chain(s: Schema) -> Bool: Core.is_object (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=is_object) def is_object(r: Raw) -> Bool: Core.one_if_there (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=one_if_there) def one_if_there(b: Bool) -> Nat: Core.count_present (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=count_present) def count_present(s: Schema, +r: Raw) -> Nat: Core.present_conform (https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=present_conform) def present_conform(~rule: Nat -> Raw -> Maybe<&2, Err>, +s: Schema, +r: Raw) -> Bool: More: https://jend.leeeet.dev/packages/bend-schema-lib.txt?definitions_offset=100