fn field_optionality(
value: &str,
decls: &BTreeMap<String, String>,
) -> (bool, Option<String>)Expand description
Whether a field is required, and how that was decided when the Zod chain could not decide it.
The chain is the reliable signal. A field whose value is nothing but an
identifier has no chain to read — metadata: OptionalMetadataSchema — so
the identifier is followed to its declaration when this file makes one, and
otherwise its name is all there is to go on. Upstream’s convention is that
such a const says what it is, and reading the name beats the alternative
this replaces: an imported optional schema used to be recorded as required,
which is how BaseEvent.metadata would have entered the baseline as a
required field nobody agreed to. The reading is reported as a note, so the
human accepting a refresh can see it was a reading and not a parse.