Serialization of TimeSpan type produces empty hash
jsmartt opened this issue ยท 2 comments
I'm trying to create an autoscale rule for a VM Scale Set, using the Azure::Monitor::Mgmt::V2015_04_01 module, but I'm getting error responses with the body: {"code":"UnsupportedRequestContent","message":"Request content is not well formed or supported."}
. Upon further inspection, my properties with the TimeSpan type are getting converted to an empty hash instead of a string value upon serialization.
Here is some code to duplicate the bug:
action = Azure::Monitor::Mgmt::V2015_04_01::Models::ScaleAction.new
action.cooldown = 'PT10M'
action.direction = 'Increase'
action.type = 'PercentChangeCount'
request_mapper = Azure::Monitor::Mgmt::V2015_04_01::Models::ScaleAction.mapper()
monitor = Azure::Monitor::Profiles::Latest::Mgmt::Client.new
monitor.autoscale_settings.client.serialize(request_mapper, action)
This code produces the following result:
{"direction"=>"Increase", "type"=>"PercentChangeCount", "value"=>"1", "cooldown"=>{}}
Why
I dug into the serialize method and noticed that there is no matching regex for a TimeSpan
type, as referred to here and lots of other places. I believe that either this method needs updated to support the TimeSpan
type, or every reference to a TimeSpan
type needs changed to a String
type.
@jsmartt Your PR was merged, thanks for your contribution. The new version of ms_rest
was released (https://rubygems.org/gems/ms_rest/versions/0.7.5), you can upgrade it and try again.