From 918fa4081e989c26891dfe6867d9450e92583df2 Mon Sep 17 00:00:00 2001 From: Peter Song Date: Mon, 2 Dec 2024 13:55:17 -0800 Subject: [PATCH 1/9] Core and generator changes for system text json deserialization. Dynamo DB Utils refactor to enable building test project --- .../AWSQueryEC2ResponseUnmarshaller.cs | 2 +- .../AWSQueryEC2ResponseUnmarshaller.tt | 2 +- .../AWSQueryExceptionUnmarshaller.cs | 52 +- .../AWSQueryExceptionUnmarshaller.tt | 2 +- .../AWSQueryResponseUnmarshaller.cs | 2 +- .../AWSQueryResponseUnmarshaller.tt | 2 +- .../AWSQueryStructureUnmarshaller.cs | 76 ++- .../AWSQueryStructureUnmarshaller.tt | 13 +- .../JsonRPCExceptionUnmarshaller.cs | 75 +-- .../JsonRPCExceptionUnmarshaller.tt | 20 +- .../JsonRPCResponseUnmarshaller.cs | 110 +++-- .../JsonRPCResponseUnmarshaller.tt | 29 +- .../Marshallers/JsonRPCStructureMarshaller.cs | 453 +++++++++--------- .../Marshallers/JsonRPCStructureMarshaller.tt | 2 - .../JsonRPCStructureUnmarshaller.cs | 104 ++-- .../JsonRPCStructureUnmarshaller.tt | 26 +- .../RestXmlExceptionUnmarshaller.cs | 50 +- .../RestXmlExceptionUnmarshaller.tt | 2 +- .../RestXmlResponseUnmarshaller.cs | 2 +- .../RestXmlResponseUnmarshaller.tt | 2 +- .../RestXmlStructureUnmarshaller.cs | 35 +- .../RestXmlStructureUnmarshaller.tt | 13 +- .../SourceFiles/EventStreamGenerator.cs | 180 +++++-- .../SourceFiles/EventStreamGenerator.tt | 40 +- .../SourceFiles/StructureGenerator.cs | 264 +++++----- .../SourceFiles/StructureGenerator.tt | 1 + generator/ServiceClientGeneratorLib/Member.cs | 35 +- sdk/src/Core/AWSConfigs.cs | 28 +- sdk/src/Core/AWSSDK.Core.NetFramework.csproj | 2 +- sdk/src/Core/AWSSDK.Core.NetStandard.csproj | 2 +- .../Transform/DocumentUnmarshaller.cs | 75 +-- .../EventStreams/Internal/EventStreamUtils.cs | 3 +- .../IJsonErrorResponseUnmarshaller.cs | 27 ++ .../Internal/Transform/IJsonUnmarshaller.cs | 30 ++ .../Transform/IResponseUnmarshaller.cs | 15 +- ...er.cs => IXmlErrorResponseUnmarshaller.cs} | 11 +- .../{IUnmarshaller.cs => IXmlUnmarshaller.cs} | 14 +- .../JsonErrorResponseUnmarshaller.cs | 28 +- .../Transform/JsonUnmarshallerContext.cs | 126 ++--- .../Transform/ResponseUnmarshallers.cs | 11 +- .../Transform/SimpleTypeUnmarshaller.cs | 265 +++++----- .../Internal/Transform/UnmarshallerContext.cs | 25 + ...ler.cs => XmlErrorResponseUnmarshaller.cs} | 10 +- .../Internal/Util/JsonConstants.cs | 28 ++ .../Internal/Util/StreamingUtf8JsonReader.cs | 184 +++++++ .../Core/Amazon.Util/Internal/RootConfig.cs | 1 + sdk/src/Core/GlobalSuppressions.cs | 13 +- .../DynamoDBv2/Custom/DocumentModel/Util.cs | 26 +- .../StreamingUtf8JsonReaderTests.cs | 111 +++++ 49 files changed, 1590 insertions(+), 1039 deletions(-) create mode 100644 sdk/src/Core/Amazon.Runtime/Internal/Transform/IJsonErrorResponseUnmarshaller.cs create mode 100644 sdk/src/Core/Amazon.Runtime/Internal/Transform/IJsonUnmarshaller.cs rename sdk/src/Core/Amazon.Runtime/Internal/Transform/{IErrorResponseUnmarshaller.cs => IXmlErrorResponseUnmarshaller.cs} (72%) rename sdk/src/Core/Amazon.Runtime/Internal/Transform/{IUnmarshaller.cs => IXmlUnmarshaller.cs} (65%) rename sdk/src/Core/Amazon.Runtime/Internal/Transform/{ErrorResponseUnmarshaller.cs => XmlErrorResponseUnmarshaller.cs} (90%) create mode 100644 sdk/src/Core/Amazon.Runtime/Internal/Util/JsonConstants.cs create mode 100644 sdk/src/Core/Amazon.Runtime/Internal/Util/StreamingUtf8JsonReader.cs create mode 100644 sdk/test/UnitTests/Custom/Marshalling/StreamingUtf8JsonReaderTests.cs diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.cs index bb9e2298f1cc..c7e2a92fc95b 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.cs @@ -273,7 +273,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte /// public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + ErrorResponse errorResponse = XmlErrorResponseUnmarshaller.GetInstance().Unmarshall(context); "); #line 121 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryEC2ResponseUnmarshaller.tt" diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.tt index 378de529009f..6207a8edd2bf 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryEC2ResponseUnmarshaller.tt @@ -117,7 +117,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + ErrorResponse errorResponse = XmlErrorResponseUnmarshaller.GetInstance().Unmarshall(context); <# foreach (var exception in this.Operation.Exceptions) { diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.cs index 01aa30211aa1..1ddd526d3a47 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.cs @@ -18,7 +18,7 @@ namespace ServiceClientGenerator.Generators.Marshallers /// Class to produce the template output /// - #line 1 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class AWSQueryExceptionUnmarshaller : BaseResponseUnmarshaller { @@ -29,7 +29,7 @@ public partial class AWSQueryExceptionUnmarshaller : BaseResponseUnmarshaller public override string TransformText() { - #line 6 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 6 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" AddLicenseHeader(); @@ -40,7 +40,7 @@ public override string TransformText() #line hidden this.Write("#pragma warning disable CS0612,CS0618\r\nnamespace "); - #line 12 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 12 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default @@ -48,21 +48,21 @@ public override string TransformText() this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// \r\n /// Response U" + "nmarshaller for "); - #line 15 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 15 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" operation\r\n /// \r\n public class "); - #line 17 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write("Unmarshaller : IErrorResponseUnmarshaller<"); + this.Write("Unmarshaller : IXmlErrorResponseUnmarshaller<"); - #line 17 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -72,7 +72,7 @@ public override string TransformText() "\n /// \r\n /// \r\n " + " public "); - #line 24 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 24 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -90,7 +90,7 @@ public override string TransformText() /// public "); - #line 35 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 35 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -98,14 +98,14 @@ public override string TransformText() this.Write(" Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse" + " errorResponse)\r\n {\r\n "); - #line 37 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 37 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" response = new "); - #line 37 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 37 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -125,7 +125,7 @@ public override string TransformText() { "); - #line 50 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 50 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" if(this.Structure != null) { @@ -138,14 +138,14 @@ public override string TransformText() #line hidden this.Write(" if (context.TestExpression(\""); - #line 57 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(testExpression)); #line default #line hidden this.Write("\", targetDepth))\r\n {\r\n"); - #line 59 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 59 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" if (member.IsMap || member.IsList) { @@ -155,42 +155,42 @@ public override string TransformText() #line hidden this.Write(" if (response."); - #line 63 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 63 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(MemberAccessorFor(member.PropertyName))); #line default #line hidden this.Write(" == null)\r\n {\r\n response."); - #line 65 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 65 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(MemberAccessorFor(member.PropertyName))); #line default #line hidden this.Write(" = new "); - #line 65 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 65 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineType())); #line default #line hidden this.Write("();\r\n }\r\n var item = "); - #line 67 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 67 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(".Unmarshall(context);\r\n response."); - #line 68 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 68 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(MemberAccessorFor(member.PropertyName))); #line default #line hidden this.Write(".Add(item);\r\n"); - #line 69 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 69 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" } else @@ -201,21 +201,21 @@ public override string TransformText() #line hidden this.Write(" response."); - #line 74 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 74 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(MemberAccessorFor(member.PropertyName))); #line default #line hidden this.Write(" = "); - #line 74 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 74 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(".Unmarshall(context);\r\n"); - #line 75 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 75 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" } @@ -224,7 +224,7 @@ public override string TransformText() #line hidden this.Write(" }\r\n"); - #line 79 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 79 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" } } @@ -234,7 +234,7 @@ public override string TransformText() #line hidden this.Write(" }\r\n }\r\n return response;\r\n }\r\n\r\n"); - #line 88 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 88 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" this.AddStructureSingletonMethod(); @@ -245,7 +245,7 @@ public override string TransformText() return this.GenerationEnvironment.ToString(); } - #line 94 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" + #line 94 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryExceptionUnmarshaller.tt" // if the result fields have been wrapped in a subordinate structure, wire the accessor // to use it when addressing a member diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.tt index 0f17743a821d..ea6fd3f5d926 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryExceptionUnmarshaller.tt @@ -14,7 +14,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// /// Response Unmarshaller for <#=this.UnmarshallerBaseName #> operation /// - public class <#=this.UnmarshallerBaseName #>Unmarshaller : IErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext> + public class <#=this.UnmarshallerBaseName #>Unmarshaller : IXmlErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext> { /// /// Unmarshaller the response from the service to the response class. diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.cs index 65d9a560f376..9fca6b480d3f 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.cs @@ -316,7 +316,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte /// public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + ErrorResponse errorResponse = XmlErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.tt index 772e6bc50820..f5f0c8d075a9 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryResponseUnmarshaller.tt @@ -138,7 +138,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + ErrorResponse errorResponse = XmlErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.cs index 43daa547babb..16f6324eb5b0 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.cs @@ -18,7 +18,7 @@ namespace ServiceClientGenerator.Generators.Marshallers /// Class to produce the template output /// - #line 1 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class AWSQueryStructureUnmarshaller : BaseResponseUnmarshaller { @@ -29,7 +29,7 @@ public partial class AWSQueryStructureUnmarshaller : BaseResponseUnmarshaller public override string TransformText() { - #line 6 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 6 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" AddLicenseHeader(); @@ -40,7 +40,7 @@ public override string TransformText() #line hidden this.Write("#pragma warning disable CS0612,CS0618\r\nnamespace "); - #line 12 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 12 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default @@ -48,52 +48,45 @@ public override string TransformText() this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// \r\n /// Response U" + "nmarshaller for "); - #line 15 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 15 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" Object\r\n /// \r\n public class "); - #line 17 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write("Unmarshaller : IUnmarshaller<"); + this.Write("Unmarshaller : IXmlUnmarshaller<"); - #line 17 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write(", XmlUnmarshallerContext>, IUnmarshaller<"); + this.Write(", XmlUnmarshallerContext>\r\n {\r\n /// \r\n /// Unmarshaller" + + " the response from the service to the response class.\r\n /// \r" + + "\n /// \r\n /// \r\n " + + " public "); - #line 17 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); - - #line default - #line hidden - this.Write(", JsonUnmarshallerContext>\r\n {\r\n /// \r\n /// Unmarshalle" + - "r the response from the service to the response class.\r\n /// " + - "\r\n /// \r\n /// \r\n " + - " public "); - - #line 24 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 24 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" Unmarshall(XmlUnmarshallerContext context)\r\n {\r\n "); - #line 26 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 26 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" unmarshalledObject = new "); - #line 26 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 26 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -111,7 +104,7 @@ public override string TransformText() { "); - #line 37 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 37 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" if(this.Structure != null) { @@ -124,7 +117,7 @@ public override string TransformText() #line hidden this.Write(" if (context.TestExpression(\""); - #line 44 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 44 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(testExpression)); #line default @@ -132,14 +125,14 @@ public override string TransformText() this.Write("\", targetDepth))\r\n {\r\n var unmarshaller" + " = "); - #line 46 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 46 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n"); - #line 47 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 47 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" if (member.IsMap || member.IsList) { @@ -149,7 +142,7 @@ public override string TransformText() #line hidden this.Write(" if (unmarshalledObject."); - #line 51 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 51 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default @@ -157,14 +150,14 @@ public override string TransformText() this.Write(" == null)\r\n {\r\n unmarshalledObj" + "ect."); - #line 53 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 53 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = new "); - #line 53 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 53 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineType())); #line default @@ -172,14 +165,14 @@ public override string TransformText() this.Write("();\r\n }\r\n var item = unmarshaller.U" + "nmarshall(context);\r\n unmarshalledObject."); - #line 56 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 56 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(item);\r\n"); - #line 57 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" } else @@ -190,14 +183,14 @@ public override string TransformText() #line hidden this.Write(" unmarshalledObject."); - #line 62 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 62 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n"); - #line 63 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 63 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" } @@ -206,7 +199,7 @@ public override string TransformText() #line hidden this.Write(" continue;\r\n }\r\n"); - #line 68 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 68 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" } } @@ -224,22 +217,9 @@ public override string TransformText() return unmarshalledObject; } - /// - /// Unmarshaller error response to exception. - /// - /// - /// - public "); - - #line 87 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); - - #line default - #line hidden - this.Write(" Unmarshall(JsonUnmarshallerContext context)\r\n {\r\n return null;" + - "\r\n }\r\n\r\n\r\n"); +"); - #line 93 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" + #line 82 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\AWSQueryStructureUnmarshaller.tt" this.AddStructureSingletonMethod(); diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.tt index d5ca583c4f05..15453b45a2c4 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/AWSQueryStructureUnmarshaller.tt @@ -14,7 +14,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// /// Response Unmarshaller for <#=this.UnmarshallerBaseName #> Object /// - public class <#=this.UnmarshallerBaseName #>Unmarshaller : IUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext>, IUnmarshaller<<#=this.UnmarshallerBaseName #>, JsonUnmarshallerContext> + public class <#=this.UnmarshallerBaseName #>Unmarshaller : IXmlUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext> { /// /// Unmarshaller the response from the service to the response class. @@ -79,17 +79,6 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations return unmarshalledObject; } - /// - /// Unmarshaller error response to exception. - /// - /// - /// - public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context) - { - return null; - } - - <# this.AddStructureSingletonMethod(); #> diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.cs index cfb8e819b070..a76b07e68f69 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.cs @@ -18,7 +18,7 @@ namespace ServiceClientGenerator.Generators.Marshallers /// Class to produce the template output /// - #line 1 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class JsonRPCExceptionUnmarshaller : BaseResponseUnmarshaller { @@ -29,7 +29,7 @@ public partial class JsonRPCExceptionUnmarshaller : BaseResponseUnmarshaller public override string TransformText() { - #line 6 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 6 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" AddLicenseHeader(); @@ -38,10 +38,10 @@ public override string TransformText() #line default #line hidden - this.Write("using ThirdParty.Json.LitJson;\r\n\r\n#pragma warning disable CS0612,CS0618\r\nnamespac" + - "e "); + this.Write("using System.Text.Json;\r\nusing Amazon.Util;\r\n#pragma warning disable CS0612,CS061" + + "8\r\nnamespace "); - #line 14 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 14 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default @@ -49,38 +49,43 @@ public override string TransformText() this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// \r\n /// Response U" + "nmarshaller for "); - #line 17 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" Object\r\n /// \r\n public class "); - #line 19 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 19 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write("Unmarshaller : IErrorResponseUnmarshaller<"); + this.Write("Unmarshaller : IJsonErrorResponseUnmarshaller<"); - #line 19 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 19 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write(", JsonUnmarshallerContext>\r\n {\r\n /// \r\n /// Unmarshalle" + - "r the response from the service to the response class.\r\n /// " + - "\r\n /// \r\n /// \r\n " + - " public "); + this.Write(@", JsonUnmarshallerContext> + { + /// + /// Unmarshaller the response from the service to the response class. + /// + /// + /// + /// + public "); - #line 26 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write(@" Unmarshall(JsonUnmarshallerContext context) + this.Write(@" Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader) { - return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse()); + return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse(), ref reader); } /// @@ -88,18 +93,20 @@ public override string TransformText() /// /// /// + /// /// public "); - #line 37 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 39 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorRespons" + - "e errorResponse)\r\n {\r\n context.Read();\r\n\r\n"); + "e errorResponse, ref StreamingUtf8JsonReader reader)\r\n {\r\n con" + + "text.Read(ref reader);\r\n\r\n"); - #line 41 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 43 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" if (this.Config.ServiceModel.IsAwsQueryCompatible) { @@ -110,14 +117,14 @@ public override string TransformText() #line hidden this.Write(" "); - #line 46 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 48 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" unmarshalledObject = new "); - #line 46 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 48 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -125,7 +132,7 @@ public override string TransformText() this.Write("(errorResponse.Message, errorResponse.InnerException,\r\n errorType," + " errorCode, errorResponse.RequestId, errorResponse.StatusCode);\r\n"); - #line 48 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 50 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" } else @@ -136,14 +143,14 @@ public override string TransformText() #line hidden this.Write(" "); - #line 53 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 55 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" unmarshalledObject = new "); - #line 53 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 55 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -152,7 +159,7 @@ public override string TransformText() "nse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode)" + ";\r\n"); - #line 55 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" } @@ -160,9 +167,9 @@ public override string TransformText() #line default #line hidden this.Write(" \r\n int targetDepth = context.CurrentDepth;\r\n while " + - "(context.ReadAtDepth(targetDepth))\r\n {\r\n"); + "(context.ReadAtDepth(targetDepth, ref reader))\r\n {\r\n"); - #line 62 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 64 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" if(this.Structure != null) { @@ -174,29 +181,29 @@ public override string TransformText() #line hidden this.Write(" if (context.TestExpression(\""); - #line 68 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 70 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); #line default #line hidden this.Write("\", targetDepth))\r\n {\r\n var unmarshaller = "); - #line 70 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 72 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n unmarshalledObject."); - #line 71 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 73 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden - this.Write(" = unmarshaller.Unmarshall(context);\r\n continue;\r\n " + - " }\r\n"); + this.Write(" = unmarshaller.Unmarshall(context, ref reader);\r\n continue;\r\n" + + " }\r\n"); - #line 74 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 76 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" } } @@ -206,7 +213,7 @@ public override string TransformText() #line hidden this.Write(" }\r\n \r\n return unmarshalledObject;\r\n }\r\n\r\n"); - #line 83 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" + #line 85 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCExceptionUnmarshaller.tt" this.AddStructureSingletonMethod(); diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.tt index 97ebdf03a760..2c75b5a2d328 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCExceptionUnmarshaller.tt @@ -8,24 +8,25 @@ AddCommonUsingStatements(); #> -using ThirdParty.Json.LitJson; - +using System.Text.Json; +using Amazon.Util; #pragma warning disable CS0612,CS0618 namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations { /// /// Response Unmarshaller for <#=this.UnmarshallerBaseName #> Object /// - public class <#=this.UnmarshallerBaseName #>Unmarshaller : IErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, JsonUnmarshallerContext> + public class <#=this.UnmarshallerBaseName #>Unmarshaller : IJsonErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, JsonUnmarshallerContext> { /// /// Unmarshaller the response from the service to the response class. /// /// + /// /// - public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context) + public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader) { - return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse()); + return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse(), ref reader); } /// @@ -33,10 +34,11 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// /// /// + /// /// - public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse) + public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse, ref StreamingUtf8JsonReader reader) { - context.Read(); + context.Read(ref reader); <# if (this.Config.ServiceModel.IsAwsQueryCompatible) @@ -57,7 +59,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations #> int targetDepth = context.CurrentDepth; - while (context.ReadAtDepth(targetDepth)) + while (context.ReadAtDepth(targetDepth, ref reader)) { <# if(this.Structure != null) @@ -68,7 +70,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations if (context.TestExpression("<#=member.MarshallName#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; - unmarshalledObject.<#=member.PropertyName#> = unmarshaller.Unmarshall(context); + unmarshalledObject.<#=member.PropertyName#> = unmarshaller.Unmarshall(context, ref reader); continue; } <# diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.cs index 053f57ad0c6c..6749cdb7781c 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.cs @@ -38,8 +38,8 @@ public override string TransformText() #line default #line hidden - this.Write("using ThirdParty.Json.LitJson;\r\n\r\n#pragma warning disable CS0612,CS0618\r\nnamespac" + - "e "); + this.Write("using System.Text.Json;\r\nusing Amazon.Util;\r\n#pragma warning disable CS0612,CS061" + + "8\r\nnamespace "); #line 14 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); @@ -84,9 +84,9 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line default #line hidden - this.Write("Response();\r\n\r\n"); + this.Write("Response();\r\n"); - #line 30 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 29 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" var payload = this.Operation.ResponsePayloadMember; var unmarshallPayload = payload != null && payload.IsStructure; @@ -114,21 +114,21 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line hidden this.Write(" response."); - #line 52 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 51 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = new "); - #line 52 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 51 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.Shape.Name)); #line default #line hidden this.Write("(context.Stream);\r\n"); - #line 53 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 52 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } else if (payloadIsStream) @@ -141,14 +141,14 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line hidden this.Write(" response."); - #line 60 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 59 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = context.Stream;\r\n"); - #line 61 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 60 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } else if (payload.ModelShape.IsString) @@ -160,14 +160,14 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont this.Write(" using (var sr = new StreamReader(context.Stream))\r\n {\r\n " + " response."); - #line 68 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 67 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = sr.ReadToEnd();\r\n }\r\n"); - #line 70 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 69 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } else if (payload.ModelShape.IsMemoryStream) @@ -180,14 +180,14 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont "yStream(context.Stream, ms);\r\n ms.Seek(0, SeekOrigin.Begin);\r\n " + " if (ms.Length > 0)\r\n response."); - #line 79 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 78 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.PropertyName)); #line default #line hidden this.Write(" = ms;\r\n"); - #line 80 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 79 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } else @@ -205,7 +205,8 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line default #line hidden - this.Write(" var unmarshaller = "); + this.Write(" StreamingUtf8JsonReader reader = new StreamingUtf8JsonReader(context." + + "Stream);\r\n var unmarshaller = "); #line 94 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(payload.DetermineTypeUnmarshallerInstantiate())); @@ -219,7 +220,7 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line default #line hidden - this.Write(" = unmarshaller.Unmarshall(context);\r\n"); + this.Write(" = unmarshaller.Unmarshall(context, ref reader);\r\n"); #line 96 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" @@ -244,7 +245,7 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line default #line hidden - this.Write("Unmarshaller.Instance.Unmarshall(context);\r\n"); + this.Write("Unmarshaller.Instance.Unmarshall(context, ref reader);\r\n"); #line 102 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" @@ -255,10 +256,14 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line default #line hidden - this.Write(" context.Read();\r\n int targetDepth = context.CurrentDepth;\r" + - "\n while (context.ReadAtDepth(targetDepth))\r\n {\r\n"); + this.Write(@" StreamingUtf8JsonReader reader = new StreamingUtf8JsonReader(context.Stream); + context.Read(ref reader); + int targetDepth = context.CurrentDepth; + while (context.ReadAtDepth(targetDepth, ref reader)) + { +"); - #line 111 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 112 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" foreach (var member in this.Operation.ResponseBodyMembers) @@ -269,29 +274,29 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line hidden this.Write(" if (context.TestExpression(\""); - #line 116 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 117 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); #line default #line hidden this.Write("\", targetDepth))\r\n {\r\n var unmarshaller = "); - #line 118 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 119 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n response."); - #line 119 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 120 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden - this.Write(" = unmarshaller.Unmarshall(context);\r\n continue;\r\n " + - " }\r\n"); + this.Write(" = unmarshaller.Unmarshall(context, ref reader);\r\n continue;\r\n" + + " }\r\n"); - #line 122 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 123 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } @@ -300,7 +305,7 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont #line hidden this.Write(" }\r\n"); - #line 126 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 127 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } } @@ -323,7 +328,8 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont /// public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + StreamingUtf8JsonReader reader = new StreamingUtf8JsonReader(context.Stream); + var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context, ref reader); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; @@ -332,7 +338,7 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte using (var streamCopy = new MemoryStream(responseBodyBytes)) "); - #line 152 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 154 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" if (this.Config.ServiceModel.IsAwsQueryCompatible) { @@ -341,17 +347,19 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte #line default #line hidden - #line 156 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 158 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" // Create a copy of context with headers in the response + + #line default #line hidden - this.Write("\r\n using (var contextCopy = new JsonUnmarshallerContext(streamCopy, tr" + - "ue, context.ResponseData))\r\n"); + this.Write(" using (var contextCopy = new JsonUnmarshallerContext(streamCopy, true" + + ", context.ResponseData))\r\n"); - #line 159 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 162 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" - } + } else { @@ -361,16 +369,18 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte this.Write(" using (var contextCopy = new JsonUnmarshallerContext(streamCopy, fals" + "e, null))\r\n"); - #line 165 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 168 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + // Create a new reader because the stream has been read already in the original context } #line default #line hidden - this.Write(" {\r\n"); + this.Write(" {\r\n StreamingUtf8JsonReader readerCopy = new Streaming" + + "Utf8JsonReader(streamCopy);\r\n"); - #line 169 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 174 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" foreach (var exception in this.Operation.Exceptions) { @@ -380,22 +390,22 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte #line hidden this.Write(" if (errorResponse.Code != null && errorResponse.Code.Equals(\""); - #line 173 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 178 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Code)); #line default #line hidden this.Write("\"))\r\n {\r\n return "); - #line 175 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 180 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(exception.Name)); #line default #line hidden - this.Write("Unmarshaller.Instance.Unmarshall(contextCopy, errorResponse);\r\n }\r" + - "\n"); + this.Write("Unmarshaller.Instance.Unmarshall(contextCopy, errorResponse, ref readerCopy);\r\n " + + " }\r\n"); - #line 177 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 182 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } @@ -404,7 +414,7 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte #line hidden this.Write(" }\r\n"); - #line 181 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 186 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" if (this.Config.ServiceModel.IsAwsQueryCompatible) { @@ -415,7 +425,7 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte #line hidden this.Write(" return new "); - #line 186 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 191 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.BaseException)); #line default @@ -423,7 +433,7 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte this.Write("(errorResponse.Message, errorResponse.InnerException, errorType, errorCode, error" + "Response.RequestId, errorResponse.StatusCode);\r\n"); - #line 187 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 192 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } else @@ -434,7 +444,7 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte #line hidden this.Write(" return new "); - #line 192 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 197 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.BaseException)); #line default @@ -442,7 +452,7 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte this.Write("(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorRe" + "sponse.Code, errorResponse.RequestId, errorResponse.StatusCode);\r\n"); - #line 193 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 198 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } @@ -451,7 +461,7 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte #line hidden this.Write(" }\r\n\r\n"); - #line 198 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 203 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" if (payload != null && payload.Shape.IsStreaming) { @@ -472,7 +482,7 @@ public override bool HasStreamingProperty "); - #line 213 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 218 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } this.AddResponseSingletonMethod(); @@ -481,7 +491,7 @@ public override bool HasStreamingProperty #line default #line hidden - #line 217 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 222 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" if(isEventStreamOutput) { @@ -505,7 +515,7 @@ protected override bool ShouldReadEntireResponse(IWebResponseData response, bool public override bool HasStreamingProperty => true; "); - #line 235 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" + #line 240 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCResponseUnmarshaller.tt" } diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.tt index e2e75b05f40c..f26f178159f2 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.tt @@ -8,8 +8,8 @@ AddCommonUsingStatements(); #> -using ThirdParty.Json.LitJson; - +using System.Text.Json; +using Amazon.Util; #pragma warning disable CS0612,CS0618 namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations { @@ -26,7 +26,6 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { <#=this.UnmarshallerBaseName #>Response response = new <#=this.Operation.Name #>Response(); - <# var payload = this.Operation.ResponsePayloadMember; var unmarshallPayload = payload != null && payload.IsStructure; @@ -91,22 +90,24 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations else if (unmarshallPayload) { #> + StreamingUtf8JsonReader reader = new StreamingUtf8JsonReader(context.Stream); var unmarshaller = <#= payload.DetermineTypeUnmarshallerInstantiate() #>; - response.<#=payload.PropertyName#> = unmarshaller.Unmarshall(context); + response.<#=payload.PropertyName#> = unmarshaller.Unmarshall(context, ref reader); <# } else if (this.IsWrapped) { #> - response.<#=this.WrappedResultMember#> = <#=this.Structure.Name#>Unmarshaller.Instance.Unmarshall(context); + response.<#=this.WrappedResultMember#> = <#=this.Structure.Name#>Unmarshaller.Instance.Unmarshall(context, ref reader); <# } else { #> - context.Read(); + StreamingUtf8JsonReader reader = new StreamingUtf8JsonReader(context.Stream); + context.Read(ref reader); int targetDepth = context.CurrentDepth; - while (context.ReadAtDepth(targetDepth)) + while (context.ReadAtDepth(targetDepth, ref reader)) { <# @@ -116,7 +117,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations if (context.TestExpression("<#=member.MarshallName#>", targetDepth)) { var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>; - response.<#=member.PropertyName#> = unmarshaller.Unmarshall(context); + response.<#=member.PropertyName#> = unmarshaller.Unmarshall(context, ref reader); continue; } <# @@ -142,7 +143,8 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + StreamingUtf8JsonReader reader = new StreamingUtf8JsonReader(context.Stream); + var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context, ref reader); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; @@ -153,26 +155,29 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations if (this.Config.ServiceModel.IsAwsQueryCompatible) { #> -<# // Create a copy of context with headers in the response #> +<# // Create a copy of context with headers in the response +#> using (var contextCopy = new JsonUnmarshallerContext(streamCopy, true, context.ResponseData)) <# - } + } else { #> using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) <# + // Create a new reader because the stream has been read already in the original context } #> { + StreamingUtf8JsonReader readerCopy = new StreamingUtf8JsonReader(streamCopy); <# foreach (var exception in this.Operation.Exceptions) { #> if (errorResponse.Code != null && errorResponse.Code.Equals("<#=exception.Code #>")) { - return <#=exception.Name#>Unmarshaller.Instance.Unmarshall(contextCopy, errorResponse); + return <#=exception.Name#>Unmarshaller.Instance.Unmarshall(contextCopy, errorResponse, ref readerCopy); } <# } diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCStructureMarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCStructureMarshaller.cs index 99c3fe3c02f4..097fa49208ed 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCStructureMarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCStructureMarshaller.cs @@ -38,31 +38,30 @@ public override string TransformText() #line default #line hidden - this.Write("using ThirdParty.Json.LitJson;\r\n\r\n#pragma warning disable CS0612,CS0618\r\nnamespac" + - "e "); + this.Write("#pragma warning disable CS0612,CS0618\r\nnamespace "); - #line 14 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 12 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default #line hidden this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n\t/// \r\n\t/// "); - #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 15 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default #line hidden this.Write(" Marshaller\r\n\t/// \r\n\tpublic class "); - #line 19 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default #line hidden this.Write("Marshaller : IRequestMarshaller<"); - #line 19 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default @@ -77,7 +76,7 @@ public override string TransformText() /// public void Marshall("); - #line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 25 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default @@ -85,7 +84,7 @@ public override string TransformText() this.Write(" requestObject, JsonMarshallerContext context)\r\n\t\t{\r\n\t\t\tif(requestObject == null)" + "\r\n\t\t\t\treturn;\r\n"); - #line 31 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 29 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" ProcessMembers(0, "requestObject", this.Structure.Members); @@ -95,14 +94,14 @@ public override string TransformText() this.Write("\t\t}\r\n\r\n /// \r\n /// Singleton Marshaller.\r\n /// \r\n\t\tpublic readonly static "); - #line 39 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 37 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default #line hidden this.Write("Marshaller Instance = new "); - #line 39 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 37 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default @@ -111,7 +110,7 @@ public override string TransformText() return this.GenerationEnvironment.ToString(); } - #line 44 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" + #line 42 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\JsonRPCStructureMarshaller.tt" protected void ProcessMembers(int level, string variableName, IEnumerable members) { @@ -122,91 +121,91 @@ protected void ProcessMembers(int level, string variableName, IEnumerable - #line 1 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class RestXmlExceptionUnmarshaller : BaseResponseUnmarshaller { @@ -29,7 +29,7 @@ public partial class RestXmlExceptionUnmarshaller : BaseResponseUnmarshaller public override string TransformText() { - #line 6 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 6 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" AddLicenseHeader(); @@ -40,7 +40,7 @@ public override string TransformText() #line hidden this.Write("\r\n#pragma warning disable CS0612,CS0618\r\nnamespace "); - #line 13 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 13 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace)); #line default @@ -48,21 +48,21 @@ public override string TransformText() this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// \r\n /// Response U" + "nmarshaller for "); - #line 16 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 16 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" operation\r\n /// \r\n public class "); - #line 18 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 18 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write("Unmarshaller : IErrorResponseUnmarshaller<"); + this.Write("Unmarshaller : IXmlErrorResponseUnmarshaller<"); - #line 18 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 18 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -72,7 +72,7 @@ public override string TransformText() "\n /// \r\n /// \r\n " + " public "); - #line 25 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 25 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -90,7 +90,7 @@ public override string TransformText() /// public "); - #line 36 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 36 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -98,14 +98,14 @@ public override string TransformText() this.Write(" Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse" + " errorResponse)\r\n {\r\n "); - #line 38 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 38 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden this.Write(" response = new "); - #line 38 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 38 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default @@ -119,7 +119,7 @@ public override string TransformText() { "); - #line 45 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 45 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" foreach (var member in this.Structure.Members) { @@ -132,56 +132,56 @@ public override string TransformText() #line hidden this.Write(" if (context.TestExpression(\""); - #line 52 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 52 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); #line default #line hidden this.Write("/"); - #line 52 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 52 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(listMarshallName)); #line default #line hidden this.Write("\"))\r\n {\r\n var unmarshaller = "); - #line 54 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 54 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n if (response."); - #line 55 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 55 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" == null)\r\n {\r\n response."); - #line 57 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = new "); - #line 57 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 57 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineType())); #line default #line hidden this.Write("();\r\n }\r\n response."); - #line 59 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 59 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(".Add(unmarshaller.Unmarshall(context));\r\n }\r\n"); - #line 61 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 61 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" } else @@ -192,28 +192,28 @@ public override string TransformText() #line hidden this.Write(" if (context.TestExpression(\""); - #line 66 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 66 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.MarshallName)); #line default #line hidden this.Write("\"))\r\n {\r\n var unmarshaller = "); - #line 68 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 68 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.DetermineTypeUnmarshallerInstantiate())); #line default #line hidden this.Write(";\r\n response."); - #line 69 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 69 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName)); #line default #line hidden this.Write(" = unmarshaller.Unmarshall(context);\r\n }\r\n"); - #line 71 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 71 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" } } @@ -223,7 +223,7 @@ public override string TransformText() #line hidden this.Write(" }\r\n }\r\n return response;\r\n }\r\n\r\n"); - #line 80 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" + #line 80 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlExceptionUnmarshaller.tt" this.AddStructureSingletonMethod(); diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlExceptionUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlExceptionUnmarshaller.tt index 07d55b10dca8..6c8ce78f5466 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlExceptionUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlExceptionUnmarshaller.tt @@ -15,7 +15,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// /// Response Unmarshaller for <#=this.UnmarshallerBaseName #> operation /// - public class <#=this.UnmarshallerBaseName #>Unmarshaller : IErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext> + public class <#=this.UnmarshallerBaseName #>Unmarshaller : IXmlErrorResponseUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext> { /// /// Unmarshaller the response from the service to the response class. diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs index 9fb648ede0a3..74ab4807fd95 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.cs @@ -581,7 +581,7 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte /// public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + ErrorResponse errorResponse = XmlErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt index e473947324a2..a5b3af7512b1 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlResponseUnmarshaller.tt @@ -246,7 +246,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { - ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); + ErrorResponse errorResponse = XmlErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.cs b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.cs index 42e69ac2f4d0..edb58da33d98 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.cs +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.cs @@ -60,24 +60,17 @@ public override string TransformText() #line default #line hidden - this.Write("Unmarshaller : IUnmarshaller<"); + this.Write("Unmarshaller : IXmlUnmarshaller<"); #line 18 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); #line default #line hidden - this.Write(", XmlUnmarshallerContext>, IUnmarshaller<"); - - #line 18 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlStructureUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); - - #line default - #line hidden - this.Write(", JsonUnmarshallerContext>\r\n {\r\n /// \r\n /// Unmarshalle" + - "r the response from the service to the response class.\r\n /// " + - "\r\n /// \r\n /// \r\n " + - " public "); + this.Write(", XmlUnmarshallerContext>\r\n {\r\n /// \r\n /// Unmarshaller" + + " the response from the service to the response class.\r\n /// \r" + + "\n /// \r\n /// \r\n " + + " public "); #line 25 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlStructureUnmarshaller.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); @@ -321,23 +314,9 @@ public override string TransformText() } return unmarshalledObject; } - - /// - /// Unmarshaller the response from the service to the response class. - /// - /// - /// - public "); - - #line 128 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlStructureUnmarshaller.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(this.UnmarshallerBaseName)); - - #line default - #line hidden - this.Write(" Unmarshall(JsonUnmarshallerContext context)\r\n {\r\n throw new No" + - "tImplementedException();\r\n }\r\n\r\n"); +"); - #line 133 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlStructureUnmarshaller.tt" + #line 122 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Marshallers\RestXmlStructureUnmarshaller.tt" this.AddStructureSingletonMethod(); diff --git a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.tt b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.tt index 4dd4fe8f796f..1cc56dbbf1de 100644 --- a/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.tt +++ b/generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlStructureUnmarshaller.tt @@ -15,7 +15,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations /// /// Response Unmarshaller for <#=this.UnmarshallerBaseName #> Object /// - public class <#=this.UnmarshallerBaseName #>Unmarshaller : IUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext>, IUnmarshaller<<#=this.UnmarshallerBaseName #>, JsonUnmarshallerContext> + public class <#=this.UnmarshallerBaseName #>Unmarshaller : IXmlUnmarshaller<<#=this.UnmarshallerBaseName #>, XmlUnmarshallerContext> { /// /// Unmarshaller the response from the service to the response class. @@ -119,17 +119,6 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations } return unmarshalledObject; } - - /// - /// Unmarshaller the response from the service to the response class. - /// - /// - /// - public <#=this.UnmarshallerBaseName #> Unmarshall(JsonUnmarshallerContext context) - { - throw new NotImplementedException(); - } - <# this.AddStructureSingletonMethod(); #> diff --git a/generator/ServiceClientGeneratorLib/Generators/SourceFiles/EventStreamGenerator.cs b/generator/ServiceClientGeneratorLib/Generators/SourceFiles/EventStreamGenerator.cs index ecc5b4f08fee..60f64abc0828 100644 --- a/generator/ServiceClientGeneratorLib/Generators/SourceFiles/EventStreamGenerator.cs +++ b/generator/ServiceClientGeneratorLib/Generators/SourceFiles/EventStreamGenerator.cs @@ -18,7 +18,7 @@ namespace ServiceClientGenerator.Generators.SourceFiles /// Class to produce the template output /// - #line 1 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" + #line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")] public partial class EventStreamGenerator : StructureGenerator { @@ -29,7 +29,7 @@ public partial class EventStreamGenerator : StructureGenerator public override string TransformText() { - #line 6 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" + #line 6 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" bool isRequest = this.Operation.RequestStructure.Members.Any(x => x.ModelShape.MarshallName == this.Structure.Name); bool isResponse = this.Operation.ResponseStructure.Members.Any(x => x.ModelShape.MarshallName == this.Structure.Name); @@ -40,7 +40,7 @@ public override string TransformText() this.Write(" [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Naming\", \"CA1710:Identifier" + "s should have correct suffix\", Justification = \""); - #line 10 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" + #line 10 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default @@ -49,14 +49,14 @@ public override string TransformText() [System.Diagnostics.CodeAnalysis.SuppressMessage(""Microsoft.Design"", ""CA1063"", Justification = ""IDisposable is a transient interface from IEventStream. Users need to be able to call Dispose."")] public sealed class "); - #line 12 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" + #line 12 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\EventStreamGenerator.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Structure.Name)); #line default #line hidden this.Write(" : EnumerableEventStream\r\n protected override IDictionary> ExceptionMapping {get;} =\r\n new Dictionary