[chef-dev] Re: Re: Re: Attribute Validation with chef-attribute-validator

Chronological Thread 
  • From: Clinton Wolfe < >
  • To:
  • Subject: [chef-dev] Re: Re: Re: Attribute Validation with chef-attribute-validator
  • Date: Fri, 15 Nov 2013 17:08:18 -0800

FYI, I added proc support in v0.3.0 of the chef-attribute-validator gem, a mere 2 days ago :-)

Sounds like reading metadata.rb for attribute validation rules is fraught with peril.  I'll leave it be, then.  

On Fri, Nov 15, 2013 at 12:46 PM, Nathan Smith < " target="_blank"> > wrote:
On Fri, Nov 15, 2013 at 11:29 AM, Daniel DeLeo < " target="_blank"> > wrote:

Finally, my own inclination is that it’s better to define these things in code. As a major sticking point, there’s no “proc” type in JSON (how could there be?), but that would give you the most sane path to implementing validations that the framework doesn’t support yet. For example, if the framework doesn’t support integer ranges, I can easily write a bit of code to check if a number is in a range (so it’s a valid port number, say). With static data, such a thing wouldn’t be possible.

Not suggesting we use it, but JSON Schema does support things like ranges and other attributes, though it still doesn't let you use code: http://json-schema.org/latest/json-schema-validation.html#anchor12

Archive powered by MHonArc 2.6.16.