From c6cede69e680c83a405573c500142605c27d21b0 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 1 Dec 2022 00:07:22 +0100 Subject: [PATCH] cast_json: enforce param type at compile time --- src/protodec/utils.cr | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/protodec/utils.cr b/src/protodec/utils.cr index b65a43c..6c7c509 100644 --- a/src/protodec/utils.cr +++ b/src/protodec/utils.cr @@ -468,9 +468,7 @@ module Protodec Any.new(raw.clone) end - def self.cast_json(object) - raise "Invalid type" if !object.is_a?(Hash) - + def self.cast_json(object : Hash) JSON::Any.new(object.transform_values do |value| case value when .is_a?(Hash)