Skip to content

Commit

Permalink
Prefer model xml name only if present in XML properties (#268)
Browse files Browse the repository at this point in the history
* Prefer model xml name if present in XML properties, otherwise use property XML name

* Bump to v2.0.21
  • Loading branch information
RikkiGibson authored Jul 10, 2018
1 parent 65f93d6 commit cd3d5d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft.azure/autorest.java",
"version": "2.0.20",
"version": "2.0.21",
"description": "The Java extension for classic generators in AutoRest.",
"scripts": {
"autorest": "autorest",
Expand Down Expand Up @@ -53,4 +53,4 @@
"dependencies": {
"dotnet-2.0.0": "^1.1.0"
}
}
}
16 changes: 5 additions & 11 deletions src/JavaCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1775,20 +1775,14 @@ private static ServiceModelProperty ParseModelProperty(AutoRestProperty autoRest
}

string xmlName;
if (autoRestProperty.ModelType is AutoRestCompositeType)
try
{
xmlName = autoRestProperty.ModelType.XmlName;
xmlName = autoRestProperty.ModelType.XmlProperties?.Name
?? autoRestProperty.XmlName;
}
else
catch
{
try
{
xmlName = autoRestProperty.XmlName;
}
catch
{
xmlName = null;
}
xmlName = null;
}

List<string> annotationArgumentList = new List<string>()
Expand Down

0 comments on commit cd3d5d4

Please sign in to comment.