Constrain sequence lenses so that an absent declaration is not valid #2
Labels
bug
Something isn't working
invariants
Involves the definition or enforcement of a key system invariant
A key invariant of scuemata is that authors must define lenses for all sequences after the first. While it's impossible to generically verify the completeness of the translations in these lenses, or the lacunae the may emit, the bare minimum here is erroring if the author doesn't define a lens, at all.
Unfortunately, when we take the
#Lens
definitionthema/lineage.cue
Lines 48 to 67 in b7b4330
and reference it directly in
seqs
where we want lens instances to appear:thema/lineage.cue
Lines 72 to 80 in b7b4330
it means that a lineage is still valid even when the author omits the field. The questions are:
#Lens
itself be refactored so that it's more amenable to doing this?Maybe this is just yet another place where we need a
must()
check (cue-lang/cue#943), particularly to emit the right error.Note that this issue is targeting a relatively minimal check - to climb up to our true-goal invariant, in addition to basic lens existence, we have to be certain that a) the Lens connects the end of the prior sequence to the head of its current sequence, and b) that given a concrete input valid wrt the predecessor schema, the
rel
of both forward and reverse lenses is sufficient to produce a concrete output of the successor schema.The text was updated successfully, but these errors were encountered: