From 1273b9f4cc41f64dc302f559520aaa9172c6f3d1 Mon Sep 17 00:00:00 2001 From: Laurynas Butkus Date: Sat, 30 Apr 2022 19:38:11 +0300 Subject: [PATCH] Switch to JSON::Serializable --- src/detect_language/detect_response.cr | 30 +++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/detect_language/detect_response.cr b/src/detect_language/detect_response.cr index 9ca2cc2..099b56c 100644 --- a/src/detect_language/detect_response.cr +++ b/src/detect_language/detect_response.cr @@ -1,29 +1,29 @@ module DetectLanguage class DetectResponse - JSON.mapping({ - data: {type: DetectData, nilable: true}, - error: {type: ErrorData, nilable: true}, - }) + include JSON::Serializable + + property data : DetectData? + property error : ErrorData? end class ErrorData - JSON.mapping({ - message: String, - }) + include JSON::Serializable + + property message : String end class DetectData - JSON.mapping({ - detections: Array(Detection), - }) + include JSON::Serializable + + property detections : Array(Detection) end class Detection - JSON.mapping({ - language: String, - isReliable: Bool, - confidence: Float64, - }) + include JSON::Serializable + + property language : String + property isReliable : Bool + property confidence : Float64 def is_reliable? isReliable