Skip to content

Commit

Permalink
dev rm redundant jsonification thing in googs
Browse files Browse the repository at this point in the history
  • Loading branch information
notEthan committed Nov 25, 2019
1 parent 05ccfc5 commit c7e29f7
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions lib/scorpio/google_api_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,7 @@ def to_openapi_hash(options = {})
end.call(openapi)
end
end
# check we haven't got anything that shouldn't go in a openapi document
openapi = JSI::Util.ycomb do |rec|
proc do |object|
object = object.to_openapi if object.respond_to?(:to_openapi)
if object.respond_to?(:to_hash)
object.map { |k, v| {rec.call(k) => rec.call(v)} }.inject({}, &:update)
elsif object.respond_to?(:to_ary)
object.map(&rec)
elsif object.is_a?(Symbol)
object.to_s
elsif [String, TrueClass, FalseClass, NilClass, Numeric].any? { |c| object.is_a?(c) }
object
else
raise(TypeError, "bad (not jsonifiable) object: #{object.pretty_inspect}")
end
end
end.call(openapi)
JSI::Typelike.as_json(openapi)
end
end
end
Expand Down

0 comments on commit c7e29f7

Please sign in to comment.