fix: address Copilot review round 28 — the boolean schema form in a null-admitting union
`anyOfAdmitsNull` sent every non-object member to `toBranch` and refused it,
so `{ const: null, anyOf: [true] }` read as non-nullable — a required field
seeded and rendered read-only as `null` and reported missing forever. `true`
is the unconstrained schema and admits every value, `null` among them;
`false` admits none and still does not.
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
c8c5442dcf
commit
6ac45d9b26
1 changed files with 9 additions and 0 deletions
|
|
@ -768,6 +768,12 @@ describe("admitsNull", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("reads the boolean schema form", () => {
|
||||
// `true` is the unconstrained schema; `false` admits nothing at all.
|
||||
expect(admitsNull({ const: null, anyOf: [true] })).toBe(true);
|
||||
expect(admitsNull({ const: null, anyOf: [false] })).toBe(false);
|
||||
});
|
||||
|
||||
it("does not override a sibling that rejects null", () => {
|
||||
// `const` is conjunctive with its siblings, not an override: both of
|
||||
// these reject every value, so claiming nullability would let the
|
||||
|
|
|
|||
Loading…
Reference in a new issue