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

Error when trying to validate sub attribute of null #17

Closed
javve opened this issue Jan 8, 2015 · 3 comments
Closed

Error when trying to validate sub attribute of null #17

javve opened this issue Jan 8, 2015 · 3 comments

Comments

@javve
Copy link

javve commented Jan 8, 2015

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)
@ansman
Copy link
Owner

ansman commented Jan 10, 2015

Interesting, I'll take a closer look when I'm back from vacation

On Thu, Jan 8, 2015 at 10:50 PM, Jonny Strömberg notifications@github.com
wrote:

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)

Reply to this email directly or view it on GitHub:
#17

@javve
Copy link
Author

javve commented Jan 11, 2015

👍 ✌️

@ansman ansman closed this as completed in 892328a Jan 20, 2015
@javve
Copy link
Author

javve commented Jan 21, 2015

WOHO! ❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants