Skip to content

Commit

Permalink
Change body serialization for complex type
Browse files Browse the repository at this point in the history
  • Loading branch information
annatisch committed May 10, 2016
1 parent cfdf8a8 commit 3e34c16
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,32 @@
{
@:body_content = upload_gen(@parameter.Name)
break;
}
}
}
}
}
else if (Model.RequestBody.IsRequired)
{
else if (Model.RequestBody.IsRequired)
{

if (Model.RequestBody.Type is CompositeType)
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString()))
}
else
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())')
}
else
{
}
}
else
{
@:if @Model.RequestBody.Name is not None:
if (Model.RequestBody.Type is CompositeType)
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString()))
}
else
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())')
}
@:else:
@:body_content = None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,27 @@
{
@:# Construct body
if (Model.RequestBody.IsRequired)
{
{
if (Model.RequestBody.Type is CompositeType)
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString()))
}
else
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())')
}
else
{
}
}
else
{
@:if @Model.RequestBody.Name is not None:
if (Model.RequestBody.Type is CompositeType)
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString()))
}
else
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())')
}
@:else:
@:body_content = None
}
Expand Down
30 changes: 22 additions & 8 deletions AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,31 @@
{
@:body_content = self._client.stream_upload(@parameter.Name, callback)
break;
}
}
}
else if (Model.RequestBody.IsRequired)
{
}
}
}
else if (Model.RequestBody.IsRequired)
{
if (Model.RequestBody.Type is CompositeType)
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString()))
}
else
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())')
}
else
{
}
}
else
{
@:if @Model.RequestBody.Name is not None:
if (Model.RequestBody.Type is CompositeType)
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString()))
}
else
{
@:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())')
}
@:else:
@:body_content = None
}
Expand Down

0 comments on commit 3e34c16

Please sign in to comment.