Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Error when trying to validate sub attribute of null #17

@javve

Description

@javve

I have a constraint looking like this:

  'copy.primaryColor':
    format:
      pattern: "^#(?:[0-9a-f]{3}){1,2}$"
      flags: "i"
      message: "must be a valid hex color"

The problem is that everything breaks if copy is null.

TypeError: Cannot use 'in' operator to search for 'primaryColor' in null
  at Function.v.extend.getDeepObjectValue (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:310:18)
  at Function.v.extend.runValidations (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:66:19)
  at Function.v.extend.async (/Users/javve/Git/confetti/confetti-api/node_modules/validate.js/validate.js:129:23)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions