lib/avro/builder/dsl.rb in avro-builder-1.0.0 vs lib/avro/builder/dsl.rb in avro-builder-1.0.1
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
require 'avro'
-require 'multi_json'
+require 'json'
require 'avro/builder/errors'
require 'avro/builder/dsl_options'
require 'avro/builder/dsl_attributes'
require 'avro/builder/namespaceable'
require 'avro/builder/definition_cache'
@@ -76,10 +76,10 @@
end
# Return the last schema object processed as an Avro JSON schema
def to_json(validate: true, pretty: true)
hash = to_h
- MultiJson.dump(hash, { pretty: pretty }).tap do |json|
+ (pretty ? JSON.pretty_generate(hash) : hash.to_json).tap do |json|
# Uncomment the next line to debug:
# puts json
# Parse the schema to validate before returning
::Avro::Schema.parse(json) if validate
end