Skip to content

Commit

Permalink
Ruby - Polymorphic discriminator hashmap should have exact model name…
Browse files Browse the repository at this point in the history
… as hash value instead of lowercased in Ruby (Azure#1245)
  • Loading branch information
vishrutshah authored Jul 12, 2016
1 parent 693fdd8 commit 2a491e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/client/Ruby/ms-rest/lib/ms_rest/serialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/generator/AutoRest.Ruby/Templates/ModelTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down

0 comments on commit 2a491e8

Please sign in to comment.