Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lang/ruby/avro.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ Gem::Specification.new do |s|
s.test_files = files.select { |f| f.start_with?("test/") }
s.require_paths = ["lib"]

s.add_dependency("multi_json", "~> 1.0")
s.add_dependency("json", ">= 2.0")
end
2 changes: 1 addition & 1 deletion lang/ruby/lib/avro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'multi_json'
require 'json'
require 'set'
require 'digest/md5'
require 'net/http'
Expand Down
6 changes: 3 additions & 3 deletions lang/ruby/lib/avro/protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ProtocolParseError < Avro::AvroError; end

attr_reader :name, :namespace, :types, :messages, :md5, :doc
def self.parse(protocol_string)
json_data = MultiJson.load(protocol_string)
json_data = JSON.parse(protocol_string, create_additions: false, quirks_mode: true)

if json_data.is_a? Hash
name = json_data['protocol']
Expand Down Expand Up @@ -61,7 +61,7 @@ def initialize(name, namespace=nil, types=nil, messages=nil, doc=nil)
end

def to_s
MultiJson.dump to_avro
JSON.dump to_avro
end

def ==(other)
Expand Down Expand Up @@ -136,7 +136,7 @@ def to_avro(names=Set.new)
end

def to_s
Yajl.dump to_avro
JSON.dump to_avro
end

def parse_request(request, names)
Expand Down
4 changes: 2 additions & 2 deletions lang/ruby/lib/avro/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Schema
DECIMAL_LOGICAL_TYPE = 'decimal'

def self.parse(json_string)
real_parse(MultiJson.load(json_string), {})
real_parse(JSON.parse(json_string, create_additions: false, quirks_mode: true), {})
end

# Build Avro Schema from data parsed out of JSON string.
Expand Down Expand Up @@ -236,7 +236,7 @@ def to_avro(_names=nil)
end

def to_s
MultiJson.dump to_avro
JSON.dump to_avro
end

def validate_aliases!
Expand Down
2 changes: 1 addition & 1 deletion lang/ruby/lib/avro/schema_normalization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def initialize
end

def to_parsing_form(schema)
MultiJson.dump(normalize_schema(schema))
JSON.dump(normalize_schema(schema))
end

private
Expand Down
4 changes: 2 additions & 2 deletions lang/ruby/test/test_datafile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def test_differing_schemas_with_complex_objects
end

%w[fixed enum record error array map union].each do |s|
reader = MultiJson.load(writer_schema)
reader = JSON.parse(writer_schema)
reader['fields'] = reader['fields'].reject{|f| f['type']['type'] == s}
Avro::DataFile.open('data.avr', 'r', MultiJson.dump(reader)) do |dr|
Avro::DataFile.open('data.avr', 'r', JSON.dump(reader)) do |dr|
dr.each_with_index do |obj, i|
reader['fields'].each do |field|
assert_equal data[i][field['name']], obj[field['name']]
Expand Down
4 changes: 2 additions & 2 deletions lang/ruby/test/test_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ def check(str)

# test that the round-trip didn't mess up anything
# NB: I don't think we should do this. Why enforce ordering?
assert_equal(MultiJson.load(str),
MultiJson.load(parsed_string))
assert_equal(JSON.parse(str, quirks_mode: true),
JSON.parse(parsed_string, quirks_mode: true))

# test __eq__
assert_equal(schema, Avro::Schema.parse(str))
Expand Down