Skip to content

Commit

Permalink
Fix missing marshaller (#103)
Browse files Browse the repository at this point in the history
* Generate marshallers if there are flattened fields

* regenerate tests
  • Loading branch information
Vlad Barosan authored Mar 9, 2018
1 parent c0923bd commit 99b86f4
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Templates/ModelTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ else
</text>
}

@if (Model.BaseIsPolymorphic || Model.IsPolymorphic || Model.AllProperties.Any(p => p.ModelType is DictionaryTypeGo))
@if (Model.BaseIsPolymorphic || Model.IsPolymorphic || Model.HasFlattenedFields || Model.AllProperties.Any(p => p.ModelType is DictionaryTypeGo))
{
<text>
@EmptyLine
Expand Down Expand Up @@ -319,7 +319,7 @@ else
{
@:@(Model.Name.FixedValue.ToShortName()).@(p.Name) = @(CodeNamerGo.Instance.GetVariableName(p.Name))
}
else
else
{
@:@(Model.Name.FixedValue.ToShortName()).@(p.Name) = &@(CodeNamerGo.Instance.GetVariableName(p.Name))
}
Expand Down
12 changes: 12 additions & 0 deletions test/src/tests/generated/lro/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions test/src/tests/generated/model-flattening/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 99b86f4

Please sign in to comment.