refactor(mix_protocol): export breakpoint bounds as oneOf - #1059
Merged
Merged
Conversation
_BreakpointBoundsConstraint spelled its either/or as if/then/else with a
nested not. `oneOf: [{required: [token]}, hasBounds]` has the identical
truth table -- token alone matches one branch, a width bound alone
matches one branch, both match two, neither matches zero -- and drops
the nested negation along with the duplicated anyOf block at each of the
23 style and 53 chart breakpoint sites.
Every accepted and rejected document is unchanged: all 284 checked-in
fixtures across the four suites still validate identically under Ajv.
Ajv still needs strictRequired disabled. Its lint does not resolve
`required` through an applicator branch, so oneOf trips it exactly as if
did; the comment now describes the current spelling instead of the old
one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
_BreakpointBoundsConstraint.toJsonSchema()spelled its either/or asif/then/elsewrapped around anot. This replaces it withoneOf:Identical truth table — token alone matches one branch, a width bound alone matches one branch, both match two, neither matches zero — which is exactly what
isValidenforces.Why
The
if/then/elseform needed a nested negation and a second copy of thehasBoundsblock per site. TheoneOfform needs neither. Net effect on the checked-in goldens:if/then/else/notoneOfanyOf(style)The
anyOfdrop is exactly the 23 duplicatedhasBoundsblocks. Baseline had zerooneOf, so nothing was clobbered by the new key.Verification
tool/schema-checkvalidates all 284 fixtures across the four suites with Ajv: 284/284, same verdicts as before.mix_protocol404 tests,mix_chart_protocol15,mix_winds824 — green.dart analyzeclean on all three,dart formatclean.melos run schema:fixturesproduces no further diff).mix_chart_protocolis regenerated too, since it shares the codec and its checked-in schema had 53 staleifsites.One thing that did not change
Ajv still needs
strictRequired: false. Its lint does not resolverequiredagainst the parent'spropertiesthrough any applicator branch, sooneOftrips it exactly asifdid — I tested enabling it and all three suites still fail to compile. The option stays; its comment now describes the current spelling rather than the old one.