From 6f05ab0d77b27d3fefb51ad94ddc5cd0a9f395e0 Mon Sep 17 00:00:00 2001 From: Peter Song Date: Thu, 4 Apr 2024 18:18:35 -0700 Subject: [PATCH 1/5] Fixes for issue 33 --- .../RestXmlResponseUnmarshaller.cs | 157 +++++++++++------- .../RestXmlResponseUnmarshaller.tt | 38 ++++- 2 files changed, 126 insertions(+), 69 deletions(-) diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs index 06bed70748c4..30a85d66bae4 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs @@ -12,13 +12,14 @@ namespace ServiceClientGenerator.Generators.Marshallers using System.Linq; using System.Text; using System.Collections.Generic; + using Json.LitJson; using System; /// /// Class to produce the template output /// - #line 1 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class RestXmlResponseUnmarshaller : BaseResponseUnmarshaller { @@ -29,7 +30,7 @@ public partial class RestXmlResponseUnmarshaller : BaseResponseUnmarshaller public override string TransformText() { - #line 6 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 7 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" AddLicenseHeader(); @@ -40,7 +41,7 @@ public override string TransformText() #line hidden this.Write("\r\nnamespace "); - #line 12 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 13 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default @@ -48,14 +49,14 @@ public override string TransformText() this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// \r\n /// Response U" + "nmarshaller for "); - #line 15 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 16 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" operation\r\n /// \r\n public class "); - #line 17 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 18 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -71,21 +72,21 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte { "); - #line 26 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write("Response response = new "); - #line 26 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name)); #line default #line hidden this.Write("Response();\r\n"); - #line 27 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 28 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" var payload= this.Operation.ResponsePayloadMember; var shouldMarshallPayload = (payload != null && payload.IsStructure); @@ -101,7 +102,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write(" if (context.ResponseData.IsSuccessStatusCode && context.ResponseData." + "ContentLength == 0)\r\n return response;\r\n"); - #line 38 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 39 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -113,14 +114,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\tcontext.AllowEmptyElementLookup.Add(\""); - #line 44 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 45 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(marshallName)); #line default #line hidden this.Write("\");\r\n"); - #line 45 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 46 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -129,7 +130,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write(" UnmarshallResult(context,response);\r\n"); - #line 49 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 50 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else if (payloadIsStream) @@ -142,14 +143,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write(" response."); - #line 56 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = context.Stream;\r\n"); - #line 57 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 58 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else if (payload.ModelShape.IsString) @@ -161,14 +162,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write(" using (var sr = new StreamReader(context.Stream))\r\n {\r\n " + " response."); - #line 64 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 65 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = sr.ReadToEnd();\r\n }\r\n"); - #line 66 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 67 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else if (payload.ModelShape.IsMemoryStream) @@ -181,14 +182,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte "opyStream(context.Stream, ms);\r\n ms.Seek(0, SeekOrigin.Begin);\r\n " + " response."); - #line 75 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 76 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = ms;\r\n\r\n"); - #line 77 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 78 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else @@ -208,7 +209,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write(" \r\n return response;\r\n\t\t}\t\t\r\n"); - #line 93 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 94 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" if ( this.Operation.ResponseHasBodyMembers || shouldMarshallPayload) { @@ -218,7 +219,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\r\n"); - #line 98 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 99 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" if (this.Operation.ResponseBodyMembers.Count == 0 && !shouldMarshallPayload) { @@ -229,7 +230,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write("\t\t[System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Usage\", \"CA1801:Rev" + "iewUnusedParameters\", MessageId=\"response\")]\r\n"); - #line 103 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 104 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -238,7 +239,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\tprivate static void UnmarshallResult(XmlUnmarshallerContext context, "); - #line 106 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 107 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name)); #line default @@ -246,7 +247,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write("Response response)\r\n {\r\n int originalDepth = context.CurrentDep" + "th;\r\n int targetDepth = originalDepth + 1;\r\n"); - #line 110 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 111 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" if (payload == null) { @@ -256,7 +257,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\tif (context.IsStartOfDocument) \r\n\t\t\t\t targetDepth += 1;\r\n"); - #line 116 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 117 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -267,7 +268,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte ";\r\n }\r\n while (context.Read())\r\n {\r\n\t\t\t\tif (con" + "text.IsStartElement || context.IsAttribute)\r\n {\r\n"); - #line 127 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 128 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" foreach (var member in this.Operation.ResponseBodyMembers) { @@ -283,28 +284,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 137 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 138 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(listMarshallName)); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 139 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 140 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 140 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 141 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(unmarshaller.Unmarshall(context));\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 143 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 144 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -317,35 +318,35 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t if (context.TestExpression(\""); - #line 150 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); + #line 151 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("/"); - #line 150 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 151 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(listMarshallName)); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t {\r\n\t\t\t\t\t var unmarshaller = "); - #line 152 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 153 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t response."); - #line 153 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 154 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(unmarshaller.Unmarshall(context));\r\n\t\t\t\t\t continue;\r\n\t\t\t\t }\r\n"); - #line 156 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 157 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } } @@ -359,28 +360,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 164 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); + #line 165 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 166 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 167 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 167 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 168 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(unmarshaller.Unmarshall(context));\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 170 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 171 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else @@ -391,28 +392,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 175 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); + #line 176 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 177 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 178 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 178 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 179 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 181 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 182 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } } @@ -424,28 +425,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 187 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); + #line 188 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 189 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 190 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 190 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 191 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 193 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 194 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } } @@ -458,28 +459,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 200 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(payload.MarshallName)); + #line 201 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(payload))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 202 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 203 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 203 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 204 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 206 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 207 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -490,7 +491,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte "\r\n {\r\n return;\r\n }\r\n " + " }\r\n \r\n return;\r\n }\r\n"); - #line 218 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 219 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -519,7 +520,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex { "); - #line 240 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 241 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" foreach (var exception in this.Operation.Exceptions) { @@ -529,14 +530,14 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex #line hidden this.Write(" if (errorResponse.Code != null && errorResponse.Code.Equals(\""); - #line 244 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 245 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Code)); #line default #line hidden this.Write("\"))\r\n {\r\n return "); - #line 246 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 247 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Name)); #line default @@ -544,7 +545,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex this.Write("Unmarshaller.Instance.Unmarshall(contextCopy, errorResponse);\r\n }\r" + "\n"); - #line 248 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 249 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -553,7 +554,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex #line hidden this.Write(" }\r\n return new "); - #line 252 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 253 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.BaseException)); #line default @@ -561,16 +562,46 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex this.Write("(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, e" + "rrorResponse.RequestId, statusCode);\r\n }\r\n\r\n"); - #line 255 "C:\Dev\repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 256 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.AddResponseSingletonMethod(); #line default #line hidden - this.Write(" }\r\n}"); + this.Write(" }\r\n}\r\n"); return this.GenerationEnvironment.ToString(); } + + #line 261 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + + /* The rules for determining the marshallName for xml services is different than json services + * 1. Use the member locationName if the value doesn't match the member's name + 2. Use the value of the locationName on the member's target if present + 3. Use the name of the member's target + */ + protected string DetermineXmlMarshallName(Member member) + { + var locationName = member.data[ServiceModel.LocationNameKey]; + if(locationName == null) + return member.MarshallName; + if (!string.Equals(locationName.ToString(), member.ModeledName, StringComparison.Ordinal)) + { + return locationName.ToString(); + } + var memberTarget = member.Shape.data[ServiceModel.LocationNameKey]; + if(member.Shape.data != null && memberTarget != null) + { + return memberTarget.ToString(); + } + else{ + return member.Shape.Name; + } + } + + + #line default + #line hidden } #line default diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt index 34be6c2c7caf..2c0b7b458856 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt @@ -3,6 +3,7 @@ <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="Json.LitJson" #> <# AddLicenseHeader(); @@ -147,7 +148,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations else { #> - if (context.TestExpression("<#=member.MarshallName#>/<#=listMarshallName#>", targetDepth)) + if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>/<#=listMarshallName#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; response.<#=member.PropertyName#>.Add(unmarshaller.Unmarshall(context)); @@ -161,7 +162,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations if(member.IsFlattened) { #> - if (context.TestExpression("<#=member.MarshallName#>", targetDepth)) + if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; response.<#=member.PropertyName#>.Add(unmarshaller.Unmarshall(context)); @@ -172,7 +173,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations else { #> - if (context.TestExpression("<#=member.MarshallName#>", targetDepth)) + if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; response.<#=member.PropertyName#> = unmarshaller.Unmarshall(context); @@ -184,7 +185,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations else { #> - if (context.TestExpression("<#=member.MarshallName#>", targetDepth)) + if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; response.<#=member.PropertyName#> = unmarshaller.Unmarshall(context); @@ -197,7 +198,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations if (shouldMarshallPayload) { #> - if (context.TestExpression("<#=payload.MarshallName#>", targetDepth)) + if (context.TestExpression("<#=DetermineXmlMarshallName(payload)#>", targetDepth)) { var unmarshaller = <#= payload.DetermineTypeUnmarshallerInstantiate() #>; response.<#=payload.PropertyName#> = unmarshaller.Unmarshall(context); @@ -256,4 +257,29 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations this.AddResponseSingletonMethod(); #> } -} \ No newline at end of file +} +<#+ + /* The rules for determining the marshallName for xml services is different than json services + * 1. Use the member locationName if the value doesn't match the member's name + 2. Use the value of the locationName on the member's target if present + 3. Use the name of the member's target + */ + protected string DetermineXmlMarshallName(Member member) + { + var locationName = member.data[ServiceModel.LocationNameKey]; + if(locationName == null) + return member.MarshallName; + if (!string.Equals(locationName.ToString(), member.ModeledName, StringComparison.Ordinal)) + { + return locationName.ToString(); + } + var memberTarget = member.Shape.data[ServiceModel.LocationNameKey]; + if(member.Shape.data != null && memberTarget != null) + { + return memberTarget.ToString(); + } + else{ + return member.Shape.Name; + } + } +#> \ No newline at end of file From 443a6204a24a62cf1514334ddc993db52d85dc92 Mon Sep 17 00:00:00 2001 From: Peter Song Date: Thu, 4 Apr 2024 18:19:03 -0700 Subject: [PATCH 2/5] Generated changes for issue 33 --- .../HttpPayloadWithStructureResponseUnmarshaller.cs | 2 +- .../HttpPayloadWithUnionResponseUnmarshaller.cs | 2 +- .../HttpPayloadWithXmlNameResponseUnmarshaller.cs | 2 +- .../HttpPayloadWithXmlNamespaceAndPrefixResponseUnmarshaller.cs | 2 +- .../HttpPayloadWithXmlNamespaceResponseUnmarshaller.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithStructureResponseUnmarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithStructureResponseUnmarshaller.cs index b836013a345c..5ee471d6c934 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithStructureResponseUnmarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithStructureResponseUnmarshaller.cs @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload { if (context.IsStartElement || context.IsAttribute) { - if (context.TestExpression("nested", targetDepth)) + if (context.TestExpression("NestedPayload", targetDepth)) { var unmarshaller = NestedPayloadUnmarshaller.Instance; response.Nested = unmarshaller.Unmarshall(context); diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithUnionResponseUnmarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithUnionResponseUnmarshaller.cs index 31bb2ccb6cb0..fc91794c0e6e 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithUnionResponseUnmarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithUnionResponseUnmarshaller.cs @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload { if (context.IsStartElement || context.IsAttribute) { - if (context.TestExpression("nested", targetDepth)) + if (context.TestExpression("UnionPayload", targetDepth)) { var unmarshaller = UnionPayloadUnmarshaller.Instance; response.Nested = unmarshaller.Unmarshall(context); diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNameResponseUnmarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNameResponseUnmarshaller.cs index f4083b6a59b2..b3b5333919c4 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNameResponseUnmarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNameResponseUnmarshaller.cs @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload { if (context.IsStartElement || context.IsAttribute) { - if (context.TestExpression("nested", targetDepth)) + if (context.TestExpression("Hello", targetDepth)) { var unmarshaller = PayloadWithXmlNameUnmarshaller.Instance; response.Nested = unmarshaller.Unmarshall(context); diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceAndPrefixResponseUnmarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceAndPrefixResponseUnmarshaller.cs index a6eb4bb03f34..b294cc9654e2 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceAndPrefixResponseUnmarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceAndPrefixResponseUnmarshaller.cs @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload { if (context.IsStartElement || context.IsAttribute) { - if (context.TestExpression("nested", targetDepth)) + if (context.TestExpression("PayloadWithXmlNamespaceAndPrefix", targetDepth)) { var unmarshaller = PayloadWithXmlNamespaceAndPrefixUnmarshaller.Instance; response.Nested = unmarshaller.Unmarshall(context); diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceResponseUnmarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceResponseUnmarshaller.cs index 3984ac96efef..d032439beef8 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceResponseUnmarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/HttpPayloadWithXmlNamespaceResponseUnmarshaller.cs @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload { if (context.IsStartElement || context.IsAttribute) { - if (context.TestExpression("nested", targetDepth)) + if (context.TestExpression("PayloadWithXmlNamespace", targetDepth)) { var unmarshaller = PayloadWithXmlNamespaceUnmarshaller.Instance; response.Nested = unmarshaller.Unmarshall(context); From 5a81002c2861e434e017eda2358e742c0ac46431 Mon Sep 17 00:00:00 2001 From: Peter Song Date: Fri, 5 Apr 2024 11:21:23 -0700 Subject: [PATCH 3/5] Fixes for issue 33 (PR feedback) --- .../Marshallers/RestXmlResponseUnmarshaller.cs | 13 ++++--------- .../Marshallers/RestXmlResponseUnmarshaller.tt | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs index 30a85d66bae4..d91d60b77caf 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs @@ -576,27 +576,22 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex #line 261 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" /* The rules for determining the marshallName for xml services is different than json services - * 1. Use the member locationName if the value doesn't match the member's name + 1. Use the member locationName if the value doesn't match the member's name 2. Use the value of the locationName on the member's target if present 3. Use the name of the member's target */ protected string DetermineXmlMarshallName(Member member) { var locationName = member.data[ServiceModel.LocationNameKey]; - if(locationName == null) + if (locationName == null) return member.MarshallName; if (!string.Equals(locationName.ToString(), member.ModeledName, StringComparison.Ordinal)) { return locationName.ToString(); } var memberTarget = member.Shape.data[ServiceModel.LocationNameKey]; - if(member.Shape.data != null && memberTarget != null) - { - return memberTarget.ToString(); - } - else{ - return member.Shape.Name; - } + + return memberTarget != null ? memberTarget.ToString() : member.Shape.Name; } diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt index 2c0b7b458856..c13fdbfb0280 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt @@ -260,26 +260,21 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations } <#+ /* The rules for determining the marshallName for xml services is different than json services - * 1. Use the member locationName if the value doesn't match the member's name + 1. Use the member locationName if the value doesn't match the member's name 2. Use the value of the locationName on the member's target if present 3. Use the name of the member's target */ protected string DetermineXmlMarshallName(Member member) { var locationName = member.data[ServiceModel.LocationNameKey]; - if(locationName == null) + if (locationName == null) return member.MarshallName; if (!string.Equals(locationName.ToString(), member.ModeledName, StringComparison.Ordinal)) { return locationName.ToString(); } var memberTarget = member.Shape.data[ServiceModel.LocationNameKey]; - if(member.Shape.data != null && memberTarget != null) - { - return memberTarget.ToString(); - } - else{ - return member.Shape.Name; - } + + return memberTarget != null ? memberTarget.ToString() : member.Shape.Name; } #> \ No newline at end of file From 3b2aee9c432f6f18e2af1cb358d5d1862af32027 Mon Sep 17 00:00:00 2001 From: Peter Song Date: Fri, 5 Apr 2024 11:21:41 -0700 Subject: [PATCH 4/5] Generated changes for issue 33 --- .../FlattenedXmlMapRequestMarshaller.cs | 4 ++-- .../FlattenedXmlMapWithXmlNameRequestMarshaller.cs | 6 +++--- .../NestedXmlMapsRequestMarshaller.cs | 8 +++++--- .../XmlEmptyMapsRequestMarshaller.cs | 1 + .../MarshallTransformations/XmlEnumsRequestMarshaller.cs | 1 + .../XmlIntEnumsRequestMarshaller.cs | 1 + .../XmlMapWithXmlNamespaceRequestMarshaller.cs | 1 + .../MarshallTransformations/XmlMapsRequestMarshaller.cs | 1 + .../XmlMapsXmlNameRequestMarshaller.cs | 1 + 9 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapRequestMarshaller.cs index a6fe55a52615..d69406f45f8a 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapRequestMarshaller.cs @@ -70,8 +70,8 @@ public IRequest Marshall(FlattenedXmlMapRequest publicRequest) xmlWriter.WriteElementString("key", kvp.Key); xmlWriter.WriteElementString("value", kvp.Value); xmlWriter.WriteEndElement(); - } - xmlWriter.WriteEndElement(); + } + } xmlWriter.WriteEndElement(); } diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapWithXmlNameRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapWithXmlNameRequestMarshaller.cs index 762ed4091117..7e1fe6799334 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapWithXmlNameRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/FlattenedXmlMapWithXmlNameRequestMarshaller.cs @@ -66,12 +66,12 @@ public IRequest Marshall(FlattenedXmlMapWithXmlNameRequest publicRequest) { foreach (var kvp in publicRequest.MyMap) { - xmlWriter.WriteStartElement("entry"); + xmlWriter.WriteStartElement("KVP"); xmlWriter.WriteElementString("K", kvp.Key); xmlWriter.WriteElementString("V", kvp.Value); xmlWriter.WriteEndElement(); - } - xmlWriter.WriteEndElement(); + } + } xmlWriter.WriteEndElement(); } diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/NestedXmlMapsRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/NestedXmlMapsRequestMarshaller.cs index 3a57fcf65f17..12a0e2f05047 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/NestedXmlMapsRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/NestedXmlMapsRequestMarshaller.cs @@ -77,9 +77,10 @@ public IRequest Marshall(NestedXmlMapsRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); - xmlWriter.WriteEndElement(); - } - xmlWriter.WriteEndElement(); + } + } + if(publicRequest.IsSetNestedMap()) + { xmlWriter.WriteStartElement("nestedMap"); foreach (var kvp in publicRequest.NestedMap) { @@ -97,6 +98,7 @@ public IRequest Marshall(NestedXmlMapsRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); + } xmlWriter.WriteEndElement(); } diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEmptyMapsRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEmptyMapsRequestMarshaller.cs index 7b19d4bf7149..af332d17e112 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEmptyMapsRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEmptyMapsRequestMarshaller.cs @@ -80,6 +80,7 @@ public IRequest Marshall(XmlEmptyMapsRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); + } xmlWriter.WriteEndElement(); } diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEnumsRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEnumsRequestMarshaller.cs index 02b62591240f..6537f4e6ef64 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEnumsRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlEnumsRequestMarshaller.cs @@ -94,6 +94,7 @@ public IRequest Marshall(XmlEnumsRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); + } var publicRequestFooEnumSet = publicRequest.FooEnumSet; if (publicRequestFooEnumSet != null && publicRequestFooEnumSet.Count > 0) { diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlIntEnumsRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlIntEnumsRequestMarshaller.cs index 9f28370580d4..948607d8db1a 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlIntEnumsRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlIntEnumsRequestMarshaller.cs @@ -94,6 +94,7 @@ public IRequest Marshall(XmlIntEnumsRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); + } var publicRequestIntEnumSet = publicRequest.IntEnumSet; if (publicRequestIntEnumSet != null && publicRequestIntEnumSet.Count > 0) { diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapWithXmlNamespaceRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapWithXmlNamespaceRequestMarshaller.cs index 18324b4dcbda..a19acf130033 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapWithXmlNamespaceRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapWithXmlNamespaceRequestMarshaller.cs @@ -73,6 +73,7 @@ public IRequest Marshall(XmlMapWithXmlNamespaceRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); + } xmlWriter.WriteEndElement(); } diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsRequestMarshaller.cs index c47388e3aa62..4088054f79f8 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsRequestMarshaller.cs @@ -80,6 +80,7 @@ public IRequest Marshall(XmlMapsRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); + } xmlWriter.WriteEndElement(); } diff --git a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsXmlNameRequestMarshaller.cs b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsXmlNameRequestMarshaller.cs index 39d1a6aa2c4e..027d053d0033 100644 --- a/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsXmlNameRequestMarshaller.cs +++ b/sdk/test/Services/RestXmlProtocol/Generated/Model/Internal/MarshallTransformations/XmlMapsXmlNameRequestMarshaller.cs @@ -80,6 +80,7 @@ public IRequest Marshall(XmlMapsXmlNameRequest publicRequest) xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); + } xmlWriter.WriteEndElement(); } From 35011880deee0149d3f1fad471233bb9afa02bf4 Mon Sep 17 00:00:00 2001 From: Peter Song Date: Fri, 5 Apr 2024 11:27:34 -0700 Subject: [PATCH 5/5] Fixes for issue 33 (PR feedback) --- .../RestXmlResponseUnmarshaller.cs | 115 +++++++++--------- .../RestXmlResponseUnmarshaller.tt | 1 - 2 files changed, 57 insertions(+), 59 deletions(-) diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs index d91d60b77caf..e4560176c86e 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs @@ -12,7 +12,6 @@ namespace ServiceClientGenerator.Generators.Marshallers using System.Linq; using System.Text; using System.Collections.Generic; - using Json.LitJson; using System; /// @@ -30,7 +29,7 @@ public partial class RestXmlResponseUnmarshaller : BaseResponseUnmarshaller public override string TransformText() { - #line 7 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 6 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" AddLicenseHeader(); @@ -41,7 +40,7 @@ public override string TransformText() #line hidden this.Write("\r\nnamespace "); - #line 13 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 12 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default @@ -49,14 +48,14 @@ public override string TransformText() this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// \r\n /// Response U" + "nmarshaller for "); - #line 16 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 15 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" operation\r\n /// \r\n public class "); - #line 18 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -72,21 +71,21 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte { "); - #line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 26 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write("Response response = new "); - #line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 26 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name)); #line default #line hidden this.Write("Response();\r\n"); - #line 28 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" var payload= this.Operation.ResponsePayloadMember; var shouldMarshallPayload = (payload != null && payload.IsStructure); @@ -102,7 +101,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write(" if (context.ResponseData.IsSuccessStatusCode && context.ResponseData." + "ContentLength == 0)\r\n return response;\r\n"); - #line 39 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 38 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -114,14 +113,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\tcontext.AllowEmptyElementLookup.Add(\""); - #line 45 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 44 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(marshallName)); #line default #line hidden this.Write("\");\r\n"); - #line 46 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 45 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -130,7 +129,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write(" UnmarshallResult(context,response);\r\n"); - #line 50 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 49 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else if (payloadIsStream) @@ -143,14 +142,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write(" response."); - #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 56 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = context.Stream;\r\n"); - #line 58 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else if (payload.ModelShape.IsString) @@ -162,14 +161,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write(" using (var sr = new StreamReader(context.Stream))\r\n {\r\n " + " response."); - #line 65 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 64 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = sr.ReadToEnd();\r\n }\r\n"); - #line 67 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 66 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else if (payload.ModelShape.IsMemoryStream) @@ -182,14 +181,14 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte "opyStream(context.Stream, ms);\r\n ms.Seek(0, SeekOrigin.Begin);\r\n " + " response."); - #line 76 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 75 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = ms;\r\n\r\n"); - #line 78 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 77 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else @@ -209,7 +208,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write(" \r\n return response;\r\n\t\t}\t\t\r\n"); - #line 94 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 93 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" if ( this.Operation.ResponseHasBodyMembers || shouldMarshallPayload) { @@ -219,7 +218,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\r\n"); - #line 99 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 98 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" if (this.Operation.ResponseBodyMembers.Count == 0 && !shouldMarshallPayload) { @@ -230,7 +229,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write("\t\t[System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Usage\", \"CA1801:Rev" + "iewUnusedParameters\", MessageId=\"response\")]\r\n"); - #line 104 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 103 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -239,7 +238,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\tprivate static void UnmarshallResult(XmlUnmarshallerContext context, "); - #line 107 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 106 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name)); #line default @@ -247,7 +246,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte this.Write("Response response)\r\n {\r\n int originalDepth = context.CurrentDep" + "th;\r\n int targetDepth = originalDepth + 1;\r\n"); - #line 111 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 110 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" if (payload == null) { @@ -257,7 +256,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\tif (context.IsStartOfDocument) \r\n\t\t\t\t targetDepth += 1;\r\n"); - #line 117 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 116 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -268,7 +267,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte ";\r\n }\r\n while (context.Read())\r\n {\r\n\t\t\t\tif (con" + "text.IsStartElement || context.IsAttribute)\r\n {\r\n"); - #line 128 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 127 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" foreach (var member in this.Operation.ResponseBodyMembers) { @@ -284,28 +283,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 138 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 137 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(listMarshallName)); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 140 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 139 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 141 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 140 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(unmarshaller.Unmarshall(context));\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 144 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 143 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -318,35 +317,35 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t if (context.TestExpression(\""); - #line 151 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 150 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("/"); - #line 151 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 150 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(listMarshallName)); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t {\r\n\t\t\t\t\t var unmarshaller = "); - #line 153 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 152 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t response."); - #line 154 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 153 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(unmarshaller.Unmarshall(context));\r\n\t\t\t\t\t continue;\r\n\t\t\t\t }\r\n"); - #line 157 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 156 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } } @@ -360,28 +359,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 165 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 164 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 167 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 166 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 168 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 167 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(unmarshaller.Unmarshall(context));\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 171 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 170 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } else @@ -392,28 +391,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 176 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 175 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 178 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 177 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 179 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 178 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 182 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 181 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } } @@ -425,28 +424,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 188 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 187 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(member))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 190 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 189 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 191 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 190 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 194 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 193 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } } @@ -459,28 +458,28 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte #line hidden this.Write("\t\t\t\t\tif (context.TestExpression(\""); - #line 201 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 200 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DetermineXmlMarshallName(payload))); #line default #line hidden this.Write("\", targetDepth))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar unmarshaller = "); - #line 203 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 202 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n\t\t\t\t\t\tresponse."); - #line 204 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 203 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n"); - #line 207 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 206 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -491,7 +490,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte "\r\n {\r\n return;\r\n }\r\n " + " }\r\n \r\n return;\r\n }\r\n"); - #line 219 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 218 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -520,7 +519,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex { "); - #line 241 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 240 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" foreach (var exception in this.Operation.Exceptions) { @@ -530,14 +529,14 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex #line hidden this.Write(" if (errorResponse.Code != null && errorResponse.Code.Equals(\""); - #line 245 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 244 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Code)); #line default #line hidden this.Write("\"))\r\n {\r\n return "); - #line 247 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 246 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Name)); #line default @@ -545,7 +544,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex this.Write("Unmarshaller.Instance.Unmarshall(contextCopy, errorResponse);\r\n }\r" + "\n"); - #line 249 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 248 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" } @@ -554,7 +553,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex #line hidden this.Write(" }\r\n return new "); - #line 253 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 252 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.BaseException)); #line default @@ -562,7 +561,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex this.Write("(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, e" + "rrorResponse.RequestId, statusCode);\r\n }\r\n\r\n"); - #line 256 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 255 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" this.AddResponseSingletonMethod(); @@ -573,7 +572,7 @@ public override AmazonServiceException UnmarshallException(XmlUnmarshallerContex return this.GenerationEnvironment.ToString(); } - #line 261 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" + #line 260 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlResponseUnmarshaller.tt" /* The rules for determining the marshallName for xml services is different than json services 1. Use the member locationName if the value doesn't match the member's name diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt index c13fdbfb0280..aa73bda0797e 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt @@ -3,7 +3,6 @@ <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="Json.LitJson" #> <# AddLicenseHeader();