Skip to content

checkDefault incorrectly flags "null" default values #779

@Bitshifter-9

Description

@Bitshifter-9

There’s a bug in checkDefault where it checks typeof field instead of typeof field.default. Because of this, nullable fields with a default value of "null" are incorrectly reported as invalid.

I verified the issue using a small reproduction script (repro_bug_standalone.js):

Before the fix: "null" defaults were incorrectly flagged.

After the fix: The check works correctly.

The corrected logic is:

if (
!field.notNull &&
typeof field.default === "string" &&
field.default.toLowerCase() === "null"
)
return true;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions