Skip to content

Commit ce8c19f

Browse files
authored
Add missing buildable types for SystemObjectType (#5370)
1 parent cd984be commit ce8c19f

File tree

15 files changed

+47
-1
lines changed

15 files changed

+47
-1
lines changed

samples/AzureSample.ResourceManager.Sample/src/Generated/Models/AzureSampleResourceManagerSampleContext.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using System.ClientModel.Primitives;
99
using Azure.ResourceManager.Models;
10+
using Azure.ResourceManager.Resources.Models;
1011
using AzureSample.ResourceManager.Sample.Models;
1112

1213
namespace AzureSample.ResourceManager.Sample
@@ -47,6 +48,7 @@ namespace AzureSample.ResourceManager.Sample
4748
[ModelReaderWriterBuildable(typeof(DiffDiskSettings))]
4849
[ModelReaderWriterBuildable(typeof(DiskEncryptionSettings))]
4950
[ModelReaderWriterBuildable(typeof(DiskInstanceView))]
51+
[ModelReaderWriterBuildable(typeof(ExtendedLocation))]
5052
[ModelReaderWriterBuildable(typeof(ImageData))]
5153
[ModelReaderWriterBuildable(typeof(ImageDataDisk))]
5254
[ModelReaderWriterBuildable(typeof(ImageDisk))]
@@ -67,6 +69,7 @@ namespace AzureSample.ResourceManager.Sample
6769
[ModelReaderWriterBuildable(typeof(LogAnalyticsInputBase))]
6870
[ModelReaderWriterBuildable(typeof(MaintenanceRedeployStatus))]
6971
[ModelReaderWriterBuildable(typeof(ManagedDiskParameters))]
72+
[ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))]
7073
[ModelReaderWriterBuildable(typeof(NetworkInterfaceReference))]
7174
[ModelReaderWriterBuildable(typeof(OrchestrationServiceStateContent))]
7275
[ModelReaderWriterBuildable(typeof(OrchestrationServiceSummary))]
@@ -91,7 +94,8 @@ namespace AzureSample.ResourceManager.Sample
9194
[ModelReaderWriterBuildable(typeof(SshPublicKeyResource))]
9295
[ModelReaderWriterBuildable(typeof(SshPublicKeysGroupListResult))]
9396
[ModelReaderWriterBuildable(typeof(StorageProfile))]
94-
[ModelReaderWriterBuildable(typeof(SubResource))]
97+
[ModelReaderWriterBuildable(typeof(Models.SubResource))]
98+
[ModelReaderWriterBuildable(typeof(Azure.ResourceManager.Resources.Models.SubResource))]
9599
[ModelReaderWriterBuildable(typeof(SubResourceReadOnly))]
96100
[ModelReaderWriterBuildable(typeof(SubResourceWithColocationStatus))]
97101
[ModelReaderWriterBuildable(typeof(SubscriptionResourceGetVirtualMachineImagesOptions))]
@@ -103,6 +107,7 @@ namespace AzureSample.ResourceManager.Sample
103107
[ModelReaderWriterBuildable(typeof(UpgradeOperationHistoricalStatusInfoProperties))]
104108
[ModelReaderWriterBuildable(typeof(UpgradeOperationHistoryStatus))]
105109
[ModelReaderWriterBuildable(typeof(UpgradePolicy))]
110+
[ModelReaderWriterBuildable(typeof(UserAssignedIdentity))]
106111
[ModelReaderWriterBuildable(typeof(VaultCertificate))]
107112
[ModelReaderWriterBuildable(typeof(VaultSecretGroup))]
108113
[ModelReaderWriterBuildable(typeof(VirtualMachineAgentInstanceView))]
@@ -179,6 +184,7 @@ namespace AzureSample.ResourceManager.Sample
179184
[ModelReaderWriterBuildable(typeof(VmScaleSetConvertToSinglePlacementGroupContent))]
180185
[ModelReaderWriterBuildable(typeof(WindowsConfiguration))]
181186
[ModelReaderWriterBuildable(typeof(WinRMListener))]
187+
[ModelReaderWriterBuildable(typeof(WritableSubResource))]
182188
public partial class AzureSampleResourceManagerSampleContext : ModelReaderWriterContext
183189
{
184190
}

src/AutoRest.CSharp/Common/Generation/Writers/ModelReaderWriterContextWriter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ private bool ImplementsIPersistableModel(CSharpType type, Dictionary<CSharpType,
157157
return true;
158158
}
159159

160+
// If the type is SystemObjectType, it should always implement IPersistableModel or IJsonModel
161+
if (!type.IsFrameworkType && type.Implementation is SystemObjectType)
162+
{
163+
return true;
164+
}
165+
160166
if (!type.IsFrameworkType || type.IsEnum || type.IsLiteral)
161167
return false;
162168

test/CadlRanchProjects/azure/core/basic/src/Generated/Models/_Specs_AzureCoreBasicContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using _Specs_.Azure.Core.Basic.Models;
1011

1112
namespace _Specs_.Azure.Core.Basic
@@ -14,6 +15,7 @@ namespace _Specs_.Azure.Core.Basic
1415
/// Context class which will be filled in by the System.ClientModel.SourceGeneration.
1516
/// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md'
1617
/// </summary>
18+
[ModelReaderWriterBuildable(typeof(ResponseError))]
1719
[ModelReaderWriterBuildable(typeof(User))]
1820
[ModelReaderWriterBuildable(typeof(UserList))]
1921
[ModelReaderWriterBuildable(typeof(UserOrder))]

test/CadlRanchProjects/azure/core/lro/rpc/src/Generated/Models/_AzureLroRpcContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using _Azure.Lro.Rpc.Models;
1011

1112
namespace _Azure.Lro.Rpc
@@ -16,6 +17,7 @@ namespace _Azure.Lro.Rpc
1617
/// </summary>
1718
[ModelReaderWriterBuildable(typeof(GenerationOptions))]
1819
[ModelReaderWriterBuildable(typeof(GenerationResult))]
20+
[ModelReaderWriterBuildable(typeof(ResponseError))]
1921
public partial class _AzureLroRpcContext : ModelReaderWriterContext
2022
{
2123
}

test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/_AzureLroStandardContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using _Azure.Lro.Standard.Models;
1011

1112
namespace _Azure.Lro.Standard
@@ -15,6 +16,7 @@ namespace _Azure.Lro.Standard
1516
/// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md'
1617
/// </summary>
1718
[ModelReaderWriterBuildable(typeof(ExportedUser))]
19+
[ModelReaderWriterBuildable(typeof(ResponseError))]
1820
[ModelReaderWriterBuildable(typeof(User))]
1921
public partial class _AzureLroStandardContext : ModelReaderWriterContext
2022
{

test/CadlRanchProjects/azure/core/page/src/Generated/Models/_Specs_AzureCorePageContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using _Specs_.Azure.Core.Page.Models;
1011

1112
namespace _Specs_.Azure.Core.Page
@@ -16,6 +17,7 @@ namespace _Specs_.Azure.Core.Page
1617
/// </summary>
1718
[ModelReaderWriterBuildable(typeof(FirstItem))]
1819
[ModelReaderWriterBuildable(typeof(ListItemInputBody))]
20+
[ModelReaderWriterBuildable(typeof(ResponseError))]
1921
[ModelReaderWriterBuildable(typeof(SecondItem))]
2022
[ModelReaderWriterBuildable(typeof(User))]
2123
[ModelReaderWriterBuildable(typeof(UserOrder))]

test/CadlRanchProjects/azure/core/traits/src/Generated/Models/_Specs_AzureCoreTraitsContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using _Specs_.Azure.Core.Traits.Models;
1011

1112
namespace _Specs_.Azure.Core.Traits
@@ -14,6 +15,7 @@ namespace _Specs_.Azure.Core.Traits
1415
/// Context class which will be filled in by the System.ClientModel.SourceGeneration.
1516
/// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md'
1617
/// </summary>
18+
[ModelReaderWriterBuildable(typeof(ResponseError))]
1719
[ModelReaderWriterBuildable(typeof(User))]
1820
[ModelReaderWriterBuildable(typeof(UserActionParam))]
1921
[ModelReaderWriterBuildable(typeof(UserActionResponse))]

test/CadlRanchProjects/azure/resource-manager/common-properties/src/Generated/Models/_AzureResourceManagerCommonPropertiesContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using Azure.ResourceManager.Models;
1011
using _Azure.ResourceManager.CommonProperties.Models;
1112

@@ -20,7 +21,10 @@ namespace _Azure.ResourceManager.CommonProperties
2021
[ModelReaderWriterBuildable(typeof(ConfidentialResourceProperties))]
2122
[ModelReaderWriterBuildable(typeof(ManagedIdentityTrackedResource))]
2223
[ModelReaderWriterBuildable(typeof(ManagedIdentityTrackedResourceData))]
24+
[ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))]
25+
[ModelReaderWriterBuildable(typeof(ResponseError))]
2326
[ModelReaderWriterBuildable(typeof(SystemData))]
27+
[ModelReaderWriterBuildable(typeof(UserAssignedIdentity))]
2428
public partial class _AzureResourceManagerCommonPropertiesContext : ModelReaderWriterContext
2529
{
2630
}

test/CadlRanchProjects/azure/resource-manager/non-resource/src/Generated/Models/_AzureResourceManagerNonResourcesContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using _Azure.ResourceManager.NonResources.Models;
1011

1112
namespace _Azure.ResourceManager.NonResources
@@ -15,6 +16,7 @@ namespace _Azure.ResourceManager.NonResources
1516
/// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md'
1617
/// </summary>
1718
[ModelReaderWriterBuildable(typeof(NonResource))]
19+
[ModelReaderWriterBuildable(typeof(ResponseError))]
1820
public partial class _AzureResourceManagerNonResourcesContext : ModelReaderWriterContext
1921
{
2022
}

test/CadlRanchProjects/azure/resource-manager/resources/src/Generated/Models/_AzureResourceManagerResourcesContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#nullable disable
77

88
using System.ClientModel.Primitives;
9+
using Azure;
910
using Azure.ResourceManager.Models;
1011
using _Azure.ResourceManager.Resources.Models;
1112

@@ -25,6 +26,7 @@ namespace _Azure.ResourceManager.Resources
2526
[ModelReaderWriterBuildable(typeof(NestedProxyResourceData))]
2627
[ModelReaderWriterBuildable(typeof(NestedProxyResourceProperties))]
2728
[ModelReaderWriterBuildable(typeof(NotificationDetails))]
29+
[ModelReaderWriterBuildable(typeof(ResponseError))]
2830
[ModelReaderWriterBuildable(typeof(SingletonTrackedResource))]
2931
[ModelReaderWriterBuildable(typeof(SingletonTrackedResourceData))]
3032
[ModelReaderWriterBuildable(typeof(SingletonTrackedResourceProperties))]

0 commit comments

Comments
 (0)