RFC7159 7159 → 7159.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +14 -2
- data/RFC7159.gemspec +2 -2
- data/Rakefile +4 -1
- data/lib/RFC7159.rb +4 -4
- data/lib/RFC7159/array.rb +1 -1
- data/lib/RFC7159/dumper.rb +1 -1
- data/lib/RFC7159/number.rb +1 -1
- data/lib/RFC7159/parser.ry +24 -12
- data/lib/RFC7159/string.rb +8 -5
- data/lib/RFC7159/version.rb +1 -1
- data/spec/RFC7159_spec.rb +48 -29
- data/spec/acceptance/invalid/0003-literals/0008-undefined.txt +1 -1
- data/spec/acceptance/invalid/0004-numbers/0011-Infinity.txt +1 -1
- data/spec/acceptance/invalid/0008-hashes/0009-key-not-escaped.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0001-JSONP.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0002-new-Array.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0003-new-Date.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0004-new-Error.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0005-Math.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0006-regular-expression.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0007-function.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0008-this.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0009-plusplus.txt +1 -1
- data/spec/acceptance/invalid/0009-javascriptisms/0010-ternary-operator.txt +1 -1
- data/spec/acceptance/valid/0005-strings/0010-escaped-separated-surrogate.json +1 -0
- data/spec/acceptance/valid/0005-strings/0011-escaped-surrogate-then-normal.json +1 -0
- data/spec/acceptance/valid/0008-hashes/{0011-duplicate-key-in-different-representations.json → 0012-duplicate-key-in-different-representations.json} +0 -0
- data/spec/acceptance/valid/0009-complicated/0001-jsonschema.json +46 -0
- data/spec/acceptance/valid/0009-complicated/0002-example-in-RFC7159-section-13.json +14 -0
- data/spec/acceptance/valid/0009-complicated/0003-example-in-RFC7159-section-13.json +22 -0
- data/spec/spec_helper.rb +4 -0
- metadata +20 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ee68a25f2005231c7cba17030c5539069884a3e
|
4
|
+
data.tar.gz: 5d1b3e304935a20d83a968df182b601781bb532f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 671c63df9569a92d6a61b6abaae27727bd4c329c67d92fbf8e834b3cd15e1693bf2736244efabb1e79f02b09d62109b4dda0d51d2710eb3e9652d555f0a5c49a
|
7
|
+
data.tar.gz: 4c743e0d39b6fbc7f21af08390445a07caf81d5ccb62675a84467653e54d6dfa130e3d1de715040e652a21a1c6c317e1fb175d532fe5daf2967931dc2c689d0e
|
data/Gemfile
CHANGED
@@ -31,8 +31,20 @@
|
|
31
31
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
32
|
# POSSIBILITY OF SUCH DAMAGE.
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
begin
|
35
|
+
source 'https://rubygems.org'
|
36
|
+
gemspec
|
37
|
+
|
38
|
+
rescue Bundler::GemspecError
|
39
|
+
# HACK: in order to use bundler we need a valid gemspec, and a valid gemspec
|
40
|
+
# needs a valid parser.rb. A valid parser.rb needs racc, and racc needs
|
41
|
+
# bundler. So there is a circular dependency. We have to workaround.
|
42
|
+
|
43
|
+
require 'fileutils'
|
44
|
+
FileUtils.touch 'lib/RFC7159/parser.rb', mtime: 0
|
45
|
+
gemspec
|
46
|
+
end
|
47
|
+
|
36
48
|
|
37
49
|
#
|
38
50
|
# Local Variables:
|
data/RFC7159.gemspec
CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.authors = %w'Urabe, Shyouhei'
|
42
42
|
spec.email = %w'shyouhei@ruby-lang.org'
|
43
43
|
spec.summary = 'RFC7159 parser / generator'
|
44
|
-
spec.description = <<-'end'.gsub
|
44
|
+
spec.description = <<-'end'.gsub(/[\n\s]+/, ' ').strip
|
45
45
|
A JSON parser/generator that conforms (I believe) to RFC7159 "The
|
46
46
|
JavaScript Object Notation (JSON) Data Interchange Format". That RFC is
|
47
47
|
very different to its predecessor RFC4627, when it comes to parsing.
|
@@ -57,7 +57,7 @@ Gem::Specification.new do |spec|
|
|
57
57
|
spec.test_files = spec.files.grep(%r{^spec/})
|
58
58
|
spec.require_paths = %w'lib'
|
59
59
|
|
60
|
-
spec.required_ruby_version = '~> 2.
|
60
|
+
spec.required_ruby_version = '~> 2.0'
|
61
61
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
62
62
|
spec.add_development_dependency 'rake', '~> 10.1'
|
63
63
|
spec.add_development_dependency 'rdoc', '~> 4.0'
|
data/Rakefile
CHANGED
@@ -34,8 +34,8 @@
|
|
34
34
|
require 'rubygems'
|
35
35
|
require 'bundler'
|
36
36
|
require 'rake'
|
37
|
-
require "bundler/gem_tasks"
|
38
37
|
begin
|
38
|
+
require "bundler/gem_tasks"
|
39
39
|
Bundler.setup(:default, :development)
|
40
40
|
rescue Bundler::BundlerError => e
|
41
41
|
$stderr.puts e.message
|
@@ -62,6 +62,9 @@ end
|
|
62
62
|
desc "a la rails console"
|
63
63
|
task :console do
|
64
64
|
require_relative 'lib/RFC7159'
|
65
|
+
require 'json'
|
66
|
+
require 'yajl'
|
67
|
+
require 'oj'
|
65
68
|
require 'irb'
|
66
69
|
require 'irb/completion'
|
67
70
|
ARGV.clear
|
data/lib/RFC7159.rb
CHANGED
@@ -31,12 +31,12 @@
|
|
31
31
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
32
|
# POSSIBILITY OF SUCH DAMAGE.
|
33
33
|
|
34
|
-
require_relative 'RFC7159/parser'
|
35
|
-
require_relative 'RFC7159/value'
|
36
|
-
require_relative 'RFC7159/dumper'
|
37
|
-
|
38
34
|
# This is a RFC7159-conforming JSON parser/generator.
|
39
35
|
module RFC7159
|
36
|
+
require_relative 'RFC7159/parser'
|
37
|
+
require_relative 'RFC7159/value'
|
38
|
+
require_relative 'RFC7159/dumper'
|
39
|
+
|
40
40
|
# This is our Marshal.load -compat API
|
41
41
|
# @param [::String, IO] str The input
|
42
42
|
# @param [true, false] plain Output to be plain-old ruby object, or not.
|
data/lib/RFC7159/array.rb
CHANGED
data/lib/RFC7159/dumper.rb
CHANGED
@@ -162,7 +162,7 @@ class RFC7159::Dumper
|
|
162
162
|
# fast path
|
163
163
|
if str.valid_encoding?
|
164
164
|
str2 = str.encode Encoding::UTF_8
|
165
|
-
buf =
|
165
|
+
buf = str2.unpack('U*')
|
166
166
|
end
|
167
167
|
rescue Encoding::UndefinedConversionError
|
168
168
|
# str might be invalid, but that's OK as per RFC7159 section 8.2.
|
data/lib/RFC7159/number.rb
CHANGED
@@ -131,7 +131,7 @@ class RFC7159::Number < RFC7159::Value
|
|
131
131
|
@exp = exp && exp.join # nil, or 'e+ddd..'
|
132
132
|
|
133
133
|
# pre-cache common computations
|
134
|
-
@to_s =
|
134
|
+
@to_s = [@sign, @int, @frac, @exp].join.encode(Encoding::US_ASCII) # this must be OK
|
135
135
|
@to_s.freeze # just in case
|
136
136
|
@to_d = BigDecimal.new @to_s
|
137
137
|
end
|
data/lib/RFC7159/parser.ry
CHANGED
@@ -116,7 +116,7 @@ class RFC7159::Parser
|
|
116
116
|
| quotation_mark __chars__ quotation_mark { [ :string, *val[1] ] }
|
117
117
|
__chars__ : char { val }
|
118
118
|
| __chars__ char { [ *val[0], val[1] ] }
|
119
|
-
char : unescaped | escape __ctrl__ { val }
|
119
|
+
char : unescaped | escape __ctrl__ { val.flatten }
|
120
120
|
__ctrl__ : "\x22" # " quotation mark U+0022
|
121
121
|
| "\x5C" # \ reverse solidus U+005C
|
122
122
|
| "\x2F" # / solidus U+002F
|
@@ -160,7 +160,7 @@ end
|
|
160
160
|
@lineno = 1
|
161
161
|
@column = 1
|
162
162
|
|
163
|
-
case enc = firstchar.encoding
|
163
|
+
case @enc = firstchar.encoding
|
164
164
|
when Encoding::UTF_8,
|
165
165
|
Encoding::US_ASCII, # true subset of UTF-8
|
166
166
|
Encoding::UTF8_MAC, # true subset of UTF-8
|
@@ -180,7 +180,7 @@ end
|
|
180
180
|
# generate JSON texts with BOMs but _allows_ to accept.
|
181
181
|
#
|
182
182
|
# This parser can control whether to accept BOMs.
|
183
|
-
if @accept_bom and firstchar == "\u{feff}".encode(enc)
|
183
|
+
if @accept_bom and firstchar == "\u{feff}".encode(@enc)
|
184
184
|
@enum.next # consume
|
185
185
|
end
|
186
186
|
return do_parse
|
@@ -188,16 +188,28 @@ end
|
|
188
188
|
raise Encoding::CompatibilityError, <<-"end".gsub(/[\n\s]+/, ' ')
|
189
189
|
``JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32'', said
|
190
190
|
RFC7159 section 8.1. The given string is NOT in any of those
|
191
|
-
encodings (but #{enc.inspect}).
|
191
|
+
encodings (but #{@enc.inspect}).
|
192
192
|
end
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
196
|
private
|
197
|
+
def nl
|
198
|
+
@nl ||= Regexp.new('[\r\n]'.encode(@enc))
|
199
|
+
end
|
200
|
+
|
201
|
+
def sp
|
202
|
+
@nl ||= Regexp.new('\s'.encode(@enc))
|
203
|
+
end
|
204
|
+
|
205
|
+
def nm
|
206
|
+
@nl ||= Regexp.new('\d'.encode(@enc))
|
207
|
+
end
|
208
|
+
|
197
209
|
def next_token
|
198
210
|
chr = @enum.next
|
199
|
-
tok = chr # dfault
|
200
|
-
newline, @newline = @newline,
|
211
|
+
tok = chr.encode(Encoding::UTF_8) # dfault
|
212
|
+
newline, @newline = @newline, nl.match(chr)
|
201
213
|
if newline
|
202
214
|
@lineno += 1
|
203
215
|
@column = 1
|
@@ -214,8 +226,8 @@ end
|
|
214
226
|
when 0x5D..0x10FFFF then tok = :unescaped
|
215
227
|
else @state = :string # NG unicode
|
216
228
|
end
|
217
|
-
when :init then @state = (chr == '"') ? :string : :init
|
218
|
-
when :escaped then @state = (chr == 'u') ? :u1 : :string
|
229
|
+
when :init then @state = (chr.ord == '"'.ord) ? :string : :init
|
230
|
+
when :escaped then @state = (chr.ord == 'u'.ord) ? :u1 : :string
|
219
231
|
when :u1 then @state = :u2
|
220
232
|
when :u2 then @state = :u3
|
221
233
|
when :u3 then @state = :u4
|
@@ -240,16 +252,16 @@ end
|
|
240
252
|
'possible extra (dangling) comma?'
|
241
253
|
when ':'
|
242
254
|
'possible confusion of {} vs []?'
|
243
|
-
when
|
255
|
+
when sp
|
244
256
|
'possible space inside of a number?'
|
245
|
-
when
|
257
|
+
when nm
|
246
258
|
'possible lack of +/- in exponent?'
|
247
259
|
else
|
248
260
|
'unexpected character'
|
249
261
|
end
|
250
262
|
end
|
251
|
-
msg = sprintf 'Syntax error near line %d, char %d (%p): %s',
|
252
|
-
@lineno, @column, val, reason
|
263
|
+
msg = sprintf 'Syntax error near line %d, char %d (%p) @ %p: %s',
|
264
|
+
@lineno, @column, val, @enum, reason
|
253
265
|
raise Racc::ParseError, msg
|
254
266
|
end
|
255
267
|
|
data/lib/RFC7159/string.rb
CHANGED
@@ -68,7 +68,10 @@ class RFC7159::String < RFC7159::Value
|
|
68
68
|
|
69
69
|
# @return [string] original string
|
70
70
|
def to_json *;
|
71
|
-
'"'
|
71
|
+
# Here '"', which is UTF-8, and @orig, which might be UTF-16, should be
|
72
|
+
# aligned. We take UTF-8 because we are not interested in generating
|
73
|
+
# UTF-16 JSON and so on.
|
74
|
+
'"' << @orig.flatten.join('').encode(Encoding::UTF_8) << '"'
|
72
75
|
end
|
73
76
|
|
74
77
|
# String comparisons are defined in RFC7159 section 8.3. We follow that.
|
@@ -86,8 +89,8 @@ class RFC7159::String < RFC7159::Value
|
|
86
89
|
enc = ary[0][0].encoding rescue Encoding::US_ASCII # empty string
|
87
90
|
path1 = ary.map do |i|
|
88
91
|
case i when Array
|
89
|
-
# ['\\',
|
90
|
-
case i[1]
|
92
|
+
# ['\\', 'u', 'F', 'F', 'E', 'E'] or something
|
93
|
+
case i[1].encode(Encoding::US_ASCII)
|
91
94
|
when "\x22" then 0x0022 # " quotation mark U+0022
|
92
95
|
when "\x5C" then 0x005C # \ reverse solidus U+005C
|
93
96
|
when "\x2F" then 0x002F # / solidus U+002F
|
@@ -96,8 +99,8 @@ class RFC7159::String < RFC7159::Value
|
|
96
99
|
when "\x6E" then 0x000A # n line feed U+000A
|
97
100
|
when "\x72" then 0x000D # r carriage return U+000D
|
98
101
|
when "\x74" then 0x0009 # t tab U+0009
|
99
|
-
else
|
100
|
-
i[
|
102
|
+
else "\x75" # uXXXX U+XXXX
|
103
|
+
i[2..5].join.encode(Encoding::US_ASCII).to_i 16
|
101
104
|
end
|
102
105
|
else
|
103
106
|
i.ord
|
data/lib/RFC7159/version.rb
CHANGED
data/spec/RFC7159_spec.rb
CHANGED
@@ -38,43 +38,60 @@ describe RFC7159 do
|
|
38
38
|
this_dir = Pathname.new __dir__
|
39
39
|
|
40
40
|
describe '.load' do
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
[
|
42
|
+
Encoding::UTF_8,
|
43
|
+
Encoding::UTF_16BE,
|
44
|
+
Encoding::UTF_16LE,
|
45
|
+
Encoding::UTF_32BE,
|
46
|
+
Encoding::UTF_32LE,
|
47
|
+
].each do |enc|
|
48
|
+
the_dir = this_dir + 'acceptance/valid'
|
49
|
+
the_dir.find do |f|
|
50
|
+
case f.extname when '.json'
|
51
|
+
it "should accept: #{enc}-encoded #{f.basename}" do
|
52
|
+
expect do
|
53
|
+
f.open "rb", external_encoding: Encoding::UTF_8, internal_encoding: enc do |fp|
|
54
|
+
RFC7159.load fp
|
55
|
+
end
|
56
|
+
end.to_not raise_exception
|
57
|
+
end
|
50
58
|
end
|
51
59
|
end
|
52
|
-
end
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
the_dir = this_dir + 'acceptance/invalid'
|
62
|
+
the_dir.find do |f|
|
63
|
+
case f.extname when '.txt'
|
64
|
+
it "should reject: #{enc}-encoded #{f.basename}" do
|
65
|
+
expect do
|
66
|
+
f.open "rb", external_encoding: Encoding::UTF_8, internal_encoding: enc do |fp|
|
67
|
+
RFC7159.load fp
|
68
|
+
end
|
69
|
+
end.to raise_exception
|
70
|
+
end
|
63
71
|
end
|
64
72
|
end
|
65
73
|
end
|
66
74
|
end
|
67
75
|
|
68
76
|
describe '.dump' do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
77
|
+
[
|
78
|
+
Encoding::UTF_8,
|
79
|
+
Encoding::UTF_16BE,
|
80
|
+
Encoding::UTF_16LE,
|
81
|
+
Encoding::UTF_32BE,
|
82
|
+
Encoding::UTF_32LE,
|
83
|
+
].each do |enc|
|
84
|
+
the_dir = this_dir + 'acceptance/valid'
|
85
|
+
the_dir.find do |f|
|
86
|
+
case f.extname when '.json'
|
87
|
+
it "should round-trip in #{enc}: #{f.basename}" do
|
88
|
+
str1 = f.open "rb", external_encoding: Encoding::UTF_8, internal_encoding: enc do |fp| fp.read end
|
89
|
+
obj = RFC7159.load str1
|
90
|
+
str2 = RFC7159.dump obj
|
91
|
+
str3 = str1.encode(Encoding::UTF_8)
|
92
|
+
# not interested in indents
|
93
|
+
expect(str2.gsub(/\s+/, '')).to eq(str3.gsub(/\s+/, ''))
|
94
|
+
end
|
78
95
|
end
|
79
96
|
end
|
80
97
|
end
|
@@ -88,6 +105,8 @@ describe RFC7159 do
|
|
88
105
|
0.5 => '0.5', # 0.5 has no error
|
89
106
|
'foo' => '"foo"',
|
90
107
|
"\u{dead}" => '"\\uDEAD"', # invalid UTF8 to be valid escaped UTF8
|
108
|
+
'foo'.encode('utf-32le') => '"foo"',
|
109
|
+
"\xDE\xAD".force_encoding('utf-16be') => '"\\uDEAD"',
|
91
110
|
[] => '[]',
|
92
111
|
[0] => '[0]',
|
93
112
|
{} => '{}',
|
@@ -115,7 +134,7 @@ describe RFC7159 do
|
|
115
134
|
end
|
116
135
|
end
|
117
136
|
|
118
|
-
context 'versus' do
|
137
|
+
context 'versus', skip: true do
|
119
138
|
the_dir = this_dir + 'acceptance/valid'
|
120
139
|
the_targets = Array.new
|
121
140
|
the_dir.find do |f|
|
@@ -1 +1 @@
|
|
1
|
-
[undefined]
|
1
|
+
[undefined]
|
@@ -1 +1 @@
|
|
1
|
-
[Infinity]
|
1
|
+
[Infinity]
|
@@ -1 +1 @@
|
|
1
|
-
callback({"JSONP":"is out of scope from JSON itself"});
|
1
|
+
callback({"JSONP":"is out of scope from JSON itself"});
|
@@ -1 +1 @@
|
|
1
|
-
[new Date(1981, 12, 20)]
|
1
|
+
[new Date(1981, 12, 20)]
|
@@ -1 +1 @@
|
|
1
|
-
[new Error("wrong.")]
|
1
|
+
[new Error("wrong.")]
|
@@ -1 +1 @@
|
|
1
|
-
[Math.PI]
|
1
|
+
[Math.PI]
|
@@ -1 +1 @@
|
|
1
|
-
[/invalid/i]
|
1
|
+
[/invalid/i]
|
@@ -1 +1 @@
|
|
1
|
-
[this]
|
1
|
+
[this]
|
@@ -1 +1 @@
|
|
1
|
-
[ true ? "true" : "false" ]
|
1
|
+
[ true ? "true" : "false" ]
|
@@ -0,0 +1 @@
|
|
1
|
+
["\uD800"]
|
@@ -0,0 +1 @@
|
|
1
|
+
["\uD803uDC0B"]
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"$schema" : "http://json-schema.org/draft-04/hyper-schema#",
|
3
|
+
"id" : "https://github.com/shyouhei/RFC7159/blob/master/spec/acceptance/valid/0009-complicated/0001-jsonschema.json",
|
4
|
+
"title" : "Sample blog post",
|
5
|
+
"description": "This is a JSON Schema, see http://json-schema.org",
|
6
|
+
"type" : "object",
|
7
|
+
"definitions": {
|
8
|
+
"uint64_t": {
|
9
|
+
"type" : "integer",
|
10
|
+
"mininum": 0,
|
11
|
+
"maximum": 18446744073709551615
|
12
|
+
},
|
13
|
+
"post": {
|
14
|
+
"type" : "object",
|
15
|
+
"properties": {
|
16
|
+
"userId": { "$ref": "#/definitions/uint64_t" },
|
17
|
+
"title" : {
|
18
|
+
"type" : "string",
|
19
|
+
"minLength": 1,
|
20
|
+
"maxLength": 64
|
21
|
+
},
|
22
|
+
"body": {
|
23
|
+
"type" : "string",
|
24
|
+
"minLength": 1,
|
25
|
+
"maxLength": 32768
|
26
|
+
},
|
27
|
+
"tags": {
|
28
|
+
"type" : "object"
|
29
|
+
},
|
30
|
+
"createdAt" : { "$ref": "#/definitions/uint64_t" },
|
31
|
+
"updatedAt" : { "$ref": "#/definitions/uint64_t" },
|
32
|
+
"publishedAt": {
|
33
|
+
"oneOf": [
|
34
|
+
{ "$ref": "#/definitions/uint64_t" },
|
35
|
+
{ "enum": [ null ] }
|
36
|
+
]
|
37
|
+
}
|
38
|
+
},
|
39
|
+
"additionalProperties": false,
|
40
|
+
"required": [ "userId", "title", "body" ]
|
41
|
+
}
|
42
|
+
},
|
43
|
+
"oneOf": [
|
44
|
+
{ "$ref": "#/definitions/post" }
|
45
|
+
]
|
46
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"Image": {
|
3
|
+
"Width": 800,
|
4
|
+
"Height": 600,
|
5
|
+
"Title": "View from 15th Floor",
|
6
|
+
"Thumbnail": {
|
7
|
+
"Url": "http://www.example.com/image/481989943",
|
8
|
+
"Height": 125,
|
9
|
+
"Width": 100
|
10
|
+
},
|
11
|
+
"Animated" : false,
|
12
|
+
"IDs": [116, 943, 234, 38793]
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"precision": "zip",
|
4
|
+
"Latitude": 37.7668,
|
5
|
+
"Longitude": -122.3959,
|
6
|
+
"Address": "",
|
7
|
+
"City": "SAN FRANCISCO",
|
8
|
+
"State": "CA",
|
9
|
+
"Zip": "94107",
|
10
|
+
"Country": "US"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"precision": "zip",
|
14
|
+
"Latitude": 37.371991,
|
15
|
+
"Longitude": -122.026020,
|
16
|
+
"Address": "",
|
17
|
+
"City": "SUNNYVALE",
|
18
|
+
"State": "CA",
|
19
|
+
"Zip": "94085",
|
20
|
+
"Country": "US"
|
21
|
+
}
|
22
|
+
]
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RFC7159
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '7159'
|
4
|
+
version: '7159.01'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urabe,
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -151,11 +151,11 @@ dependencies:
|
|
151
151
|
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
|
-
description:
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
154
|
+
description: A JSON parser/generator that conforms (I believe) to RFC7159 "The JavaScript
|
155
|
+
Object Notation (JSON) Data Interchange Format". That RFC is very different to its
|
156
|
+
predecessor RFC4627, when it comes to parsing. This gem honors the updated syntax
|
157
|
+
as possible. The generator guarantees that a parsed valid properly rounds-trip to
|
158
|
+
identical valid JSON representation.
|
159
159
|
email:
|
160
160
|
- shyouhei@ruby-lang.org
|
161
161
|
executables: []
|
@@ -315,6 +315,8 @@ files:
|
|
315
315
|
- spec/acceptance/valid/0005-strings/0007-escaped-invalid-unicode-still-valid-as-json.json
|
316
316
|
- spec/acceptance/valid/0005-strings/0008-ruby-json-gem-cant-handle-this.json
|
317
317
|
- spec/acceptance/valid/0005-strings/0009-unescaped-invalid-javascript-still-valid-as-json.json
|
318
|
+
- spec/acceptance/valid/0005-strings/0010-escaped-separated-surrogate.json
|
319
|
+
- spec/acceptance/valid/0005-strings/0011-escaped-surrogate-then-normal.json
|
318
320
|
- spec/acceptance/valid/0006-m17n/0001-genesis.json
|
319
321
|
- spec/acceptance/valid/0006-m17n/0002-heart-sutra.json
|
320
322
|
- spec/acceptance/valid/0006-m17n/0003-escaped-valid-surrogate-pair.json
|
@@ -335,8 +337,11 @@ files:
|
|
335
337
|
- spec/acceptance/valid/0008-hashes/0008-numeric-value.json
|
336
338
|
- spec/acceptance/valid/0008-hashes/0009-array-value.json
|
337
339
|
- spec/acceptance/valid/0008-hashes/0010-hash-value.json
|
338
|
-
- spec/acceptance/valid/0008-hashes/0011-duplicate-key-in-different-representations.json
|
339
340
|
- spec/acceptance/valid/0008-hashes/0011-duplicate-key.json
|
341
|
+
- spec/acceptance/valid/0008-hashes/0012-duplicate-key-in-different-representations.json
|
342
|
+
- spec/acceptance/valid/0009-complicated/0001-jsonschema.json
|
343
|
+
- spec/acceptance/valid/0009-complicated/0002-example-in-RFC7159-section-13.json
|
344
|
+
- spec/acceptance/valid/0009-complicated/0003-example-in-RFC7159-section-13.json
|
340
345
|
- spec/spec_helper.rb
|
341
346
|
homepage: http://github.com/shyouhei/RFC7159
|
342
347
|
licenses:
|
@@ -350,7 +355,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
350
355
|
requirements:
|
351
356
|
- - "~>"
|
352
357
|
- !ruby/object:Gem::Version
|
353
|
-
version: '2.
|
358
|
+
version: '2.0'
|
354
359
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
355
360
|
requirements:
|
356
361
|
- - ">="
|
@@ -494,6 +499,8 @@ test_files:
|
|
494
499
|
- spec/acceptance/valid/0005-strings/0007-escaped-invalid-unicode-still-valid-as-json.json
|
495
500
|
- spec/acceptance/valid/0005-strings/0008-ruby-json-gem-cant-handle-this.json
|
496
501
|
- spec/acceptance/valid/0005-strings/0009-unescaped-invalid-javascript-still-valid-as-json.json
|
502
|
+
- spec/acceptance/valid/0005-strings/0010-escaped-separated-surrogate.json
|
503
|
+
- spec/acceptance/valid/0005-strings/0011-escaped-surrogate-then-normal.json
|
497
504
|
- spec/acceptance/valid/0006-m17n/0001-genesis.json
|
498
505
|
- spec/acceptance/valid/0006-m17n/0002-heart-sutra.json
|
499
506
|
- spec/acceptance/valid/0006-m17n/0003-escaped-valid-surrogate-pair.json
|
@@ -514,7 +521,10 @@ test_files:
|
|
514
521
|
- spec/acceptance/valid/0008-hashes/0008-numeric-value.json
|
515
522
|
- spec/acceptance/valid/0008-hashes/0009-array-value.json
|
516
523
|
- spec/acceptance/valid/0008-hashes/0010-hash-value.json
|
517
|
-
- spec/acceptance/valid/0008-hashes/0011-duplicate-key-in-different-representations.json
|
518
524
|
- spec/acceptance/valid/0008-hashes/0011-duplicate-key.json
|
525
|
+
- spec/acceptance/valid/0008-hashes/0012-duplicate-key-in-different-representations.json
|
526
|
+
- spec/acceptance/valid/0009-complicated/0001-jsonschema.json
|
527
|
+
- spec/acceptance/valid/0009-complicated/0002-example-in-RFC7159-section-13.json
|
528
|
+
- spec/acceptance/valid/0009-complicated/0003-example-in-RFC7159-section-13.json
|
519
529
|
- spec/spec_helper.rb
|
520
530
|
has_rdoc:
|