Class: JSONSchemer::Fuzz::Keyword::Properties
- Inherits:
-
Object
- Object
- JSONSchemer::Fuzz::Keyword::Properties
- Defined in:
- lib/json_schemer/fuzz/keyword/properties.rb
Class Method Summary collapse
Class Method Details
.invalid_params(attributes) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/json_schemer/fuzz/keyword/properties.rb', line 6 def invalid_params(attributes) properties = attributes["members"] || attributes["properties"] raise "No properties or members keyword given: #{attributes}" unless properties generated_params = [] properties.each do |key, attribute| JSONSchemer::Fuzz.generate(attribute).each do |invalid_param| template = JSONSchemer::Fuzz.default_param(attributes) generated_params << template.merge(key => invalid_param) end end generated_params end |
.valid_param(attributes) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/json_schemer/fuzz/keyword/properties.rb', line 22 def valid_param(attributes) properties = attributes["members"] || attributes["properties"] raise "No properties or members keyword given: #{attributes}" unless properties generated_param = {} properties.each do |key, attribute| generated_param[key] = JSONSchemer::Fuzz.default_param(attribute) end generated_param end |