From 6eb2ca1f3eb49451d7e3914d54e24541f6f1f463 Mon Sep 17 00:00:00 2001 From: Wenming Liu Date: Fri, 11 Oct 2024 15:14:13 +0800 Subject: [PATCH] Enable write core feature for peering (#46493) * Enable-WriteCore-feature-for-peering * Update assets.json --- .../CHANGELOG.md | 1 + ....ResourceManager.Peering.netstandard2.0.cs | 32 ++++++++++ .../Azure.ResourceManager.Peering/assets.json | 2 +- ...ConnectionMonitorTestData.Serialization.cs | 47 ++++----------- .../Models/CdnPeeringPrefix.Serialization.cs | 47 ++++----------- ...dnPeeringPrefixListResult.Serialization.cs | 11 +++- ...oviderAvailabilityContent.Serialization.cs | 11 +++- ...tionMonitorTestListResult.Serialization.cs | 11 +++- .../DirectPeeringFacility.Serialization.cs | 11 +++- ...PeeringLocationProperties.Serialization.cs | 11 +++- .../DirectPeeringProperties.Serialization.cs | 11 +++- .../ExchangePeeringFacility.Serialization.cs | 11 +++- ...ExchangePeeringProperties.Serialization.cs | 11 +++- .../LookingGlassOutput.Serialization.cs | 11 +++- .../PeerAsnContactDetail.Serialization.cs | 11 +++- .../Models/PeerAsnListResult.Serialization.cs | 11 +++- .../PeeringBandwidthOffer.Serialization.cs | 11 +++- .../Models/PeeringBgpSession.Serialization.cs | 11 +++- .../PeeringDirectConnection.Serialization.cs | 11 +++- ...PeeringExchangeConnection.Serialization.cs | 11 +++- .../Models/PeeringListResult.Serialization.cs | 11 +++- .../Models/PeeringLocation.Serialization.cs | 47 ++++----------- ...PeeringLocationListResult.Serialization.cs | 11 +++- ...ocationPropertiesExchange.Serialization.cs | 11 +++- ...lyticsWorkspaceProperties.Serialization.cs | 11 +++- .../Models/PeeringPatch.Serialization.cs | 38 ++++-------- .../PeeringReceivedRoute.Serialization.cs | 11 +++- ...ngReceivedRouteListResult.Serialization.cs | 11 +++- ...ngRegisteredAsnListResult.Serialization.cs | 11 +++- ...egisteredPrefixListResult.Serialization.cs | 11 +++- .../PeeringResourceTagsPatch.Serialization.cs | 11 +++- .../PeeringServiceCountry.Serialization.cs | 47 ++++----------- ...gServiceCountryListResult.Serialization.cs | 11 +++- .../PeeringServiceListResult.Serialization.cs | 11 +++- .../PeeringServiceLocation.Serialization.cs | 47 ++++----------- ...ServiceLocationListResult.Serialization.cs | 11 +++- .../PeeringServicePatch.Serialization.cs | 38 ++++-------- ...PeeringServicePrefixEvent.Serialization.cs | 11 +++- ...ngServicePrefixListResult.Serialization.cs | 11 +++- .../PeeringServiceProvider.Serialization.cs | 47 ++++----------- ...ServiceProviderListResult.Serialization.cs | 11 +++- .../Models/PeeringServiceSku.Serialization.cs | 11 +++- .../Models/PeeringSku.Serialization.cs | 11 +++- ...gPreferenceUnbilledPrefix.Serialization.cs | 11 +++- ...pUnbilledPrefixListResult.Serialization.cs | 11 +++- .../Generated/PeerAsnData.Serialization.cs | 47 ++++----------- .../Generated/PeeringData.Serialization.cs | 60 ++++--------------- .../PeeringRegisteredAsnData.Serialization.cs | 47 ++++----------- ...eringRegisteredPrefixData.Serialization.cs | 47 ++++----------- .../PeeringServiceData.Serialization.cs | 60 ++++--------------- .../PeeringServicePrefixData.Serialization.cs | 47 ++++----------- .../src/autorest.md | 1 + 52 files changed, 481 insertions(+), 595 deletions(-) diff --git a/sdk/peering/Azure.ResourceManager.Peering/CHANGELOG.md b/sdk/peering/Azure.ResourceManager.Peering/CHANGELOG.md index 51b39cea70b8a..bc6fc4c8bdb0c 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/CHANGELOG.md +++ b/sdk/peering/Azure.ResourceManager.Peering/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features Added - Enable the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. +- Exposed `JsonModelWriteCore` for model serialization procedure. ### Breaking Changes diff --git a/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs b/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs index de7d432b95db9..45139c96b2538 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs @@ -27,6 +27,7 @@ public ConnectionMonitorTestData() { } public Azure.ResourceManager.Peering.Models.PeeringProvisioningState? ProvisioningState { get { throw null; } } public string SourceAgent { get { throw null; } set { } } public int? TestFrequencyInSec { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.ConnectionMonitorTestData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.ConnectionMonitorTestData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -77,6 +78,7 @@ public PeerAsnData() { } public System.Collections.Generic.IList PeerContactDetail { get { throw null; } } public string PeerName { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeerAsnValidationState? ValidationState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeerAsnData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeerAsnData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -128,6 +130,7 @@ public PeeringData(Azure.Core.AzureLocation location, Azure.ResourceManager.Peer public string PeeringLocation { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -198,6 +201,7 @@ public PeeringRegisteredAsnData() { } public int? Asn { get { throw null; } set { } } public string PeeringServicePrefixKey { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringProvisioningState? ProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringRegisteredAsnData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringRegisteredAsnData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -248,6 +252,7 @@ public PeeringRegisteredPrefixData() { } public string Prefix { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringPrefixValidationState? PrefixValidationState { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringProvisioningState? ProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringRegisteredPrefixData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringRegisteredPrefixData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -337,6 +342,7 @@ public PeeringServiceData(Azure.Core.AzureLocation location) { } public string ProviderPrimaryPeeringLocation { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringProvisioningState? ProvisioningState { get { throw null; } } public string SkuName { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringServiceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringServiceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -370,6 +376,7 @@ public PeeringServicePrefixData() { } public string Prefix { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringPrefixValidationState? PrefixValidationState { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringProvisioningState? ProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringServicePrefixData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.PeeringServicePrefixData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -515,6 +522,7 @@ public CdnPeeringPrefix() { } public string BgpCommunity { get { throw null; } } public bool? IsPrimaryRegion { get { throw null; } } public string Prefix { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.CdnPeeringPrefix System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.CdnPeeringPrefix System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -526,6 +534,7 @@ public partial class CheckPeeringServiceProviderAvailabilityContent : System.Cli public CheckPeeringServiceProviderAvailabilityContent() { } public string PeeringServiceLocation { get { throw null; } set { } } public string PeeringServiceProvider { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.CheckPeeringServiceProviderAvailabilityContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.CheckPeeringServiceProviderAvailabilityContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -539,6 +548,7 @@ public DirectPeeringFacility() { } public Azure.ResourceManager.Peering.Models.DirectPeeringType? DirectPeeringType { get { throw null; } set { } } public int? PeeringDBFacilityId { get { throw null; } set { } } public string PeeringDBFacilityLink { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.DirectPeeringFacility System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.DirectPeeringFacility System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -550,6 +560,7 @@ public partial class DirectPeeringLocationProperties : System.ClientModel.Primit public DirectPeeringLocationProperties() { } public System.Collections.Generic.IList BandwidthOffers { get { throw null; } } public System.Collections.Generic.IList PeeringFacilities { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.DirectPeeringLocationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.DirectPeeringLocationProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -563,6 +574,7 @@ public DirectPeeringProperties() { } public Azure.ResourceManager.Peering.Models.DirectPeeringType? DirectPeeringType { get { throw null; } set { } } public Azure.Core.ResourceIdentifier PeerAsnId { get { throw null; } set { } } public bool? UseForPeeringService { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.DirectPeeringProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.DirectPeeringProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -604,6 +616,7 @@ public ExchangePeeringFacility() { } public System.Net.IPAddress MicrosoftIPv6Address { get { throw null; } set { } } public int? PeeringDBFacilityId { get { throw null; } set { } } public string PeeringDBFacilityLink { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.ExchangePeeringFacility System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.ExchangePeeringFacility System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -615,6 +628,7 @@ public partial class ExchangePeeringProperties : System.ClientModel.Primitives.I public ExchangePeeringProperties() { } public System.Collections.Generic.IList Connections { get { throw null; } } public Azure.Core.ResourceIdentifier PeerAsnId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.ExchangePeeringProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.ExchangePeeringProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -663,6 +677,7 @@ public partial class LookingGlassOutput : System.ClientModel.Primitives.IJsonMod internal LookingGlassOutput() { } public Azure.ResourceManager.Peering.Models.LookingGlassCommand? Command { get { throw null; } } public string Output { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.LookingGlassOutput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.LookingGlassOutput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -693,6 +708,7 @@ public PeerAsnContactDetail() { } public string Email { get { throw null; } set { } } public string Phone { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringRole? Role { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeerAsnContactDetail System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeerAsnContactDetail System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -724,6 +740,7 @@ public partial class PeeringBandwidthOffer : System.ClientModel.Primitives.IJson public PeeringBandwidthOffer() { } public string OfferName { get { throw null; } set { } } public int? ValueInMbps { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringBandwidthOffer System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringBandwidthOffer System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -744,6 +761,7 @@ public PeeringBgpSession() { } public string SessionPrefixV6 { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringSessionStateV4? SessionStateV4 { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringSessionStateV6? SessionStateV6 { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringBgpSession System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringBgpSession System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -789,6 +807,7 @@ public PeeringDirectConnection() { } public int? ProvisionedBandwidthInMbps { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringSessionAddressProvider? SessionAddressProvider { get { throw null; } set { } } public bool? UseForPeeringService { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringDirectConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringDirectConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -803,6 +822,7 @@ public PeeringExchangeConnection() { } public Azure.ResourceManager.Peering.Models.PeeringConnectionState? ConnectionState { get { throw null; } } public string ErrorMessage { get { throw null; } } public int? PeeringDBFacilityId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringExchangeConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringExchangeConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -873,6 +893,7 @@ public PeeringLocation() { } public System.Collections.Generic.IList ExchangePeeringFacilities { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringKind? Kind { get { throw null; } set { } } public string PeeringLocationValue { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringLocation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringLocation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -927,6 +948,7 @@ public PeeringLogAnalyticsWorkspaceProperties() { } public System.Collections.Generic.IReadOnlyList ConnectedAgents { get { throw null; } } public string Key { get { throw null; } } public string WorkspaceId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringLogAnalyticsWorkspaceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringLogAnalyticsWorkspaceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -936,6 +958,7 @@ public PeeringLogAnalyticsWorkspaceProperties() { } public partial class PeeringPatch : Azure.ResourceManager.Peering.Models.PeeringResourceTagsPatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PeeringPatch() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -995,6 +1018,7 @@ internal PeeringReceivedRoute() { } public string ReceivedTimestamp { get { throw null; } } public string RpkiValidationState { get { throw null; } } public string TrustAnchor { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringReceivedRoute System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringReceivedRoute System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1005,6 +1029,7 @@ public partial class PeeringResourceTagsPatch : System.ClientModel.Primitives.IJ { public PeeringResourceTagsPatch() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringResourceTagsPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringResourceTagsPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1036,6 +1061,7 @@ public PeeringResourceTagsPatch() { } public partial class PeeringServiceCountry : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PeeringServiceCountry() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServiceCountry System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServiceCountry System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1048,6 +1074,7 @@ public PeeringServiceLocation() { } public Azure.Core.AzureLocation? AzureRegion { get { throw null; } set { } } public string Country { get { throw null; } set { } } public string State { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServiceLocation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServiceLocation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1057,6 +1084,7 @@ public PeeringServiceLocation() { } public partial class PeeringServicePatch : Azure.ResourceManager.Peering.Models.PeeringResourceTagsPatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PeeringServicePatch() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServicePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServicePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1071,6 +1099,7 @@ internal PeeringServicePrefixEvent() { } public string EventSummary { get { throw null; } } public System.DateTimeOffset? EventTimestamp { get { throw null; } } public string EventType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServicePrefixEvent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServicePrefixEvent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1082,6 +1111,7 @@ public partial class PeeringServiceProvider : Azure.ResourceManager.Models.Resou public PeeringServiceProvider() { } public System.Collections.Generic.IList PeeringLocations { get { throw null; } } public string ServiceProviderName { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServiceProvider System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringServiceProvider System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1204,6 +1234,7 @@ public PeeringSku() { } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringSize? Size { get { throw null; } } public Azure.ResourceManager.Peering.Models.PeeringTier? Tier { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringSku System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.PeeringSku System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1234,6 +1265,7 @@ internal RoutingPreferenceUnbilledPrefix() { } public Azure.Core.AzureLocation? AzureRegion { get { throw null; } } public int? PeerAsn { get { throw null; } } public string Prefix { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.RoutingPreferenceUnbilledPrefix System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Peering.Models.RoutingPreferenceUnbilledPrefix System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/peering/Azure.ResourceManager.Peering/assets.json b/sdk/peering/Azure.ResourceManager.Peering/assets.json index a4ca1eed04ecf..f19a046072129 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/assets.json +++ b/sdk/peering/Azure.ResourceManager.Peering/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/peering/Azure.ResourceManager.Peering", - "Tag": "net/peering/Azure.ResourceManager.Peering_ef7e682118" + "Tag": "net/peering/Azure.ResourceManager.Peering_cbfbb9a497" } diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestData.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestData.Serialization.cs index d991b4421b67a..9fffb70b7517a 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestData.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestData.Serialization.cs @@ -20,6 +20,15 @@ public partial class ConnectionMonitorTestData : IUtf8JsonSerializable, IJsonMod void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,27 +36,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(ConnectionMonitorTestData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(SourceAgent)) @@ -91,22 +80,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } ConnectionMonitorTestData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefix.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefix.Serialization.cs index 5e6ab884e1c36..b3441301813e5 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefix.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefix.Serialization.cs @@ -19,6 +19,15 @@ public partial class CdnPeeringPrefix : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,27 +35,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter throw new FormatException($"The model {nameof(CdnPeeringPrefix)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Prefix)) @@ -75,22 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter writer.WriteStringValue(BgpCommunity); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } CdnPeeringPrefix IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefixListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefixListResult.Serialization.cs index b0fd91ee70a74..67f9c965a87f6 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefixListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CdnPeeringPrefixListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class CdnPeeringPrefixListResult : IUtf8JsonSerializable, IJson void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe throw new FormatException($"The model {nameof(CdnPeeringPrefixListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe #endif } } - writer.WriteEndObject(); } CdnPeeringPrefixListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CheckPeeringServiceProviderAvailabilityContent.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CheckPeeringServiceProviderAvailabilityContent.Serialization.cs index 6cf2297eee8a7..03ed7eef125f7 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CheckPeeringServiceProviderAvailabilityContent.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/CheckPeeringServiceProviderAvailabilityContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class CheckPeeringServiceProviderAvailabilityContent : IUtf8JsonS void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWr throw new FormatException($"The model {nameof(CheckPeeringServiceProviderAvailabilityContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(PeeringServiceLocation)) { writer.WritePropertyName("peeringServiceLocation"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWr #endif } } - writer.WriteEndObject(); } CheckPeeringServiceProviderAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ConnectionMonitorTestListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ConnectionMonitorTestListResult.Serialization.cs index a49e7c46b3d45..a5f5930d4de93 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ConnectionMonitorTestListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ConnectionMonitorTestListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class ConnectionMonitorTestListResult : IUtf8JsonSerializable, void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo throw new FormatException($"The model {nameof(ConnectionMonitorTestListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo #endif } } - writer.WriteEndObject(); } ConnectionMonitorTestListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringFacility.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringFacility.Serialization.cs index 37be38096eb0a..60534ebb938d6 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringFacility.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringFacility.Serialization.cs @@ -18,6 +18,15 @@ public partial class DirectPeeringFacility : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(DirectPeeringFacility)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Address)) { writer.WritePropertyName("address"u8); @@ -61,7 +69,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW #endif } } - writer.WriteEndObject(); } DirectPeeringFacility IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringLocationProperties.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringLocationProperties.Serialization.cs index bd4df80d9d669..1d952ba237fa3 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringLocationProperties.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringLocationProperties.Serialization.cs @@ -18,6 +18,15 @@ public partial class DirectPeeringLocationProperties : IUtf8JsonSerializable, IJ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo throw new FormatException($"The model {nameof(DirectPeeringLocationProperties)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(PeeringFacilities)) { writer.WritePropertyName("peeringFacilities"u8); @@ -61,7 +69,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo #endif } } - writer.WriteEndObject(); } DirectPeeringLocationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringProperties.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringProperties.Serialization.cs index 809512ce689da..e2274e513be4a 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringProperties.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/DirectPeeringProperties.Serialization.cs @@ -19,6 +19,15 @@ public partial class DirectPeeringProperties : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(DirectPeeringProperties)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Connections)) { writer.WritePropertyName("connections"u8); @@ -67,7 +75,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } DirectPeeringProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringFacility.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringFacility.Serialization.cs index 98c8d0eb31b71..b34c4cfdf69a9 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringFacility.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringFacility.Serialization.cs @@ -19,6 +19,15 @@ public partial class ExchangePeeringFacility : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(ExchangePeeringFacility)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(ExchangeName)) { writer.WritePropertyName("exchangeName"u8); @@ -82,7 +90,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } ExchangePeeringFacility IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringProperties.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringProperties.Serialization.cs index 351c5375f6e34..1895aee152fa4 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringProperties.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/ExchangePeeringProperties.Serialization.cs @@ -19,6 +19,15 @@ public partial class ExchangePeeringProperties : IUtf8JsonSerializable, IJsonMod void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(ExchangePeeringProperties)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Connections)) { writer.WritePropertyName("connections"u8); @@ -57,7 +65,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea #endif } } - writer.WriteEndObject(); } ExchangePeeringProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/LookingGlassOutput.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/LookingGlassOutput.Serialization.cs index a4121400ebc24..764881500c4c0 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/LookingGlassOutput.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/LookingGlassOutput.Serialization.cs @@ -18,6 +18,15 @@ public partial class LookingGlassOutput : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(LookingGlassOutput)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Command)) { writer.WritePropertyName("command"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit #endif } } - writer.WriteEndObject(); } LookingGlassOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnContactDetail.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnContactDetail.Serialization.cs index 82c545d35b586..14c45544080db 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnContactDetail.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnContactDetail.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeerAsnContactDetail : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(PeerAsnContactDetail)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Role)) { writer.WritePropertyName("role"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr #endif } } - writer.WriteEndObject(); } PeerAsnContactDetail IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnListResult.Serialization.cs index ce53dda676496..4f89335edb59d 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeerAsnListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeerAsnListResult : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite throw new FormatException($"The model {nameof(PeerAsnListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite #endif } } - writer.WriteEndObject(); } PeerAsnListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBandwidthOffer.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBandwidthOffer.Serialization.cs index 098d85b2f40ae..73b4b5f44dd57 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBandwidthOffer.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBandwidthOffer.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringBandwidthOffer : IUtf8JsonSerializable, IJsonModel

((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(PeeringBandwidthOffer)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(OfferName)) { writer.WritePropertyName("offerName"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW #endif } } - writer.WriteEndObject(); } PeeringBandwidthOffer IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBgpSession.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBgpSession.Serialization.cs index 329fa133ab2ed..901b3619a1e62 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBgpSession.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringBgpSession.Serialization.cs @@ -19,6 +19,15 @@ public partial class PeeringBgpSession : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite throw new FormatException($"The model {nameof(PeeringBgpSession)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(SessionPrefixV4)) { writer.WritePropertyName("sessionPrefixV4"u8); @@ -97,7 +105,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite #endif } } - writer.WriteEndObject(); } PeeringBgpSession IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringDirectConnection.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringDirectConnection.Serialization.cs index f2f733565d6e2..ac508b7661c2e 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringDirectConnection.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringDirectConnection.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringDirectConnection : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(PeeringDirectConnection)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(BandwidthInMbps)) { writer.WritePropertyName("bandwidthInMbps"u8); @@ -91,7 +99,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } PeeringDirectConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringExchangeConnection.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringExchangeConnection.Serialization.cs index dca05e3c47cf5..549af6e15199b 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringExchangeConnection.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringExchangeConnection.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringExchangeConnection : IUtf8JsonSerializable, IJsonMod void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(PeeringExchangeConnection)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(PeeringDBFacilityId)) { writer.WritePropertyName("peeringDBFacilityId"u8); @@ -66,7 +74,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea #endif } } - writer.WriteEndObject(); } PeeringExchangeConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringListResult.Serialization.cs index a63a3a5b127a3..329e3e5f3dfce 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringListResult : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite throw new FormatException($"The model {nameof(PeeringListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite #endif } } - writer.WriteEndObject(); } PeeringListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocation.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocation.Serialization.cs index 8073b0c507b52..3b60b4c2e1b08 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocation.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocation.Serialization.cs @@ -19,6 +19,15 @@ public partial class PeeringLocation : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,32 +35,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO throw new FormatException($"The model {nameof(PeeringLocation)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Kind)) { writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.Value.ToString()); } - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Direct)) @@ -80,22 +69,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO writer.WriteStringValue(AzureRegion.Value); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringLocation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationListResult.Serialization.cs index bfce35076cc6d..f2fe552aff523 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringLocationListResult : IUtf8JsonSerializable, IJsonM void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(PeeringLocationListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea #endif } } - writer.WriteEndObject(); } PeeringLocationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.Serialization.cs index b201347057a59..f6c690c7af3e1 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringLocationPropertiesExchange : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, throw new FormatException($"The model {nameof(PeeringLocationPropertiesExchange)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(PeeringFacilities)) { writer.WritePropertyName("peeringFacilities"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, #endif } } - writer.WriteEndObject(); } PeeringLocationPropertiesExchange IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLogAnalyticsWorkspaceProperties.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLogAnalyticsWorkspaceProperties.Serialization.cs index 975352acc24fa..6bfc0ad187b2a 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLogAnalyticsWorkspaceProperties.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringLogAnalyticsWorkspaceProperties.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringLogAnalyticsWorkspaceProperties : IUtf8JsonSerializa void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter wri throw new FormatException($"The model {nameof(PeeringLogAnalyticsWorkspaceProperties)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(WorkspaceId)) { writer.WritePropertyName("workspaceID"u8); @@ -61,7 +69,6 @@ void IJsonModel.Write(Utf8JsonWriter wri #endif } } - writer.WriteEndObject(); } PeeringLogAnalyticsWorkspaceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringPatch.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringPatch.Serialization.cs index 869becf92a89f..f88a0c017c60d 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringPatch.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringPatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringPatch : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,34 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti throw new FormatException($"The model {nameof(PeeringPatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); + base.JsonModelWriteCore(writer, options); } PeeringPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRoute.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRoute.Serialization.cs index fd04296f1cf54..13b3e2a84e6e6 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRoute.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRoute.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringReceivedRoute : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(PeeringReceivedRoute)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Prefix)) { writer.WritePropertyName("prefix"u8); @@ -76,7 +84,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr #endif } } - writer.WriteEndObject(); } PeeringReceivedRoute IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRouteListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRouteListResult.Serialization.cs index 2e49574643e19..5b192b73fe995 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRouteListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringReceivedRouteListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringReceivedRouteListResult : IUtf8JsonSerializable, I void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod throw new FormatException($"The model {nameof(PeeringReceivedRouteListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod #endif } } - writer.WriteEndObject(); } PeeringReceivedRouteListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredAsnListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredAsnListResult.Serialization.cs index 485d5d401fb12..a4996ba14f239 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredAsnListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredAsnListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringRegisteredAsnListResult : IUtf8JsonSerializable, I void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod throw new FormatException($"The model {nameof(PeeringRegisteredAsnListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod #endif } } - writer.WriteEndObject(); } PeeringRegisteredAsnListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredPrefixListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredPrefixListResult.Serialization.cs index 9e5385c381abb..df8023e76514c 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredPrefixListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringRegisteredPrefixListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringRegisteredPrefixListResult : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, throw new FormatException($"The model {nameof(PeeringRegisteredPrefixListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, #endif } } - writer.WriteEndObject(); } PeeringRegisteredPrefixListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringResourceTagsPatch.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringResourceTagsPatch.Serialization.cs index d5af5953ae088..ceb895fc829f4 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringResourceTagsPatch.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringResourceTagsPatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringResourceTagsPatch : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(PeeringResourceTagsPatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -52,7 +60,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead #endif } } - writer.WriteEndObject(); } PeeringResourceTagsPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountry.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountry.Serialization.cs index c4722ff1f0618..39fbdb7ecda68 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountry.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountry.Serialization.cs @@ -19,6 +19,15 @@ public partial class PeeringServiceCountry : IUtf8JsonSerializable, IJsonModel

((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,43 +35,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(PeeringServiceCountry)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); + base.JsonModelWriteCore(writer, options); } PeeringServiceCountry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountryListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountryListResult.Serialization.cs index f9e1a83609630..5adcd574e6550 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountryListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceCountryListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringServiceCountryListResult : IUtf8JsonSerializable, void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo throw new FormatException($"The model {nameof(PeeringServiceCountryListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo #endif } } - writer.WriteEndObject(); } PeeringServiceCountryListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceListResult.Serialization.cs index 3d374d51dbc73..0b7d5256d39a0 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringServiceListResult : IUtf8JsonSerializable, IJsonMo void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(PeeringServiceListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead #endif } } - writer.WriteEndObject(); } PeeringServiceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocation.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocation.Serialization.cs index 3906d050e39f7..9ae6ee3b512c8 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocation.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocation.Serialization.cs @@ -19,6 +19,15 @@ public partial class PeeringServiceLocation : IUtf8JsonSerializable, IJsonModel< void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,27 +35,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader throw new FormatException($"The model {nameof(PeeringServiceLocation)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Country)) @@ -65,22 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader writer.WriteStringValue(AzureRegion.Value); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringServiceLocation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocationListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocationListResult.Serialization.cs index 181607eae3901..ee829ebd9b116 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocationListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceLocationListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringServiceLocationListResult : IUtf8JsonSerializable, void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, M throw new FormatException($"The model {nameof(PeeringServiceLocationListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, M #endif } } - writer.WriteEndObject(); } PeeringServiceLocationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePatch.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePatch.Serialization.cs index bdc20d46e3c96..f675a123c2690 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePatch.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringServicePatch : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,34 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(PeeringServicePatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); + base.JsonModelWriteCore(writer, options); } PeeringServicePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixEvent.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixEvent.Serialization.cs index 5dbb39a8778a0..785ddf0b4a961 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixEvent.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixEvent.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringServicePrefixEvent : IUtf8JsonSerializable, IJsonMod void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(PeeringServicePrefixEvent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(EventTimestamp)) { writer.WritePropertyName("eventTimestamp"u8); @@ -66,7 +74,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea #endif } } - writer.WriteEndObject(); } PeeringServicePrefixEvent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixListResult.Serialization.cs index 04ce04aaeeea4..d86756d6f40e7 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServicePrefixListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringServicePrefixListResult : IUtf8JsonSerializable, I void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod throw new FormatException($"The model {nameof(PeeringServicePrefixListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod #endif } } - writer.WriteEndObject(); } PeeringServicePrefixListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProvider.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProvider.Serialization.cs index 0d9c96f7ad635..5551129364993 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProvider.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProvider.Serialization.cs @@ -19,6 +19,15 @@ public partial class PeeringServiceProvider : IUtf8JsonSerializable, IJsonModel< void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,27 +35,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader throw new FormatException($"The model {nameof(PeeringServiceProvider)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ServiceProviderName)) @@ -65,22 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader writer.WriteEndArray(); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringServiceProvider IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProviderListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProviderListResult.Serialization.cs index 7cf7a91cc6099..751e0a930479e 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProviderListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceProviderListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringServiceProviderListResult : IUtf8JsonSerializable, void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, M throw new FormatException($"The model {nameof(PeeringServiceProviderListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, M #endif } } - writer.WriteEndObject(); } PeeringServiceProviderListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceSku.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceSku.Serialization.cs index a64510028bac9..0bb7316701dee 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceSku.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringServiceSku.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PeeringServiceSku : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite throw new FormatException($"The model {nameof(PeeringServiceSku)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -46,7 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite #endif } } - writer.WriteEndObject(); } PeeringServiceSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringSku.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringSku.Serialization.cs index 945b6359c0a63..6d5e8dcd91be5 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringSku.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/PeeringSku.Serialization.cs @@ -18,6 +18,15 @@ public partial class PeeringSku : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption throw new FormatException($"The model {nameof(PeeringSku)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -61,7 +69,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption #endif } } - writer.WriteEndObject(); } PeeringSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RoutingPreferenceUnbilledPrefix.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RoutingPreferenceUnbilledPrefix.Serialization.cs index ac6c013124495..d610d26aa1ec7 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RoutingPreferenceUnbilledPrefix.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RoutingPreferenceUnbilledPrefix.Serialization.cs @@ -18,6 +18,15 @@ public partial class RoutingPreferenceUnbilledPrefix : IUtf8JsonSerializable, IJ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo throw new FormatException($"The model {nameof(RoutingPreferenceUnbilledPrefix)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Prefix)) { writer.WritePropertyName("prefix"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo #endif } } - writer.WriteEndObject(); } RoutingPreferenceUnbilledPrefix IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RpUnbilledPrefixListResult.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RpUnbilledPrefixListResult.Serialization.cs index d7af16c072ec3..64b645d2ed8b9 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RpUnbilledPrefixListResult.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Models/RpUnbilledPrefixListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class RpUnbilledPrefixListResult : IUtf8JsonSerializable, IJson void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe throw new FormatException($"The model {nameof(RpUnbilledPrefixListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe #endif } } - writer.WriteEndObject(); } RpUnbilledPrefixListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnData.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnData.Serialization.cs index 9d2ffa56a6043..5932112e009e8 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnData.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnData.Serialization.cs @@ -20,6 +20,15 @@ public partial class PeerAsnData : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,27 +36,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio throw new FormatException($"The model {nameof(PeerAsnData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(PeerAsn)) @@ -81,22 +70,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio writer.WriteStringValue(ErrorMessage); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeerAsnData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringData.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringData.Serialization.cs index 2927b9b3512a6..3af34962d2b13 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringData.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringData.Serialization.cs @@ -20,6 +20,15 @@ public partial class PeeringData : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,44 +36,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio throw new FormatException($"The model {nameof(PeeringData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("sku"u8); writer.WriteObjectValue(Sku, options); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Direct)) @@ -88,22 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnData.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnData.Serialization.cs index 5724e5a425088..488acd3ee7685 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnData.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnData.Serialization.cs @@ -20,6 +20,15 @@ public partial class PeeringRegisteredAsnData : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,27 +36,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(PeeringRegisteredAsnData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Asn)) @@ -66,22 +55,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringRegisteredAsnData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixData.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixData.Serialization.cs index aca086f034799..34cc4f48ab64c 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixData.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixData.Serialization.cs @@ -20,6 +20,15 @@ public partial class PeeringRegisteredPrefixData : IUtf8JsonSerializable, IJsonM void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,27 +36,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR throw new FormatException($"The model {nameof(PeeringRegisteredPrefixData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Prefix)) @@ -76,22 +65,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringRegisteredPrefixData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceData.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceData.Serialization.cs index 0ecdca3f25ac5..887184d15c269 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceData.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceData.Serialization.cs @@ -20,6 +20,15 @@ public partial class PeeringServiceData : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,45 +36,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(PeeringServiceData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); writer.WriteObjectValue(Sku, options); } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(PeeringServiceLocation)) @@ -99,22 +75,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WriteObjectValue(LogAnalyticsWorkspaceProperties, options); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringServiceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixData.Serialization.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixData.Serialization.cs index f3d3a9ec18c1e..ca870281725f5 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixData.Serialization.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixData.Serialization.cs @@ -20,6 +20,15 @@ public partial class PeeringServicePrefixData : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,27 +36,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(PeeringServicePrefixData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Prefix)) @@ -91,22 +80,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PeeringServicePrefixData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/autorest.md b/sdk/peering/Azure.ResourceManager.Peering/src/autorest.md index d340783baa267..1aee807aff218 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/autorest.md +++ b/sdk/peering/Azure.ResourceManager.Peering/src/autorest.md @@ -18,6 +18,7 @@ skip-csproj: true modelerfour: flatten-payloads: false use-model-reader-writer: true +use-write-core: true #mgmt-debug: # show-serialized-names: true