json-fuzz-generator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +100 -0
  8. data/Rakefile +7 -0
  9. data/json-fuzz-generator.gemspec +28 -0
  10. data/lib/json-fuzz-generator.rb +5 -0
  11. data/lib/json/fuzz/generator.rb +160 -0
  12. data/lib/json/fuzz/generator/keyword.rb +9 -0
  13. data/lib/json/fuzz/generator/keyword/additional_properties.rb +61 -0
  14. data/lib/json/fuzz/generator/keyword/all_of.rb +46 -0
  15. data/lib/json/fuzz/generator/keyword/any_of.rb +43 -0
  16. data/lib/json/fuzz/generator/keyword/dependencies.rb +49 -0
  17. data/lib/json/fuzz/generator/keyword/enum.rb +33 -0
  18. data/lib/json/fuzz/generator/keyword/format.rb +93 -0
  19. data/lib/json/fuzz/generator/keyword/items.rb +68 -0
  20. data/lib/json/fuzz/generator/keyword/max_items.rb +44 -0
  21. data/lib/json/fuzz/generator/keyword/max_length.rb +29 -0
  22. data/lib/json/fuzz/generator/keyword/max_properties.rb +44 -0
  23. data/lib/json/fuzz/generator/keyword/maximum.rb +46 -0
  24. data/lib/json/fuzz/generator/keyword/min_items.rb +44 -0
  25. data/lib/json/fuzz/generator/keyword/min_length.rb +29 -0
  26. data/lib/json/fuzz/generator/keyword/min_properties.rb +39 -0
  27. data/lib/json/fuzz/generator/keyword/minimum.rb +45 -0
  28. data/lib/json/fuzz/generator/keyword/multiple_of.rb +29 -0
  29. data/lib/json/fuzz/generator/keyword/not.rb +28 -0
  30. data/lib/json/fuzz/generator/keyword/one_of.rb +45 -0
  31. data/lib/json/fuzz/generator/keyword/pattern.rb +19 -0
  32. data/lib/json/fuzz/generator/keyword/properties.rb +40 -0
  33. data/lib/json/fuzz/generator/keyword/required.rb +41 -0
  34. data/lib/json/fuzz/generator/keyword/unique_items.rb +33 -0
  35. data/lib/json/fuzz/generator/primitive_type.rb +40 -0
  36. data/lib/json/fuzz/generator/primitive_type/array.rb +53 -0
  37. data/lib/json/fuzz/generator/primitive_type/boolean.rb +32 -0
  38. data/lib/json/fuzz/generator/primitive_type/integer.rb +56 -0
  39. data/lib/json/fuzz/generator/primitive_type/null.rb +33 -0
  40. data/lib/json/fuzz/generator/primitive_type/number.rb +52 -0
  41. data/lib/json/fuzz/generator/primitive_type/object.rb +57 -0
  42. data/lib/json/fuzz/generator/primitive_type/string.rb +53 -0
  43. data/lib/json/fuzz/generator/version.rb +7 -0
  44. data/spec/json-fuzz-generator_spec.rb +559 -0
  45. data/spec/schemas/basic_schema.json +17 -0
  46. data/spec/schemas/primitive_types.json +35 -0
  47. data/spec/spec_helper.rb +25 -0
  48. metadata +178 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "title": "Basic Schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "id" : {
6
+ "type": "integer"
7
+ },
8
+ "name": {
9
+ "type": "string"
10
+ },
11
+ "age": {
12
+ "description": "Age in years",
13
+ "type": "integer",
14
+ "minimum": 0
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "title": "Primitive Types Schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "arrayKey": {
6
+ "type": "array"
7
+ },
8
+ "booleanKey": {
9
+ "type": "boolean"
10
+ },
11
+ "integerKey": {
12
+ "type": "integer"
13
+ },
14
+ "numberKey": {
15
+ "type": "number"
16
+ },
17
+ "nullKey": {
18
+ "type": "null"
19
+ },
20
+ "objectKey": {
21
+ "type": "object",
22
+ "properties": {
23
+ "nested_string": {
24
+ "type": "string"
25
+ },
26
+ "nested_integer": {
27
+ "type": "integer"
28
+ }
29
+ }
30
+ },
31
+ "stringKey": {
32
+ "type": "string"
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,25 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'json-fuzz-generator'
3
+ require 'json-schema'
4
+ require 'pry'
5
+
6
+ SPEC_ROOT = File.expand_path(File.dirname(__FILE__), ".")
7
+ SPEC_SCHEMA_ROOT = File.join(SPEC_ROOT, "schemas")
8
+
9
+ RSpec::Matchers.define :be_matching_schema do |schema|
10
+ match do |actual|
11
+ JSON::Validator.validate(schema, actual) == true
12
+ end
13
+ failure_message do |actual|
14
+ "expected #{actual} to be match schema: #{schema}"
15
+ end
16
+ end
17
+
18
+ RSpec::Matchers.define :be_not_matching_schema do |expected|
19
+ match do |actual|
20
+ JSON::Validator.validate(schema, actual) == false
21
+ end
22
+ failure_message do |actual|
23
+ "expected #{actual} not to be match schema: #{schema}"
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: json-fuzz-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - deme0607
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json-schema
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: randexp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Fuzz parameter gemerator from json-schema
98
+ email:
99
+ - hcs0035@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - json-fuzz-generator.gemspec
112
+ - lib/json-fuzz-generator.rb
113
+ - lib/json/fuzz/generator.rb
114
+ - lib/json/fuzz/generator/keyword.rb
115
+ - lib/json/fuzz/generator/keyword/additional_properties.rb
116
+ - lib/json/fuzz/generator/keyword/all_of.rb
117
+ - lib/json/fuzz/generator/keyword/any_of.rb
118
+ - lib/json/fuzz/generator/keyword/dependencies.rb
119
+ - lib/json/fuzz/generator/keyword/enum.rb
120
+ - lib/json/fuzz/generator/keyword/format.rb
121
+ - lib/json/fuzz/generator/keyword/items.rb
122
+ - lib/json/fuzz/generator/keyword/max_items.rb
123
+ - lib/json/fuzz/generator/keyword/max_length.rb
124
+ - lib/json/fuzz/generator/keyword/max_properties.rb
125
+ - lib/json/fuzz/generator/keyword/maximum.rb
126
+ - lib/json/fuzz/generator/keyword/min_items.rb
127
+ - lib/json/fuzz/generator/keyword/min_length.rb
128
+ - lib/json/fuzz/generator/keyword/min_properties.rb
129
+ - lib/json/fuzz/generator/keyword/minimum.rb
130
+ - lib/json/fuzz/generator/keyword/multiple_of.rb
131
+ - lib/json/fuzz/generator/keyword/not.rb
132
+ - lib/json/fuzz/generator/keyword/one_of.rb
133
+ - lib/json/fuzz/generator/keyword/pattern.rb
134
+ - lib/json/fuzz/generator/keyword/properties.rb
135
+ - lib/json/fuzz/generator/keyword/required.rb
136
+ - lib/json/fuzz/generator/keyword/unique_items.rb
137
+ - lib/json/fuzz/generator/primitive_type.rb
138
+ - lib/json/fuzz/generator/primitive_type/array.rb
139
+ - lib/json/fuzz/generator/primitive_type/boolean.rb
140
+ - lib/json/fuzz/generator/primitive_type/integer.rb
141
+ - lib/json/fuzz/generator/primitive_type/null.rb
142
+ - lib/json/fuzz/generator/primitive_type/number.rb
143
+ - lib/json/fuzz/generator/primitive_type/object.rb
144
+ - lib/json/fuzz/generator/primitive_type/string.rb
145
+ - lib/json/fuzz/generator/version.rb
146
+ - spec/json-fuzz-generator_spec.rb
147
+ - spec/schemas/basic_schema.json
148
+ - spec/schemas/primitive_types.json
149
+ - spec/spec_helper.rb
150
+ homepage: https://github.com/deme0607/json-fuzz-generator
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.2.2
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Fuzz parameter gemerator from json-schema
174
+ test_files:
175
+ - spec/json-fuzz-generator_spec.rb
176
+ - spec/schemas/basic_schema.json
177
+ - spec/schemas/primitive_types.json
178
+ - spec/spec_helper.rb