From acd348b620511e278fbea74b090b45c41de97c7d Mon Sep 17 00:00:00 2001 From: Michael Yanni Date: Wed, 4 Dec 2019 16:44:10 -0800 Subject: [PATCH 1/3] Renamed ClientModel to ClientModels as to not conflict with the ClientModel class inside that namespace. --- .../BinaryTypeReference.cs | 2 +- .../{ClientModel => ClientModels}/ClientConstant.cs | 2 +- .../{ClientModel => ClientModels}/ClientEnum.cs | 2 +- .../{ClientModel => ClientModels}/ClientEnumValue.cs | 2 +- .../{ClientModel => ClientModels}/ClientMethod.cs | 2 +- .../ClientMethodRequest.cs | 2 +- .../{ClientModel => ClientModels}/ClientModel.cs | 2 +- .../{ClientModel => ClientModels}/ClientObject.cs | 2 +- .../ClientObjectConstant.cs | 2 +- .../ClientObjectProperty.cs | 2 +- .../ClientTypeReference.cs | 2 +- .../CollectionTypeReference.cs | 2 +- .../ConstantOrParameter.cs | 2 +- .../DictionaryTypeReference.cs | 2 +- .../FrameworkTypeReference.cs | 2 +- .../ISchemaTypeProvider.cs | 2 +- .../{ClientModel => ClientModels}/PathSegment.cs | 2 +- .../{ClientModel => ClientModels}/QueryParameter.cs | 2 +- .../SchemaTypeReference.cs | 2 +- .../{ClientModel => ClientModels}/ServiceClient.cs | 2 +- .../ServiceClientMethodParameter.cs | 2 +- src/AutoRest.CSharp.V3/CodeGen/ClientWriter.cs | 2 +- src/AutoRest.CSharp.V3/CodeGen/ModelWriter.cs | 4 ++-- src/AutoRest.CSharp.V3/CodeGen/SerializationWriter.cs | 4 ++-- src/AutoRest.CSharp.V3/CodeGen/TypeFactory.cs | 2 +- src/AutoRest.CSharp.V3/Pipeline/Extensions.cs | 2 +- src/AutoRest.CSharp.V3/Plugins/ModelExtensions.cs | 2 +- src/AutoRest.CSharp.V3/Plugins/Modeler.cs | 10 +++++----- 28 files changed, 34 insertions(+), 34 deletions(-) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/BinaryTypeReference.cs (90%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientConstant.cs (93%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientEnum.cs (94%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientEnumValue.cs (91%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientMethod.cs (94%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientMethodRequest.cs (96%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientModel.cs (86%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientObject.cs (95%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientObjectConstant.cs (92%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientObjectProperty.cs (94%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ClientTypeReference.cs (86%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/CollectionTypeReference.cs (91%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ConstantOrParameter.cs (96%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/DictionaryTypeReference.cs (93%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/FrameworkTypeReference.cs (92%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ISchemaTypeProvider.cs (88%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/PathSegment.cs (91%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/QueryParameter.cs (92%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/SchemaTypeReference.cs (92%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ServiceClient.cs (91%) rename src/AutoRest.CSharp.V3/{ClientModel => ClientModels}/ServiceClientMethodParameter.cs (93%) diff --git a/src/AutoRest.CSharp.V3/ClientModel/BinaryTypeReference.cs b/src/AutoRest.CSharp.V3/ClientModels/BinaryTypeReference.cs similarity index 90% rename from src/AutoRest.CSharp.V3/ClientModel/BinaryTypeReference.cs rename to src/AutoRest.CSharp.V3/ClientModels/BinaryTypeReference.cs index 4d4a96d4..a95b560f 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/BinaryTypeReference.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/BinaryTypeReference.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class BinaryTypeReference : ClientTypeReference { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientConstant.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientConstant.cs similarity index 93% rename from src/AutoRest.CSharp.V3/ClientModel/ClientConstant.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientConstant.cs index c00fd21b..8518c274 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientConstant.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientConstant.cs @@ -3,7 +3,7 @@ using System.Diagnostics; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal struct ClientConstant { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientEnum.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientEnum.cs similarity index 94% rename from src/AutoRest.CSharp.V3/ClientModel/ClientEnum.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientEnum.cs index 4c5701b2..82134ddb 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientEnum.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientEnum.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using AutoRest.CSharp.V3.Pipeline.Generated; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ClientEnum : ClientModel, ISchemaTypeProvider { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientEnumValue.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientEnumValue.cs similarity index 91% rename from src/AutoRest.CSharp.V3/ClientModel/ClientEnumValue.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientEnumValue.cs index e434a787..27ad9e9b 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientEnumValue.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientEnumValue.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ClientEnumValue { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientMethod.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientMethod.cs similarity index 94% rename from src/AutoRest.CSharp.V3/ClientModel/ClientMethod.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientMethod.cs index f106c87c..3f349f0e 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientMethod.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientMethod.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ClientMethod { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientMethodRequest.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientMethodRequest.cs similarity index 96% rename from src/AutoRest.CSharp.V3/ClientModel/ClientMethodRequest.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientMethodRequest.cs index fe1f652d..940fa277 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientMethodRequest.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientMethodRequest.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Azure.Core; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ClientMethodRequest { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientModel.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientModel.cs similarity index 86% rename from src/AutoRest.CSharp.V3/ClientModel/ClientModel.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientModel.cs index dafdae7b..305c7f96 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientModel.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientModel.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal abstract class ClientModel { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientObject.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientObject.cs similarity index 95% rename from src/AutoRest.CSharp.V3/ClientModel/ClientObject.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientObject.cs index fc59646f..c5ff45a9 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientObject.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientObject.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using AutoRest.CSharp.V3.Pipeline.Generated; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ClientObject : ClientModel, ISchemaTypeProvider { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientObjectConstant.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientObjectConstant.cs similarity index 92% rename from src/AutoRest.CSharp.V3/ClientModel/ClientObjectConstant.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientObjectConstant.cs index e2971d8e..cd4d7e5c 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientObjectConstant.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientObjectConstant.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ClientObjectConstant { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientObjectProperty.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientObjectProperty.cs similarity index 94% rename from src/AutoRest.CSharp.V3/ClientModel/ClientObjectProperty.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientObjectProperty.cs index d0c31b00..6a6b36de 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientObjectProperty.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientObjectProperty.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ClientObjectProperty { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ClientTypeReference.cs b/src/AutoRest.CSharp.V3/ClientModels/ClientTypeReference.cs similarity index 86% rename from src/AutoRest.CSharp.V3/ClientModel/ClientTypeReference.cs rename to src/AutoRest.CSharp.V3/ClientModels/ClientTypeReference.cs index 38fc9891..66cabd0f 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ClientTypeReference.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ClientTypeReference.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal abstract class ClientTypeReference { diff --git a/src/AutoRest.CSharp.V3/ClientModel/CollectionTypeReference.cs b/src/AutoRest.CSharp.V3/ClientModels/CollectionTypeReference.cs similarity index 91% rename from src/AutoRest.CSharp.V3/ClientModel/CollectionTypeReference.cs rename to src/AutoRest.CSharp.V3/ClientModels/CollectionTypeReference.cs index 782caa62..1d94888c 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/CollectionTypeReference.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/CollectionTypeReference.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class CollectionTypeReference : ClientTypeReference { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ConstantOrParameter.cs b/src/AutoRest.CSharp.V3/ClientModels/ConstantOrParameter.cs similarity index 96% rename from src/AutoRest.CSharp.V3/ClientModel/ConstantOrParameter.cs rename to src/AutoRest.CSharp.V3/ClientModels/ConstantOrParameter.cs index 8c3bdc54..508fee66 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ConstantOrParameter.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ConstantOrParameter.cs @@ -3,7 +3,7 @@ using System; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal struct ConstantOrParameter { diff --git a/src/AutoRest.CSharp.V3/ClientModel/DictionaryTypeReference.cs b/src/AutoRest.CSharp.V3/ClientModels/DictionaryTypeReference.cs similarity index 93% rename from src/AutoRest.CSharp.V3/ClientModel/DictionaryTypeReference.cs rename to src/AutoRest.CSharp.V3/ClientModels/DictionaryTypeReference.cs index 0745c2d8..0bae992c 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/DictionaryTypeReference.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/DictionaryTypeReference.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class DictionaryTypeReference: ClientTypeReference { diff --git a/src/AutoRest.CSharp.V3/ClientModel/FrameworkTypeReference.cs b/src/AutoRest.CSharp.V3/ClientModels/FrameworkTypeReference.cs similarity index 92% rename from src/AutoRest.CSharp.V3/ClientModel/FrameworkTypeReference.cs rename to src/AutoRest.CSharp.V3/ClientModels/FrameworkTypeReference.cs index b43dcc9d..92c9bc8f 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/FrameworkTypeReference.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/FrameworkTypeReference.cs @@ -3,7 +3,7 @@ using System; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class FrameworkTypeReference: ClientTypeReference { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ISchemaTypeProvider.cs b/src/AutoRest.CSharp.V3/ClientModels/ISchemaTypeProvider.cs similarity index 88% rename from src/AutoRest.CSharp.V3/ClientModel/ISchemaTypeProvider.cs rename to src/AutoRest.CSharp.V3/ClientModels/ISchemaTypeProvider.cs index e9d06281..1e43f4c2 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ISchemaTypeProvider.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ISchemaTypeProvider.cs @@ -3,7 +3,7 @@ using AutoRest.CSharp.V3.Pipeline.Generated; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal interface ISchemaTypeProvider { diff --git a/src/AutoRest.CSharp.V3/ClientModel/PathSegment.cs b/src/AutoRest.CSharp.V3/ClientModels/PathSegment.cs similarity index 91% rename from src/AutoRest.CSharp.V3/ClientModel/PathSegment.cs rename to src/AutoRest.CSharp.V3/ClientModels/PathSegment.cs index e580edee..87b30bf7 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/PathSegment.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/PathSegment.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class PathSegment { diff --git a/src/AutoRest.CSharp.V3/ClientModel/QueryParameter.cs b/src/AutoRest.CSharp.V3/ClientModels/QueryParameter.cs similarity index 92% rename from src/AutoRest.CSharp.V3/ClientModel/QueryParameter.cs rename to src/AutoRest.CSharp.V3/ClientModels/QueryParameter.cs index 0bc7b1ad..156a0021 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/QueryParameter.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/QueryParameter.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class QueryParameter { diff --git a/src/AutoRest.CSharp.V3/ClientModel/SchemaTypeReference.cs b/src/AutoRest.CSharp.V3/ClientModels/SchemaTypeReference.cs similarity index 92% rename from src/AutoRest.CSharp.V3/ClientModel/SchemaTypeReference.cs rename to src/AutoRest.CSharp.V3/ClientModels/SchemaTypeReference.cs index d00282b9..1c05e941 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/SchemaTypeReference.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/SchemaTypeReference.cs @@ -3,7 +3,7 @@ using AutoRest.CSharp.V3.Pipeline.Generated; -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class SchemaTypeReference: ClientTypeReference { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ServiceClient.cs b/src/AutoRest.CSharp.V3/ClientModels/ServiceClient.cs similarity index 91% rename from src/AutoRest.CSharp.V3/ClientModel/ServiceClient.cs rename to src/AutoRest.CSharp.V3/ClientModels/ServiceClient.cs index 78967dc9..4f173770 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ServiceClient.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ServiceClient.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ServiceClient { diff --git a/src/AutoRest.CSharp.V3/ClientModel/ServiceClientMethodParameter.cs b/src/AutoRest.CSharp.V3/ClientModels/ServiceClientMethodParameter.cs similarity index 93% rename from src/AutoRest.CSharp.V3/ClientModel/ServiceClientMethodParameter.cs rename to src/AutoRest.CSharp.V3/ClientModels/ServiceClientMethodParameter.cs index 68ccdc1f..01dd2edf 100644 --- a/src/AutoRest.CSharp.V3/ClientModel/ServiceClientMethodParameter.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/ServiceClientMethodParameter.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace AutoRest.CSharp.V3.ClientModel +namespace AutoRest.CSharp.V3.ClientModels { internal class ServiceClientMethodParameter { diff --git a/src/AutoRest.CSharp.V3/CodeGen/ClientWriter.cs b/src/AutoRest.CSharp.V3/CodeGen/ClientWriter.cs index a69bef50..8617ba92 100644 --- a/src/AutoRest.CSharp.V3/CodeGen/ClientWriter.cs +++ b/src/AutoRest.CSharp.V3/CodeGen/ClientWriter.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using AutoRest.CSharp.V3.ClientModel; +using AutoRest.CSharp.V3.ClientModels; using AutoRest.CSharp.V3.Pipeline; using AutoRest.CSharp.V3.Utilities; using Azure; diff --git a/src/AutoRest.CSharp.V3/CodeGen/ModelWriter.cs b/src/AutoRest.CSharp.V3/CodeGen/ModelWriter.cs index b54deabc..b39c8c4f 100644 --- a/src/AutoRest.CSharp.V3/CodeGen/ModelWriter.cs +++ b/src/AutoRest.CSharp.V3/CodeGen/ModelWriter.cs @@ -4,7 +4,7 @@ using System; using System.ComponentModel; using System.Linq; -using AutoRest.CSharp.V3.ClientModel; +using AutoRest.CSharp.V3.ClientModels; using AutoRest.CSharp.V3.Pipeline; using AutoRest.CSharp.V3.Plugins; using AutoRest.CSharp.V3.Utilities; @@ -20,7 +20,7 @@ namespace AutoRest.CSharp.V3.CodeGen _typeFactory = typeFactory; } - public void WriteModel(ClientModel.ClientModel model) + public void WriteModel(ClientModel model) { switch (model) { diff --git a/src/AutoRest.CSharp.V3/CodeGen/SerializationWriter.cs b/src/AutoRest.CSharp.V3/CodeGen/SerializationWriter.cs index 5a816b59..9373e63a 100644 --- a/src/AutoRest.CSharp.V3/CodeGen/SerializationWriter.cs +++ b/src/AutoRest.CSharp.V3/CodeGen/SerializationWriter.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using System.Text.Json; -using AutoRest.CSharp.V3.ClientModel; +using AutoRest.CSharp.V3.ClientModels; using AutoRest.CSharp.V3.Pipeline; using AutoRest.CSharp.V3.Plugins; @@ -19,7 +19,7 @@ namespace AutoRest.CSharp.V3.CodeGen _typeFactory = typeFactory; } - public void WriteSerialization(ClientModel.ClientModel schema) + public void WriteSerialization(ClientModel schema) { switch (schema) { diff --git a/src/AutoRest.CSharp.V3/CodeGen/TypeFactory.cs b/src/AutoRest.CSharp.V3/CodeGen/TypeFactory.cs index 4b79e586..ee8c9de8 100644 --- a/src/AutoRest.CSharp.V3/CodeGen/TypeFactory.cs +++ b/src/AutoRest.CSharp.V3/CodeGen/TypeFactory.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using AutoRest.CSharp.V3.ClientModel; +using AutoRest.CSharp.V3.ClientModels; using AutoRest.CSharp.V3.Utilities; namespace AutoRest.CSharp.V3.CodeGen diff --git a/src/AutoRest.CSharp.V3/Pipeline/Extensions.cs b/src/AutoRest.CSharp.V3/Pipeline/Extensions.cs index ebebdce0..238cf2a7 100644 --- a/src/AutoRest.CSharp.V3/Pipeline/Extensions.cs +++ b/src/AutoRest.CSharp.V3/Pipeline/Extensions.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using AutoRest.CSharp.V3.ClientModel; +using AutoRest.CSharp.V3.ClientModels; using AutoRest.CSharp.V3.CodeGen; using AutoRest.CSharp.V3.Pipeline.Generated; using Azure.Core; diff --git a/src/AutoRest.CSharp.V3/Plugins/ModelExtensions.cs b/src/AutoRest.CSharp.V3/Plugins/ModelExtensions.cs index 3372213d..bac9ce66 100644 --- a/src/AutoRest.CSharp.V3/Plugins/ModelExtensions.cs +++ b/src/AutoRest.CSharp.V3/Plugins/ModelExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -using AutoRest.CSharp.V3.ClientModel; +using AutoRest.CSharp.V3.ClientModels; using AutoRest.CSharp.V3.Pipeline.Generated; using AutoRest.CSharp.V3.Utilities; diff --git a/src/AutoRest.CSharp.V3/Plugins/Modeler.cs b/src/AutoRest.CSharp.V3/Plugins/Modeler.cs index 6b8882f4..1690d536 100644 --- a/src/AutoRest.CSharp.V3/Plugins/Modeler.cs +++ b/src/AutoRest.CSharp.V3/Plugins/Modeler.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using AutoRest.CSharp.V3.ClientModel; +using AutoRest.CSharp.V3.ClientModels; using AutoRest.CSharp.V3.CodeGen; using AutoRest.CSharp.V3.JsonRpc.MessageModels; using AutoRest.CSharp.V3.Pipeline; @@ -176,23 +176,23 @@ namespace AutoRest.CSharp.V3.Plugins private static ClientConstant StringConstant(string s) => new ClientConstant(s, new FrameworkTypeReference(typeof(string))); - private static ClientModel.ClientModel BuildClientEnum(SealedChoiceSchema sealedChoiceSchema) => new ClientEnum( + private static ClientModel BuildClientEnum(SealedChoiceSchema sealedChoiceSchema) => new ClientEnum( sealedChoiceSchema, sealedChoiceSchema.CSharpName(), sealedChoiceSchema.Choices.Select(c => new ClientEnumValue(c.CSharpName(), StringConstant(c.Value)))); - private static ClientModel.ClientModel BuildClientEnum(ChoiceSchema choiceSchema) => new ClientEnum( + private static ClientModel BuildClientEnum(ChoiceSchema choiceSchema) => new ClientEnum( choiceSchema, choiceSchema.CSharpName(), choiceSchema.Choices.Select(c => new ClientEnumValue(c.CSharpName(), StringConstant(c.Value))), true); - private static ClientModel.ClientModel BuildClientObject(ObjectSchema objectSchema) => new ClientObject( + private static ClientModel BuildClientObject(ObjectSchema objectSchema) => new ClientObject( objectSchema, objectSchema.CSharpName(), objectSchema.Properties.Where(property => !(property.Schema is ConstantSchema)).Select(CreateProperty), objectSchema.Properties.Where(property => property.Schema is ConstantSchema).Select(CreateConstant)); - private static ClientModel.ClientModel BuildModel(Schema schema) => schema switch + private static ClientModel BuildModel(Schema schema) => schema switch { SealedChoiceSchema sealedChoiceSchema => BuildClientEnum(sealedChoiceSchema), ChoiceSchema choiceSchema => BuildClientEnum(choiceSchema), From dcf96bb2767cd3b4b156a453b7e3231b6d27e868 Mon Sep 17 00:00:00 2001 From: Michael Yanni Date: Wed, 4 Dec 2019 18:26:06 -0800 Subject: [PATCH 2/3] Workaround for allowing a collection of constants to be a parameter to a method. --- .../ClientModels/CollectionTypeReference.cs | 1 + .../CodeGen/CsProjWriter.cs | 3 +-- src/AutoRest.CSharp.V3/Plugins/Modeler.cs | 22 +++++++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/AutoRest.CSharp.V3/ClientModels/CollectionTypeReference.cs b/src/AutoRest.CSharp.V3/ClientModels/CollectionTypeReference.cs index 1d94888c..6c9f2fe7 100644 --- a/src/AutoRest.CSharp.V3/ClientModels/CollectionTypeReference.cs +++ b/src/AutoRest.CSharp.V3/ClientModels/CollectionTypeReference.cs @@ -12,6 +12,7 @@ namespace AutoRest.CSharp.V3.ClientModels ItemType = itemType; } + //TODO: This should not be defaulted to nullable false public override bool IsNullable => false; } } diff --git a/src/AutoRest.CSharp.V3/CodeGen/CsProjWriter.cs b/src/AutoRest.CSharp.V3/CodeGen/CsProjWriter.cs index 7ea582bf..1773f93a 100644 --- a/src/AutoRest.CSharp.V3/CodeGen/CsProjWriter.cs +++ b/src/AutoRest.CSharp.V3/CodeGen/CsProjWriter.cs @@ -17,8 +17,7 @@ namespace AutoRest.CSharp.V3.CodeGen false bin $(OutputPath) - - 1998 + SA1649 true enable diff --git a/src/AutoRest.CSharp.V3/Plugins/Modeler.cs b/src/AutoRest.CSharp.V3/Plugins/Modeler.cs index 1690d536..d1708d1b 100644 --- a/src/AutoRest.CSharp.V3/Plugins/Modeler.cs +++ b/src/AutoRest.CSharp.V3/Plugins/Modeler.cs @@ -56,6 +56,9 @@ namespace AutoRest.CSharp.V3.Plugins private static ServiceClient BuildClient(OperationGroup arg) => new ServiceClient(arg.CSharpName(), arg.Operations.Select(BuildMethod).Where(method => method != null).ToArray()!); + private static ClientConstant? CreateDefaultValueConstant(Parameter requestParameter) => + requestParameter.ClientDefaultValue != null ? new ClientConstant(requestParameter.ClientDefaultValue, new FrameworkTypeReference(typeof(object))) : (ClientConstant?)null; + private static ClientMethod? BuildMethod(Operation operation) { var httpRequest = operation.Request.Protocol.Http as HttpRequest; @@ -81,17 +84,27 @@ namespace AutoRest.CSharp.V3.Plugins switch (requestParameter.Schema) { case ConstantSchema constant: - constantOrParameter = new ClientConstant(constant.Value.Value, (FrameworkTypeReference) CreateType(constant.ValueType, false)); + constantOrParameter = new ClientConstant(constant.Value.Value, (FrameworkTypeReference)CreateType(constant.ValueType, false)); break; case BinarySchema _: // skip continue; + //TODO: Workaround for https://github.com/Azure/autorest.csharp/pull/275 + case ArraySchema arraySchema when arraySchema.ElementType is ConstantSchema constantInnerType: + constantOrParameter = new ServiceClientMethodParameter(requestParameter.CSharpName(), + new CollectionTypeReference(CreateType(constantInnerType.ValueType, false)), + CreateDefaultValueConstant(requestParameter)); + break; + //TODO: Workaround for https://github.com/Azure/autorest.csharp/pull/275 + case DictionarySchema dictionarySchema when dictionarySchema.ElementType is ConstantSchema constantInnerType: + constantOrParameter = new ServiceClientMethodParameter(requestParameter.CSharpName(), + new CollectionTypeReference(CreateType(constantInnerType.ValueType, false)), + CreateDefaultValueConstant(requestParameter)); + break; default: constantOrParameter = new ServiceClientMethodParameter(requestParameter.CSharpName(), CreateType(requestParameter.Schema, requestParameter.IsNullable()), - requestParameter.ClientDefaultValue != null ? - new ClientConstant(requestParameter.ClientDefaultValue, new FrameworkTypeReference(typeof(object))) : - (ClientConstant?)null); + CreateDefaultValueConstant(requestParameter)); break; } @@ -210,6 +223,7 @@ namespace AutoRest.CSharp.V3.Plugins private static ClientObjectProperty CreateProperty(Property property) => new ClientObjectProperty(property.CSharpName(), CreateType(property.Schema, property.IsNullable()), property.Schema.IsLazy(), property.SerializedName); + //TODO: Handle nullability properly private static ClientTypeReference CreateType(Schema schema, bool isNullable) => schema switch { BinarySchema _ => (ClientTypeReference)new BinaryTypeReference(false), From 4653072d6c43ff4fbcac28a696cf150d25817776 Mon Sep 17 00:00:00 2001 From: Michael Yanni Date: Thu, 5 Dec 2019 12:46:02 -0800 Subject: [PATCH 3/3] Added running samples as part of Generate.ps1. Currently, only runs AppConfiguration. --- eng/Generate.ps1 | 63 ++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/eng/Generate.ps1 b/eng/Generate.ps1 index 4ea1498e..d6b0fb8e 100644 --- a/eng/Generate.ps1 +++ b/eng/Generate.ps1 @@ -1,4 +1,4 @@ -param($name, [switch]$NoDebug) +param($name, [switch]$noDebug) $ErrorActionPreference = 'Stop' function Invoke-Block([scriptblock]$cmd) { @@ -17,28 +17,45 @@ function Invoke-Block([scriptblock]$cmd) { } } -$repoRoot = Resolve-Path "$PSScriptRoot\.." -$testServerTestProject = "$repoRoot\test\AutoRest.TestServer.Tests" -$testConfiguration = "$testServerTestProject\readme.md" -$testServerSwaggerPath = "$repoRoot\node_modules\@microsoft.azure\autorest.testserver\swagger" -$paths = 'url', 'body-string', 'body-complex', 'custom-baseUrl', 'custom-baseUrl-more-options' -if ($name) -{ - $paths = $name -} -$debugFlags = if (!$NoDebug) { '--debug','--verbose' } +function Invoke-AutoRest($debugFlags, $testConfiguration, $outputFolder, $inputFile, $name, $namespace, $repoRoot) { + Invoke-Block { + $outputFlag = if($outputFolder) { "--output-folder=$outputFolder" } else { '' } + $inputFlag = if($inputFile) { "--input-file=$inputFile" } else { '' } + $titleFlag = if($name) { "--title=$name" } else { '' } + $namespaceFlag = if($namespace) { "--namespace=$namespace" } else { '' } + $command = "npx autorest-beta $debugFlags $testConfiguration $outputFlag $inputFlag $titleFlag $namespaceFlag" + $commandText = $command.Replace($repoRoot, "`$(SolutionDir)") -foreach ($path in $paths) -{ - $outputFolder = "$testServerTestProject\$path"; - $inputFile = "$testServerSwaggerPath\$path.json" - $namespace = $path.Replace('-', '_') - Invoke-Block { - $command = "npx autorest-beta $debugFlags $testConfiguration --output-folder=$outputFolder --input-file=$inputFile --title=$path --namespace=$namespace" - $command = $command.Replace($repoRoot, "`$(SolutionDir)") - - Write-Host ">" $command - - npx autorest-beta @debugFlags $testConfiguration --output-folder=$outputFolder --input-file=$inputFile --title=$path --namespace=$namespace + Write-Host ">" $commandText + Invoke-Expression $command } +} + +# General configuration +$repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..') +$debugFlags = if (-not $noDebug) { '--debug', '--verbose' } + +# Test server test configuration +$testServerTestProject = Join-Path $repoRoot 'test' 'AutoRest.TestServer.Tests' +$testConfiguration = Join-Path $testServerTestProject 'readme.md' +$testServerSwaggerPath = Join-Path $repoRoot 'node_modules' '@microsoft.azure' 'autorest.testserver' 'swagger' +$testNames = if ($name) { $name } else { 'url', 'body-string', 'body-complex', 'custom-baseUrl', 'custom-baseUrl-more-options' } + +foreach ($testName in $testNames) +{ + $outputFolder = Join-Path $testServerTestProject $testName + $inputFile = Join-Path $testServerSwaggerPath "$testName.json" + $namespace = $testName.Replace('-', '_') + Invoke-AutoRest $debugFlags $testConfiguration $outputFolder $inputFile $testName $namespace $repoRoot +} + +# Sample configuration +$sampleDirectory = Join-Path $repoRoot 'samples' +$projectNames = 'AppConfiguration' + +foreach ($projectName in $projectNames) +{ + $projectDirectory = Join-Path $sampleDirectory $projectName + $configurationPath = Join-Path $projectDirectory 'readme.md' + Invoke-AutoRest $debugFlags $configurationPath -repoRoot $repoRoot } \ No newline at end of file