From 10e571e0756f40e5c23b41f400c1c7a08403b886 Mon Sep 17 00:00:00 2001 From: Vishrut Shah Date: Sat, 9 Jul 2016 19:59:03 -0700 Subject: [PATCH] Polymorphic discriminator hashmap should have exact model name as hash value instead of lowercased in Ruby --- src/client/Ruby/ms-rest/lib/ms_rest/serialization.rb | 2 +- src/generator/AutoRest.Ruby/Templates/ModelTemplate.cshtml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/Ruby/ms-rest/lib/ms_rest/serialization.rb b/src/client/Ruby/ms-rest/lib/ms_rest/serialization.rb index 327d2a4f3a..c76eae2797 100644 --- a/src/client/Ruby/ms-rest/lib/ms_rest/serialization.rb +++ b/src/client/Ruby/ms-rest/lib/ms_rest/serialization.rb @@ -146,7 +146,7 @@ def deserialize_composite_type(mapper, response_body, object_name) parent_class = get_model(mapper[:type][:class_name]) discriminator = parent_class.class_eval("@@discriminatorMap") model_name = response_body["#{mapper[:type][:polymorphic_discriminator]}"] - model_class = get_model(discriminator[model_name].capitalize) + model_class = get_model(discriminator[model_name]) else model_class = get_model(mapper[:type][:class_name]) end diff --git a/src/generator/AutoRest.Ruby/Templates/ModelTemplate.cshtml b/src/generator/AutoRest.Ruby/Templates/ModelTemplate.cshtml index ec5d10695f..71414cf83b 100644 --- a/src/generator/AutoRest.Ruby/Templates/ModelTemplate.cshtml +++ b/src/generator/AutoRest.Ruby/Templates/ModelTemplate.cshtml @@ -25,10 +25,10 @@ module @(Settings.Namespace) @if (Model.IsPolymorphic && Model.BaseModelType == null) { @:@@@@discriminatorMap = Hash.new - @:@@@@discriminatorMap["@Model.SerializedName"] = "@Model.Name.ToLowerInvariant()" + @:@@@@discriminatorMap["@Model.SerializedName"] = "@Model.Name" foreach (var derivedType in Model.DerivedTypes) { - @:@@@@discriminatorMap["@derivedType.SerializedName"] = "@derivedType.Name.ToLowerInvariant()" + @:@@@@discriminatorMap["@derivedType.SerializedName"] = "@derivedType.Name" } }