From 557b5adbcfb5d69dab7890cca2a61edaf7a647de Mon Sep 17 00:00:00 2001 From: Jorge Rangel Date: Wed, 28 Jan 2026 16:16:43 -0600 Subject: [PATCH 1/5] feat: add xml model deserialization --- .../Generated/Models/Plant.Serialization.cs | 140 + .../src/Generated/Models/Plant.cs | 52 + .../Generated/Models/SampleTypeSpecContext.cs | 6 + .../Generated/Models/Tree.Serialization.cs | 152 + .../SampleClient/src/Generated/Models/Tree.cs | 36 + .../Models/UnknownPlant.Serialization.cs | 134 + .../src/Generated/Models/UnknownPlant.cs | 21 + .../Models/XmlAdvancedModel.Serialization.cs | 579 +++ .../src/Generated/Models/XmlAdvancedModel.cs | 262 ++ .../Generated/Models/XmlItem.Serialization.cs | 155 + .../src/Generated/Models/XmlItem.cs | 49 + .../Models/XmlNestedModel.Serialization.cs | 147 + .../src/Generated/Models/XmlNestedModel.cs | 42 + .../Generated/PlantOperations.RestClient.cs | 28 + .../src/Generated/PlantOperations.cs | 139 + .../SampleTypeSpecClient.RestClient.cs | 12 + .../src/Generated/SampleTypeSpecClient.cs | 111 + .../Generated/SampleTypeSpecModelFactory.cs | 116 + .../client/csharp/SampleService/main.tsp | 168 + .../src/Primitives/ScmKnownParameters.cs | 1 - ...elSerializationExtensionsDefinition.Xml.cs | 90 + .../ModelSerializationExtensionsDefinition.cs | 6 +- .../MrwSerializationTypeDefinition.Dynamic.cs | 6 +- .../MrwSerializationTypeDefinition.Xml.cs | 599 +++ .../MrwSerializationTypeDefinition.cs | 193 +- .../src/ScmTypeFactory.cs | 2 +- .../ModelReaderWriterOptionsSnippets.cs | 1 + ...odelSerializationExtensionsSnippets.Xml.cs | 22 + .../ModelSerializationExtensionsSnippets.cs | 2 +- .../src/Snippets/XElementSnippets.cs | 55 + .../src/Snippets/XmlLinqSnippets.cs | 15 + ...lSerializationExtensionsDefinitionTests.cs | 109 +- ...dDiscriminatedModelWithOwnDiscriminator.cs | 30 +- .../CanCustomizeBaseType.cs | 30 +- .../CanCustomizeEnumToFieldFrameworkType.cs | 30 +- .../CanCustomizeEnumToFrameworkType.cs | 30 +- .../CanCustomizeFixedEnumString.cs | 30 +- .../CanCustomizeNullableStringToFixedEnum.cs | 30 +- .../CanCustomizePropertyIntoReadOnlyMemory.cs | 30 +- .../CanCustomizeStringToFixedEnum.cs | 30 +- .../CanCustomizeUriProperty.cs | 30 +- .../CanChangeDictionaryToBinaryData.cs | 30 +- ...ngeListOfEnumPropToListOfExtensibleEnum.cs | 30 +- .../CanChangePropertyName.cs | 30 +- ...anChangePropertyNameAndRedefineOriginal.cs | 30 +- .../CanChangePropertySerializedName.cs | 30 +- .../CanCustomizeExtensibleEnum(int32).cs | 30 +- .../CanCustomizeExtensibleEnum(string).cs | 30 +- ...CustomizeLiteralExtensibleEnum(int32,1).cs | 30 +- ...tomizeLiteralExtensibleEnum(string,foo).cs | 30 +- .../CanCustomizePropertyUsingField.cs | 30 +- .../CanCustomizeSerializationMethod.cs | 30 +- ...izeSerializationMethodForPropertyInBase.cs | 30 +- ...zeSerializationMethodForRenamedProperty.cs | 30 +- .../CanReplaceDeserializationMethod.cs | 30 +- .../CanReplaceSerializationMethod.cs | 30 +- .../ReadOnlyMemPropertyType.cs | 30 +- ...DeserializationForDiscriminatedBaseType.cs | 32 + ...lDeserializationForDiscriminatedSubtype.cs | 49 + ...serializationHandlesAttributeProperties.cs | 48 + ...thodBodyContainsPropertyDeserialization.cs | 57 + ...DeserializationMethodHandlesNestedModel.cs | 53 + ...ationMethodHandlesUnwrappedListProperty.cs | 61 + ...izationMethodHandlesWrappedListProperty.cs | 62 + .../CanChangePropertyName.cs | 37 + .../CanChangePropertyName/Model.cs | 12 + ...CustomizeAttributeDeserializationMethod.cs | 48 + .../MockInputModel.cs | 12 + .../CanCustomizeDeserializationMethod.cs | 43 + .../MockInputModel.cs | 13 + .../CanReplaceDeserializationMethod.cs | 29 + .../MockInputModel.cs | 36 + .../XmlDeserializationTests.cs | 422 ++ .../XmlSerializationCustomizationTests.cs | 148 + .../src/InputLibrary.cs | 23 + .../src/Primitives/PropertyWireInformation.cs | 5 + .../src/Primitives/XmlWireInformation.cs | 36 + .../src/Primitives/XmlWireNamespaceOptions.cs | 20 + .../test/common/InputFactory.cs | 10 +- .../Internal/ModelSerializationExtensions.cs | 16 + .../Generated/Models/Animal.Serialization.cs | 50 +- .../AnotherDynamicModel.Serialization.cs | 34 +- .../src/Generated/Models/Dog.Serialization.cs | 50 +- .../Models/DynamicModel.Serialization.cs | 34 +- .../Generated/Models/Friend.Serialization.cs | 50 +- .../GetWidgetMetricsResponse.Serialization.cs | 50 +- ...kenHeaderResponseResponse.Serialization.cs | 50 +- ...ContinuationTokenResponse.Serialization.cs | 50 +- .../ListWithNextLinkResponse.Serialization.cs | 50 +- ...ithStringNextLinkResponse.Serialization.cs | 50 +- ...EmbeddedNonBodyParameters.Serialization.cs | 34 +- ...equiredNullableProperties.Serialization.cs | 34 +- .../Models/PageThing.Serialization.cs | 50 +- .../src/Generated/Models/Pet.Serialization.cs | 50 +- .../Generated/Models/Plant.Serialization.cs | 65 + .../src/Generated/Models/Plant.cs | 55 + .../RenamedModelCustom.Serialization.cs | 50 +- ...rnsAnonymousModelResponse.Serialization.cs | 50 +- .../Models/RoundTripModel.Serialization.cs | 50 +- .../Generated/Models/SampleTypeSpecContext.cs | 6 + .../Generated/Models/Thing.Serialization.cs | 50 +- .../Generated/Models/Tree.Serialization.cs | 97 + .../src/Generated/Models/Tree.cs | 39 + .../Models/UnknownAnimal.Serialization.cs | 34 +- .../Models/UnknownPet.Serialization.cs | 34 +- .../Models/UnknownPlant.Serialization.cs | 76 + .../src/Generated/Models/UnknownPlant.cs | 24 + .../Models/XmlAdvancedModel.Serialization.cs | 311 ++ .../src/Generated/Models/XmlAdvancedModel.cs | 265 ++ .../Generated/Models/XmlItem.Serialization.cs | 82 + .../src/Generated/Models/XmlItem.cs | 52 + .../Models/XmlNestedModel.Serialization.cs | 76 + .../src/Generated/Models/XmlNestedModel.cs | 45 + .../Generated/PlantOperations.RestClient.cs | 31 + .../src/Generated/PlantOperations.cs | 90 + .../SampleTypeSpecClient.RestClient.cs | 12 + .../src/Generated/SampleTypeSpecClient.cs | 59 + .../Generated/SampleTypeSpecModelFactory.cs | 116 + .../Local/Sample-TypeSpec/tspCodeModel.json | 3391 ++++++++++++----- .../Models/BulletPointsModel.Serialization.cs | 4 +- ...mmaDelimitedArrayProperty.Serialization.cs | 8 +- ...ineDelimitedArrayProperty.Serialization.cs | 8 +- ...ipeDelimitedArrayProperty.Serialization.cs | 8 +- ...aceDelimitedArrayProperty.Serialization.cs | 8 +- .../Base64BytesProperty.Serialization.cs | 8 +- ...se64urlArrayBytesProperty.Serialization.cs | 8 +- .../Base64urlBytesProperty.Serialization.cs | 8 +- .../DefaultBytesProperty.Serialization.cs | 8 +- .../DefaultDatetimeProperty.Serialization.cs | 8 +- .../Rfc3339DatetimeProperty.Serialization.cs | 8 +- .../Rfc7231DatetimeProperty.Serialization.cs | 8 +- ...tampArrayDatetimeProperty.Serialization.cs | 8 +- ...TimestampDatetimeProperty.Serialization.cs | 8 +- .../DefaultDurationProperty.Serialization.cs | 8 +- ...lisecondsDurationProperty.Serialization.cs | 8 +- ...64SecondsDurationProperty.Serialization.cs | 8 +- ...ondsDurationArrayProperty.Serialization.cs | 8 +- ...lisecondsDurationProperty.Serialization.cs | 8 +- ...argerUnitDurationProperty.Serialization.cs | 8 +- ...ondsDurationArrayProperty.Serialization.cs | 8 +- ...atSecondsDurationProperty.Serialization.cs | 8 +- ...argerUnitDurationProperty.Serialization.cs | 8 +- .../ISO8601DurationProperty.Serialization.cs | 8 +- ...lisecondsDurationProperty.Serialization.cs | 8 +- ...argerUnitDurationProperty.Serialization.cs | 8 +- ...32SecondsDurationProperty.Serialization.cs | 8 +- ...argerUnitDurationProperty.Serialization.cs | 8 +- .../SafeintAsStringProperty.Serialization.cs | 8 +- .../Uint32AsStringProperty.Serialization.cs | 8 +- .../Uint8AsStringProperty.Serialization.cs | 8 +- .../Generated/Models/User.Serialization.cs | 4 +- .../Models/BodyModel.Serialization.cs | 4 +- .../Models/BodyParameter.Serialization.cs | 4 +- .../Models/PngImageAsJson.Serialization.cs | 8 +- .../Models/InnerModel.Serialization.cs | 4 +- .../Models/Resource.Serialization.cs | 8 +- .../src/Generated/Models/Pet.Serialization.cs | 4 +- .../Models/ErrorInRange.Serialization.cs | 4 +- .../Models/NotFoundError.Serialization.cs | 4 +- .../JsonEncodedNameModel.Serialization.cs | 8 +- .../src/Generated/Models/And.Serialization.cs | 4 +- .../src/Generated/Models/As.Serialization.cs | 4 +- .../Generated/Models/Assert.Serialization.cs | 4 +- .../Generated/Models/Async.Serialization.cs | 4 +- .../Generated/Models/Await.Serialization.cs | 4 +- .../Generated/Models/Break.Serialization.cs | 4 +- .../Generated/Models/Class.Serialization.cs | 4 +- .../Models/Constructor.Serialization.cs | 4 +- .../Models/Continue.Serialization.cs | 4 +- .../src/Generated/Models/Def.Serialization.cs | 4 +- .../src/Generated/Models/Del.Serialization.cs | 4 +- .../Models/DictMethods.Serialization.cs | 4 +- .../Generated/Models/Elif.Serialization.cs | 4 +- .../Generated/Models/Else.Serialization.cs | 4 +- .../Generated/Models/Except.Serialization.cs | 4 +- .../Generated/Models/Exec.Serialization.cs | 4 +- .../Generated/Models/Finally.Serialization.cs | 4 +- .../src/Generated/Models/For.Serialization.cs | 4 +- .../Generated/Models/From.Serialization.cs | 4 +- .../Generated/Models/Global.Serialization.cs | 4 +- .../src/Generated/Models/If.Serialization.cs | 4 +- .../Generated/Models/Import.Serialization.cs | 4 +- .../src/Generated/Models/In.Serialization.cs | 4 +- .../src/Generated/Models/Is.Serialization.cs | 4 +- .../Generated/Models/Lambda.Serialization.cs | 4 +- .../src/Generated/Models/Not.Serialization.cs | 4 +- .../src/Generated/Models/Or.Serialization.cs | 4 +- .../Generated/Models/Pass.Serialization.cs | 4 +- .../Generated/Models/Raise.Serialization.cs | 4 +- .../Generated/Models/Return.Serialization.cs | 4 +- .../Models/SameAsModel.Serialization.cs | 4 +- .../src/Generated/Models/Try.Serialization.cs | 4 +- .../Generated/Models/While.Serialization.cs | 4 +- .../Generated/Models/With.Serialization.cs | 4 +- .../Generated/Models/Yield.Serialization.cs | 4 +- .../Models/InnerModel.Serialization.cs | 4 +- .../Models/InnerModel.Serialization.cs | 4 +- .../Models/EmptyInput.Serialization.cs | 4 +- .../Models/EmptyInputOutput.Serialization.cs | 8 +- .../Models/EmptyOutput.Serialization.cs | 8 +- .../Generated/Models/Cobra.Serialization.cs | 4 +- .../src/Generated/Models/Dog.Serialization.cs | 8 +- .../Generated/Models/Golden.Serialization.cs | 4 +- .../Generated/Models/Snake.Serialization.cs | 8 +- .../Models/UnknownDog.Serialization.cs | 4 +- .../Models/UnknownSnake.Serialization.cs | 4 +- .../Generated/Models/Fish.Serialization.cs | 8 +- .../Models/GoblinShark.Serialization.cs | 4 +- .../Generated/Models/Salmon.Serialization.cs | 4 +- .../Models/SawShark.Serialization.cs | 4 +- .../Generated/Models/Shark.Serialization.cs | 4 +- .../Models/UnknownFish.Serialization.cs | 4 +- .../Models/UnknownShark.Serialization.cs | 4 +- .../src/Generated/Models/Cat.Serialization.cs | 4 +- .../src/Generated/Models/Pet.Serialization.cs | 4 +- .../Generated/Models/Siamese.Serialization.cs | 8 +- .../Generated/Models/Element.Serialization.cs | 4 +- .../Models/Extension.Serialization.cs | 8 +- .../Generated/Models/Bird.Serialization.cs | 8 +- .../Models/Dinosaur.Serialization.cs | 8 +- .../Generated/Models/Eagle.Serialization.cs | 4 +- .../Generated/Models/Goose.Serialization.cs | 4 +- .../Generated/Models/SeaGull.Serialization.cs | 4 +- .../Generated/Models/Sparrow.Serialization.cs | 4 +- .../Generated/Models/TRex.Serialization.cs | 4 +- .../Models/UnknownBird.Serialization.cs | 4 +- .../Models/UnknownDinosaur.Serialization.cs | 4 +- .../Models/InputOutputRecord.Serialization.cs | 8 +- .../Models/InputRecord.Serialization.cs | 4 +- .../Models/OutputRecord.Serialization.cs | 8 +- .../Models/ReadOnlyModel.Serialization.cs | 8 +- .../Models/VisibilityModel.Serialization.cs | 8 +- ...fferentSpreadFloatDerived.Serialization.cs | 8 +- ...ifferentSpreadFloatRecord.Serialization.cs | 8 +- ...ntSpreadModelArrayDerived.Serialization.cs | 8 +- ...entSpreadModelArrayRecord.Serialization.cs | 8 +- ...fferentSpreadModelDerived.Serialization.cs | 8 +- ...ifferentSpreadModelRecord.Serialization.cs | 8 +- ...ferentSpreadStringDerived.Serialization.cs | 8 +- ...fferentSpreadStringRecord.Serialization.cs | 8 +- ...FloatAdditionalProperties.Serialization.cs | 8 +- ...ModelAdditionalProperties.Serialization.cs | 8 +- ...ArrayAdditionalProperties.Serialization.cs | 8 +- ...tringAdditionalProperties.Serialization.cs | 8 +- ...knownAdditionalProperties.Serialization.cs | 8 +- ...ditionalPropertiesDerived.Serialization.cs | 8 +- ...alPropertiesDiscriminated.Serialization.cs | 8 +- ...rtiesDiscriminatedDerived.Serialization.cs | 4 +- ...FloatAdditionalProperties.Serialization.cs | 8 +- ...ModelAdditionalProperties.Serialization.cs | 8 +- ...ArrayAdditionalProperties.Serialization.cs | 8 +- ...tringAdditionalProperties.Serialization.cs | 8 +- ...knownAdditionalProperties.Serialization.cs | 8 +- ...ditionalPropertiesDerived.Serialization.cs | 8 +- ...alPropertiesDiscriminated.Serialization.cs | 8 +- ...rtiesDiscriminatedDerived.Serialization.cs | 4 +- .../Models/ModelForRecord.Serialization.cs | 4 +- .../MultipleSpreadRecord.Serialization.cs | 8 +- .../Models/SpreadFloatRecord.Serialization.cs | 8 +- .../SpreadModelArrayRecord.Serialization.cs | 8 +- .../Models/SpreadModelRecord.Serialization.cs | 8 +- ...dForNonDiscriminatedUnion.Serialization.cs | 8 +- ...ForNonDiscriminatedUnion2.Serialization.cs | 8 +- ...ForNonDiscriminatedUnion3.Serialization.cs | 8 +- .../SpreadRecordForUnion.Serialization.cs | 8 +- .../SpreadStringRecord.Serialization.cs | 8 +- ...alPropertiesDiscriminated.Serialization.cs | 4 +- ...alPropertiesDiscriminated.Serialization.cs | 4 +- .../Models/WidgetData0.Serialization.cs | 4 +- .../Models/WidgetData1.Serialization.cs | 4 +- .../Models/WidgetData2.Serialization.cs | 4 +- .../Models/BytesProperty.Serialization.cs | 8 +- .../CollectionsByteProperty.Serialization.cs | 8 +- .../CollectionsModelProperty.Serialization.cs | 8 +- ...CollectionsStringProperty.Serialization.cs | 8 +- .../Models/DatetimeProperty.Serialization.cs | 8 +- .../Models/DurationProperty.Serialization.cs | 8 +- .../Models/InnerModel.Serialization.cs | 4 +- .../Models/StringProperty.Serialization.cs | 8 +- .../BooleanLiteralProperty.Serialization.cs | 8 +- .../Models/BytesProperty.Serialization.cs | 8 +- .../CollectionsByteProperty.Serialization.cs | 8 +- .../CollectionsModelProperty.Serialization.cs | 8 +- .../Models/DatetimeProperty.Serialization.cs | 8 +- .../Models/DurationProperty.Serialization.cs | 8 +- .../FloatLiteralProperty.Serialization.cs | 8 +- .../IntLiteralProperty.Serialization.cs | 8 +- .../Models/PlainDateProperty.Serialization.cs | 8 +- .../Models/PlainTimeProperty.Serialization.cs | 8 +- ...quiredAndOptionalProperty.Serialization.cs | 8 +- .../StringLiteralProperty.Serialization.cs | 8 +- .../Models/StringProperty.Serialization.cs | 8 +- ...UnionFloatLiteralProperty.Serialization.cs | 8 +- .../UnionIntLiteralProperty.Serialization.cs | 8 +- ...nionStringLiteralProperty.Serialization.cs | 8 +- .../BooleanLiteralProperty.Serialization.cs | 8 +- .../Models/BooleanProperty.Serialization.cs | 8 +- .../Models/BytesProperty.Serialization.cs | 8 +- .../CollectionsIntProperty.Serialization.cs | 8 +- .../CollectionsModelProperty.Serialization.cs | 8 +- ...CollectionsStringProperty.Serialization.cs | 8 +- .../Models/DatetimeProperty.Serialization.cs | 8 +- .../Decimal128Property.Serialization.cs | 8 +- .../Models/DecimalProperty.Serialization.cs | 8 +- .../DictionaryStringProperty.Serialization.cs | 8 +- .../Models/DurationProperty.Serialization.cs | 8 +- .../Models/EnumProperty.Serialization.cs | 8 +- .../ExtensibleEnumProperty.Serialization.cs | 8 +- .../FloatLiteralProperty.Serialization.cs | 8 +- .../Models/FloatProperty.Serialization.cs | 8 +- .../Models/InnerModel.Serialization.cs | 4 +- .../IntLiteralProperty.Serialization.cs | 8 +- .../Models/IntProperty.Serialization.cs | 8 +- .../Models/ModelProperty.Serialization.cs | 8 +- .../Models/NeverProperty.Serialization.cs | 8 +- .../StringLiteralProperty.Serialization.cs | 8 +- .../Models/StringProperty.Serialization.cs | 8 +- .../UnionEnumValueProperty.Serialization.cs | 8 +- ...UnionFloatLiteralProperty.Serialization.cs | 8 +- .../UnionIntLiteralProperty.Serialization.cs | 8 +- ...nionStringLiteralProperty.Serialization.cs | 8 +- .../UnknownArrayProperty.Serialization.cs | 8 +- .../UnknownDictProperty.Serialization.cs | 8 +- .../UnknownIntProperty.Serialization.cs | 8 +- .../UnknownStringProperty.Serialization.cs | 8 +- .../src/Generated/Models/Cat.Serialization.cs | 8 +- .../src/Generated/Models/Dog.Serialization.cs | 8 +- .../src/Generated/Models/Cat.Serialization.cs | 4 +- .../src/Generated/Models/Dog.Serialization.cs | 4 +- .../Models/EnumsOnlyCases.Serialization.cs | 4 +- .../Models/GetResponse.Serialization.cs | 8 +- .../Models/GetResponse1.Serialization.cs | 8 +- .../Models/GetResponse2.Serialization.cs | 8 +- .../Models/GetResponse3.Serialization.cs | 8 +- .../Models/GetResponse4.Serialization.cs | 8 +- .../Models/GetResponse5.Serialization.cs | 8 +- .../Models/GetResponse6.Serialization.cs | 8 +- .../Models/GetResponse7.Serialization.cs | 8 +- .../Models/GetResponse8.Serialization.cs | 8 +- .../Models/GetResponse9.Serialization.cs | 8 +- .../MixedLiteralsCases.Serialization.cs | 4 +- .../Models/MixedTypesCases.Serialization.cs | 4 +- .../StringAndArrayCases.Serialization.cs | 4 +- .../Generated/Models/ModelV1.Serialization.cs | 8 +- .../Generated/Models/ModelV1.Serialization.cs | 8 +- .../Generated/Models/ModelV2.Serialization.cs | 8 +- .../Models/TestModel.Serialization.cs | 8 +- .../Models/TestModel.Serialization.cs | 8 +- .../Generated/Models/ModelV1.Serialization.cs | 8 +- .../Generated/Models/ModelV2.Serialization.cs | 8 +- .../Generated/Models/ModelV3.Serialization.cs | 8 +- .../Generated/Models/ModelV2.Serialization.cs | 8 +- .../Generated/Models/ModelV3.Serialization.cs | 8 +- .../Generated/Models/ModelV1.Serialization.cs | 8 +- .../Generated/Models/ModelV2.Serialization.cs | 8 +- .../Generated/Models/ModelV3.Serialization.cs | 8 +- .../Models/OldModel.Serialization.cs | 8 +- .../Models/NewModel.Serialization.cs | 8 +- .../Models/TestModel.Serialization.cs | 8 +- .../Models/TestModel.Serialization.cs | 8 +- 360 files changed, 10256 insertions(+), 2608 deletions(-) create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.Serialization.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.Serialization.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.Serialization.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.Serialization.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.Serialization.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.RestClient.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XmlLinqSnippets.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedBaseType.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedSubtype.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeProperties.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodBodyContainsPropertyDeserialization.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesUnwrappedListProperty.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesWrappedListProperty.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName/Model.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod/MockInputModel.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod/MockInputModel.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod/MockInputModel.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlSerializationCustomizationTests.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.Serialization.cs new file mode 100644 index 00000000000..5eae2515b59 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.Serialization.cs @@ -0,0 +1,140 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// + /// Base plant with discriminator + /// Please note this is the abstract base class. The derived classes available for instantiation are: . + /// + [PersistableModelProxy(typeof(UnknownPlant))] + public abstract partial class Plant : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal Plant() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support writing '{format}' format."); + } + writer.WritePropertyName("species"u8); + writer.WriteStringValue(Species); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("height"u8); + writer.WriteNumberValue(Height); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + Plant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual Plant JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlant(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Plant DeserializePlant(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("species"u8, out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "tree": + return Tree.DeserializeTree(element, options); + } + } + return UnknownPlant.DeserializeUnknownPlant(element, options); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(Plant)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Plant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Plant PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializePlant(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Plant)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.cs new file mode 100644 index 00000000000..6ba6c56a52a --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Plant.cs @@ -0,0 +1,52 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// + /// Base plant with discriminator + /// Please note this is the abstract base class. The derived classes available for instantiation are: . + /// + public abstract partial class Plant + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + private protected Plant(string species, string id, int height) + { + Species = species; + Id = id; + Height = height; + } + + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// Keeps track of any properties unknown to the library. + internal Plant(string species, string id, int height, IDictionary additionalBinaryDataProperties) + { + Species = species; + Id = id; + Height = height; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The species of plant. + internal string Species { get; set; } + + /// The unique identifier of the plant. + public string Id { get; } + + /// The height of the plant in centimeters. + public int Height { get; } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs index acbd82d2f33..dcb0097bb9d 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs @@ -24,12 +24,18 @@ namespace SampleTypeSpec [ModelReaderWriterBuildable(typeof(ModelWithRequiredNullableProperties))] [ModelReaderWriterBuildable(typeof(PageThing))] [ModelReaderWriterBuildable(typeof(Pet))] + [ModelReaderWriterBuildable(typeof(Plant))] [ModelReaderWriterBuildable(typeof(RenamedModel))] [ModelReaderWriterBuildable(typeof(ReturnsAnonymousModelResponse))] [ModelReaderWriterBuildable(typeof(RoundTripModel))] [ModelReaderWriterBuildable(typeof(Thing))] + [ModelReaderWriterBuildable(typeof(Tree))] [ModelReaderWriterBuildable(typeof(UnknownAnimal))] [ModelReaderWriterBuildable(typeof(UnknownPet))] + [ModelReaderWriterBuildable(typeof(UnknownPlant))] + [ModelReaderWriterBuildable(typeof(XmlAdvancedModel))] + [ModelReaderWriterBuildable(typeof(XmlItem))] + [ModelReaderWriterBuildable(typeof(XmlNestedModel))] public partial class SampleTypeSpecContext : ModelReaderWriterContext { } diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.Serialization.cs new file mode 100644 index 00000000000..9795daa7a3f --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.Serialization.cs @@ -0,0 +1,152 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// Tree is a specific type of plant. + public partial class Tree : Plant, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal Tree() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Tree)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("age"u8); + writer.WriteNumberValue(Age); + } + + /// The JSON reader. + /// The client options for reading and writing models. + Tree IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (Tree)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override Plant JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Tree)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTree(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Tree DeserializeTree(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string species = "tree"; + string id = default; + int height = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + int age = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("species"u8)) + { + species = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("height"u8)) + { + height = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("age"u8)) + { + age = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new Tree(species, id, height, additionalBinaryDataProperties, age); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(Tree)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Tree IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (Tree)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected override Plant PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeTree(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Tree)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator Tree(ClientResult result) + { + using PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeTree(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.cs new file mode 100644 index 00000000000..acdeb24ca48 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/Tree.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// Tree is a specific type of plant. + public partial class Tree : Plant + { + /// Initializes a new instance of . + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// The age of the tree in years. + internal Tree(string id, int height, int age) : base("tree", id, height) + { + Age = age; + } + + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// Keeps track of any properties unknown to the library. + /// The age of the tree in years. + internal Tree(string species, string id, int height, IDictionary additionalBinaryDataProperties, int age) : base(species, id, height, additionalBinaryDataProperties) + { + Age = age; + } + + /// The age of the tree in years. + public int Age { get; } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.Serialization.cs new file mode 100644 index 00000000000..4aa376053e4 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.Serialization.cs @@ -0,0 +1,134 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace SampleTypeSpec +{ + internal partial class UnknownPlant : Plant, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal UnknownPlant() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + } + + /// The JSON reader. + /// The client options for reading and writing models. + Plant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override Plant JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlant(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UnknownPlant DeserializeUnknownPlant(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string species = "unknown"; + string id = default; + int height = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("species"u8)) + { + species = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("height"u8)) + { + height = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new UnknownPlant(species, id, height, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(Plant)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Plant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected override Plant PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializePlant(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Plant)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.cs new file mode 100644 index 00000000000..7e2e30cea3a --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/UnknownPlant.cs @@ -0,0 +1,21 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + internal partial class UnknownPlant : Plant + { + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// Keeps track of any properties unknown to the library. + internal UnknownPlant(string species, string id, int height, IDictionary additionalBinaryDataProperties) : base(species ?? "unknown", id, height, additionalBinaryDataProperties) + { + } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs new file mode 100644 index 00000000000..358eeb1aa4c --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs @@ -0,0 +1,579 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// An advanced XML model for testing various property types and XML features. + public partial class XmlAdvancedModel : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal XmlAdvancedModel() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlAdvancedModel)} does not support writing '{format}' format."); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("age"u8); + writer.WriteNumberValue(Age); + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled); + writer.WritePropertyName("score"u8); + writer.WriteNumberValue(Score); + if (Optional.IsDefined(OptionalString)) + { + writer.WritePropertyName("optionalString"u8); + writer.WriteStringValue(OptionalString); + } + if (Optional.IsDefined(OptionalInt)) + { + writer.WritePropertyName("optionalInt"u8); + writer.WriteNumberValue(OptionalInt.Value); + } + if (Optional.IsDefined(NullableString)) + { + writer.WritePropertyName("nullableString"u8); + writer.WriteStringValue(NullableString); + } + else + { + writer.WriteNull("nullableString"u8); + } + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version); + writer.WritePropertyName("isActive"u8); + writer.WriteBooleanValue(IsActive); + writer.WritePropertyName("RenamedProperty"u8); + writer.WriteStringValue(OriginalName); + writer.WritePropertyName("xml-id"u8); + writer.WriteStringValue(XmlIdentifier); + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + writer.WritePropertyName("unwrappedStrings"u8); + writer.WriteStartArray(); + foreach (string item in UnwrappedStrings) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("unwrappedCounts"u8); + writer.WriteStartArray(); + foreach (int item in UnwrappedCounts) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("unwrappedItems"u8); + writer.WriteStartArray(); + foreach (XmlItem item in UnwrappedItems) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("wrappedColors"u8); + writer.WriteStartArray(); + foreach (string item in WrappedColors) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("ItemCollection"u8); + writer.WriteStartArray(); + foreach (XmlItem item in Items) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("nestedModel"u8); + writer.WriteObjectValue(NestedModel, options); + if (Optional.IsDefined(OptionalNestedModel)) + { + writer.WritePropertyName("optionalNestedModel"u8); + writer.WriteObjectValue(OptionalNestedModel, options); + } + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + writer.WritePropertyName("createdAt"u8); + writer.WriteStringValue(CreatedAt, "O"); + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration, "P"); + writer.WritePropertyName("data"u8); + writer.WriteBase64StringValue(Data.ToArray(), "D"); + if (Optional.IsCollectionDefined(OptionalRecordUnknown)) + { + writer.WritePropertyName("optionalRecordUnknown"u8); + writer.WriteStartObject(); + foreach (var item in OptionalRecordUnknown) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#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(); + } + writer.WritePropertyName("fixedEnum"u8); + writer.WriteStringValue(FixedEnum.ToSerialString()); + writer.WritePropertyName("extensibleEnum"u8); + writer.WriteStringValue(ExtensibleEnum.ToString()); + if (Optional.IsDefined(OptionalFixedEnum)) + { + writer.WritePropertyName("optionalFixedEnum"u8); + writer.WriteNumberValue((int)OptionalFixedEnum.Value); + } + if (Optional.IsDefined(OptionalExtensibleEnum)) + { + writer.WritePropertyName("optionalExtensibleEnum"u8); + writer.WriteNumberValue(OptionalExtensibleEnum.Value.ToSerialInt32()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + XmlAdvancedModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual XmlAdvancedModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlAdvancedModel)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeXmlAdvancedModel(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static XmlAdvancedModel DeserializeXmlAdvancedModel(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + int age = default; + bool enabled = default; + float score = default; + string optionalString = default; + int? optionalInt = default; + string nullableString = default; + string id = default; + int version = default; + bool isActive = default; + string originalName = default; + string xmlIdentifier = default; + string content = default; + IList unwrappedStrings = default; + IList unwrappedCounts = default; + IList unwrappedItems = default; + IList wrappedColors = default; + IList items = default; + XmlNestedModel nestedModel = default; + XmlNestedModel optionalNestedModel = default; + IDictionary metadata = default; + DateTimeOffset createdAt = default; + TimeSpan duration = default; + BinaryData data = default; + IDictionary optionalRecordUnknown = default; + StringFixedEnum fixedEnum = default; + StringExtensibleEnum extensibleEnum = default; + IntFixedEnum? optionalFixedEnum = default; + IntExtensibleEnum? optionalExtensibleEnum = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("age"u8)) + { + age = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("enabled"u8)) + { + enabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("score"u8)) + { + score = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("optionalString"u8)) + { + optionalString = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("optionalInt"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + optionalInt = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("nullableString"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + nullableString = null; + continue; + } + nullableString = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("version"u8)) + { + version = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("isActive"u8)) + { + isActive = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("RenamedProperty"u8)) + { + originalName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("xml-id"u8)) + { + xmlIdentifier = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("content"u8)) + { + content = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("unwrappedStrings"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + unwrappedStrings = array; + continue; + } + if (prop.NameEquals("unwrappedCounts"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + unwrappedCounts = array; + continue; + } + if (prop.NameEquals("unwrappedItems"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(XmlItem.DeserializeXmlItem(item, options)); + } + unwrappedItems = array; + continue; + } + if (prop.NameEquals("wrappedColors"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + wrappedColors = array; + continue; + } + if (prop.NameEquals("ItemCollection"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(XmlItem.DeserializeXmlItem(item, options)); + } + items = array; + continue; + } + if (prop.NameEquals("nestedModel"u8)) + { + nestedModel = XmlNestedModel.DeserializeXmlNestedModel(prop.Value, options); + continue; + } + if (prop.NameEquals("optionalNestedModel"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + optionalNestedModel = XmlNestedModel.DeserializeXmlNestedModel(prop.Value, options); + continue; + } + if (prop.NameEquals("metadata"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + metadata = dictionary; + continue; + } + if (prop.NameEquals("createdAt"u8)) + { + createdAt = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("duration"u8)) + { + duration = prop.Value.GetTimeSpan("P"); + continue; + } + if (prop.NameEquals("data"u8)) + { + data = BinaryData.FromBytes(prop.Value.GetBytesFromBase64("D")); + continue; + } + if (prop.NameEquals("optionalRecordUnknown"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, BinaryData.FromString(prop0.Value.GetRawText())); + } + } + optionalRecordUnknown = dictionary; + continue; + } + if (prop.NameEquals("fixedEnum"u8)) + { + fixedEnum = prop.Value.GetString().ToStringFixedEnum(); + continue; + } + if (prop.NameEquals("extensibleEnum"u8)) + { + extensibleEnum = new StringExtensibleEnum(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("optionalFixedEnum"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + optionalFixedEnum = prop.Value.GetInt32().ToIntFixedEnum(); + continue; + } + if (prop.NameEquals("optionalExtensibleEnum"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + optionalExtensibleEnum = new IntExtensibleEnum(prop.Value.GetInt32()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new XmlAdvancedModel( + name, + age, + enabled, + score, + optionalString, + optionalInt, + nullableString, + id, + version, + isActive, + originalName, + xmlIdentifier, + content, + unwrappedStrings, + unwrappedCounts, + unwrappedItems, + wrappedColors, + items, + nestedModel, + optionalNestedModel, + metadata, + createdAt, + duration, + data, + optionalRecordUnknown ?? new ChangeTrackingDictionary(), + fixedEnum, + extensibleEnum, + optionalFixedEnum, + optionalExtensibleEnum, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(XmlAdvancedModel)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + XmlAdvancedModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlAdvancedModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeXmlAdvancedModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(XmlAdvancedModel)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator XmlAdvancedModel(ClientResult result) + { + using PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeXmlAdvancedModel(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs new file mode 100644 index 00000000000..070965b492c --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs @@ -0,0 +1,262 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// An advanced XML model for testing various property types and XML features. + public partial class XmlAdvancedModel + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// A simple string property. + /// An integer property. + /// A boolean property. + /// A float property. + /// A nullable string. + /// A string as XML attribute. + /// An integer as XML attribute. + /// A boolean as XML attribute. + /// A property with a custom XML element name. + /// An attribute with a custom XML name. + /// Text content in the element (unwrapped string). + /// An unwrapped array of strings - items appear directly without wrapper. + /// An unwrapped array of integers. + /// An unwrapped array of models. + /// A wrapped array of strings (default). + /// A wrapped array with custom wrapper name. + /// A nested model property. + /// A dictionary property. + /// A date-time property. + /// A duration property. + /// A bytes property. + /// A fixed enum property. + /// An extensible enum property. + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IEnumerable unwrappedStrings, IEnumerable unwrappedCounts, IEnumerable unwrappedItems, IEnumerable wrappedColors, IEnumerable items, XmlNestedModel nestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum) + { + Name = name; + Age = age; + Enabled = enabled; + Score = score; + NullableString = nullableString; + Id = id; + Version = version; + IsActive = isActive; + OriginalName = originalName; + XmlIdentifier = xmlIdentifier; + Content = content; + UnwrappedStrings = unwrappedStrings.ToList(); + UnwrappedCounts = unwrappedCounts.ToList(); + UnwrappedItems = unwrappedItems.ToList(); + WrappedColors = wrappedColors.ToList(); + Items = items.ToList(); + NestedModel = nestedModel; + Metadata = metadata; + CreatedAt = createdAt; + Duration = duration; + Data = data; + OptionalRecordUnknown = new ChangeTrackingDictionary(); + FixedEnum = fixedEnum; + ExtensibleEnum = extensibleEnum; + } + + /// Initializes a new instance of . + /// A simple string property. + /// An integer property. + /// A boolean property. + /// A float property. + /// An optional string. + /// An optional integer. + /// A nullable string. + /// A string as XML attribute. + /// An integer as XML attribute. + /// A boolean as XML attribute. + /// A property with a custom XML element name. + /// An attribute with a custom XML name. + /// Text content in the element (unwrapped string). + /// An unwrapped array of strings - items appear directly without wrapper. + /// An unwrapped array of integers. + /// An unwrapped array of models. + /// A wrapped array of strings (default). + /// A wrapped array with custom wrapper name. + /// A nested model property. + /// An optional nested model. + /// A dictionary property. + /// A date-time property. + /// A duration property. + /// A bytes property. + /// optional record of unknown. + /// A fixed enum property. + /// An extensible enum property. + /// An optional fixed enum property. + /// An optional extensible enum property. + /// Keeps track of any properties unknown to the library. + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string optionalString, int? optionalInt, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IList unwrappedStrings, IList unwrappedCounts, IList unwrappedItems, IList wrappedColors, IList items, XmlNestedModel nestedModel, XmlNestedModel optionalNestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, IDictionary optionalRecordUnknown, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, IntFixedEnum? optionalFixedEnum, IntExtensibleEnum? optionalExtensibleEnum, IDictionary additionalBinaryDataProperties) + { + Name = name; + Age = age; + Enabled = enabled; + Score = score; + OptionalString = optionalString; + OptionalInt = optionalInt; + NullableString = nullableString; + Id = id; + Version = version; + IsActive = isActive; + OriginalName = originalName; + XmlIdentifier = xmlIdentifier; + Content = content; + UnwrappedStrings = unwrappedStrings; + UnwrappedCounts = unwrappedCounts; + UnwrappedItems = unwrappedItems; + WrappedColors = wrappedColors; + Items = items; + NestedModel = nestedModel; + OptionalNestedModel = optionalNestedModel; + Metadata = metadata; + CreatedAt = createdAt; + Duration = duration; + Data = data; + OptionalRecordUnknown = optionalRecordUnknown; + FixedEnum = fixedEnum; + ExtensibleEnum = extensibleEnum; + OptionalFixedEnum = optionalFixedEnum; + OptionalExtensibleEnum = optionalExtensibleEnum; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A simple string property. + public string Name { get; } + + /// An integer property. + public int Age { get; } + + /// A boolean property. + public bool Enabled { get; } + + /// A float property. + public float Score { get; } + + /// An optional string. + public string OptionalString { get; } + + /// An optional integer. + public int? OptionalInt { get; } + + /// A nullable string. + public string NullableString { get; } + + /// A string as XML attribute. + public string Id { get; } + + /// An integer as XML attribute. + public int Version { get; } + + /// A boolean as XML attribute. + public bool IsActive { get; } + + /// A property with a custom XML element name. + public string OriginalName { get; } + + /// An attribute with a custom XML name. + public string XmlIdentifier { get; } + + /// Text content in the element (unwrapped string). + public string Content { get; } + + /// An unwrapped array of strings - items appear directly without wrapper. + public IList UnwrappedStrings { get; } + + /// An unwrapped array of integers. + public IList UnwrappedCounts { get; } + + /// An unwrapped array of models. + public IList UnwrappedItems { get; } + + /// A wrapped array of strings (default). + public IList WrappedColors { get; } + + /// A wrapped array with custom wrapper name. + public IList Items { get; } + + /// A nested model property. + public XmlNestedModel NestedModel { get; } + + /// An optional nested model. + public XmlNestedModel OptionalNestedModel { get; } + + /// A dictionary property. + public IDictionary Metadata { get; } + + /// A date-time property. + public DateTimeOffset CreatedAt { get; } + + /// A duration property. + public TimeSpan Duration { get; } + + /// + /// A bytes property + /// + /// To assign a byte[] to this property use . + /// The byte[] will be serialized to a Base64 encoded string. + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromBytes(new byte[] { 1, 2, 3 }). + /// Creates a payload of "AQID". + /// + /// + /// + /// + public BinaryData Data { get; } + + /// + /// optional record of unknown + /// To assign an object to the value of this property use . + /// To assign an already formatted json string to this property use . + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo"). + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\""). + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }). + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}"). + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IDictionary OptionalRecordUnknown { get; } + + /// A fixed enum property. + public StringFixedEnum FixedEnum { get; } + + /// An extensible enum property. + public StringExtensibleEnum ExtensibleEnum { get; } + + /// An optional fixed enum property. + public IntFixedEnum? OptionalFixedEnum { get; } + + /// An optional extensible enum property. + public IntExtensibleEnum? OptionalExtensibleEnum { get; } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.Serialization.cs new file mode 100644 index 00000000000..4ff55dda314 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.Serialization.cs @@ -0,0 +1,155 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// An item model for XML array testing. + public partial class XmlItem : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal XmlItem() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlItem)} does not support writing '{format}' format."); + } + writer.WritePropertyName("itemName"u8); + writer.WriteStringValue(ItemName); + writer.WritePropertyName("itemValue"u8); + writer.WriteNumberValue(ItemValue); + writer.WritePropertyName("itemId"u8); + writer.WriteStringValue(ItemId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + XmlItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual XmlItem JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlItem)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeXmlItem(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static XmlItem DeserializeXmlItem(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itemName = default; + int itemValue = default; + string itemId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("itemName"u8)) + { + itemName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("itemValue"u8)) + { + itemValue = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("itemId"u8)) + { + itemId = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new XmlItem(itemName, itemValue, itemId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(XmlItem)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + XmlItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlItem PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeXmlItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(XmlItem)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.cs new file mode 100644 index 00000000000..e291e9324a7 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlItem.cs @@ -0,0 +1,49 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// An item model for XML array testing. + public partial class XmlItem + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The item name. + /// The item value. + /// Item ID as attribute. + internal XmlItem(string itemName, int itemValue, string itemId) + { + ItemName = itemName; + ItemValue = itemValue; + ItemId = itemId; + } + + /// Initializes a new instance of . + /// The item name. + /// The item value. + /// Item ID as attribute. + /// Keeps track of any properties unknown to the library. + internal XmlItem(string itemName, int itemValue, string itemId, IDictionary additionalBinaryDataProperties) + { + ItemName = itemName; + ItemValue = itemValue; + ItemId = itemId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The item name. + public string ItemName { get; } + + /// The item value. + public int ItemValue { get; } + + /// Item ID as attribute. + public string ItemId { get; } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.Serialization.cs new file mode 100644 index 00000000000..9f463bc25fb --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.Serialization.cs @@ -0,0 +1,147 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// A nested model for XML testing. + public partial class XmlNestedModel : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal XmlNestedModel() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlNestedModel)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + writer.WritePropertyName("nestedId"u8); + writer.WriteNumberValue(NestedId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + XmlNestedModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual XmlNestedModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlNestedModel)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeXmlNestedModel(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static XmlNestedModel DeserializeXmlNestedModel(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + int nestedId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + value = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("nestedId"u8)) + { + nestedId = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new XmlNestedModel(value, nestedId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(XmlNestedModel)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + XmlNestedModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlNestedModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeXmlNestedModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(XmlNestedModel)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.cs new file mode 100644 index 00000000000..ff4f7c80a97 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlNestedModel.cs @@ -0,0 +1,42 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// A nested model for XML testing. + public partial class XmlNestedModel + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The value of the nested model. + /// An attribute on the nested model. + internal XmlNestedModel(string value, int nestedId) + { + Value = value; + NestedId = nestedId; + } + + /// Initializes a new instance of . + /// The value of the nested model. + /// An attribute on the nested model. + /// Keeps track of any properties unknown to the library. + internal XmlNestedModel(string value, int nestedId, IDictionary additionalBinaryDataProperties) + { + Value = value; + NestedId = nestedId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The value of the nested model. + public string Value { get; } + + /// An attribute on the nested model. + public int NestedId { get; } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.RestClient.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.RestClient.cs new file mode 100644 index 00000000000..b239f96c136 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.RestClient.cs @@ -0,0 +1,28 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace SampleTypeSpec +{ + /// + public partial class PlantOperations + { + private static PipelineMessageClassifier _pipelineMessageClassifier200; + + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + + internal PipelineMessage CreateGetTreeRequest(RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/plants/tree/as-plant", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200); + PipelineRequest request = message.Request; + request.Headers.Set("Accept", "application/xml"); + message.Apply(options); + return message; + } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.cs new file mode 100644 index 00000000000..cecc2329768 --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/PlantOperations.cs @@ -0,0 +1,139 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; + +namespace SampleTypeSpec +{ + /// The PlantOperations sub-client. + public partial class PlantOperations + { + private readonly Uri _endpoint; + + /// Initializes a new instance of PlantOperations for mocking. + protected PlantOperations() + { + } + + /// Initializes a new instance of PlantOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + internal PlantOperations(ClientPipeline pipeline, Uri endpoint) + { + _endpoint = endpoint; + Pipeline = pipeline; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } + + /// + /// [Protocol Method] Get a tree as a plant + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetTree(RequestOptions options) + { + try + { + System.Console.WriteLine("Entering method GetTree."); + using PipelineMessage message = CreateGetTreeRequest(options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetTree: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetTree."); + } + } + + /// + /// [Protocol Method] Get a tree as a plant + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetTreeAsync(RequestOptions options) + { + try + { + System.Console.WriteLine("Entering method GetTreeAsync."); + using PipelineMessage message = CreateGetTreeRequest(options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetTreeAsync: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetTreeAsync."); + } + } + + /// Get a tree as a plant. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual ClientResult GetTree(CancellationToken cancellationToken = default) + { + try + { + System.Console.WriteLine("Entering method GetTree."); + ClientResult result = GetTree(cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null); + return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetTree: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetTree."); + } + } + + /// Get a tree as a plant. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task> GetTreeAsync(CancellationToken cancellationToken = default) + { + try + { + System.Console.WriteLine("Entering method GetTreeAsync."); + ClientResult result = await GetTreeAsync(cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false); + return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetTreeAsync: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetTreeAsync."); + } + } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.RestClient.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.RestClient.cs index 6037a87bb26..8b916e68004 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.RestClient.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.RestClient.cs @@ -403,5 +403,17 @@ internal PipelineMessage CreateDynamicModelOperationRequest(BinaryContent conten message.Apply(options); return message; } + + internal PipelineMessage CreateGetXmlAdvancedModelRequest(RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/xmlAdvanced", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200); + PipelineRequest request = message.Request; + request.Headers.Set("Accept", "application/xml"); + message.Apply(options); + return message; + } } } diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.cs index 3fe80eeac86..b33976451bc 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.cs @@ -35,6 +35,7 @@ public partial class SampleTypeSpecClient private AnimalOperations _cachedAnimalOperations; private PetOperations _cachedPetOperations; private DogOperations _cachedDogOperations; + private PlantOperations _cachedPlantOperations; private Metrics _cachedMetrics; /// Initializes a new instance of SampleTypeSpecClient for mocking. @@ -3033,6 +3034,110 @@ public virtual async Task DynamicModelOperationAsync(DynamicModel } } + /// + /// [Protocol Method] Get an advanced XML model with various property types + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetXmlAdvancedModel(RequestOptions options) + { + try + { + System.Console.WriteLine("Entering method GetXmlAdvancedModel."); + using PipelineMessage message = CreateGetXmlAdvancedModelRequest(options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModel: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetXmlAdvancedModel."); + } + } + + /// + /// [Protocol Method] Get an advanced XML model with various property types + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetXmlAdvancedModelAsync(RequestOptions options) + { + try + { + System.Console.WriteLine("Entering method GetXmlAdvancedModelAsync."); + using PipelineMessage message = CreateGetXmlAdvancedModelRequest(options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModelAsync: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetXmlAdvancedModelAsync."); + } + } + + /// Get an advanced XML model with various property types. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual ClientResult GetXmlAdvancedModel(CancellationToken cancellationToken = default) + { + try + { + System.Console.WriteLine("Entering method GetXmlAdvancedModel."); + ClientResult result = GetXmlAdvancedModel(cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null); + return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModel: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetXmlAdvancedModel."); + } + } + + /// Get an advanced XML model with various property types. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task> GetXmlAdvancedModelAsync(CancellationToken cancellationToken = default) + { + try + { + System.Console.WriteLine("Entering method GetXmlAdvancedModelAsync."); + ClientResult result = await GetXmlAdvancedModelAsync(cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false); + return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + } + catch (Exception ex) + { + System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModelAsync: {ex}"); + throw; + } + finally + { + System.Console.WriteLine("Exiting method GetXmlAdvancedModelAsync."); + } + } + /// Initializes a new instance of AnimalOperations. public virtual AnimalOperations GetAnimalOperationsClient() { @@ -3051,6 +3156,12 @@ public virtual DogOperations GetDogOperationsClient() return Volatile.Read(ref _cachedDogOperations) ?? Interlocked.CompareExchange(ref _cachedDogOperations, new DogOperations(Pipeline, _endpoint), null) ?? _cachedDogOperations; } + /// Initializes a new instance of PlantOperations. + public virtual PlantOperations GetPlantOperationsClient() + { + return Volatile.Read(ref _cachedPlantOperations) ?? Interlocked.CompareExchange(ref _cachedPlantOperations, new PlantOperations(Pipeline, _endpoint), null) ?? _cachedPlantOperations; + } + /// Initializes a new instance of Metrics. public virtual Metrics GetMetricsClient() { diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs index ff9639bb364..9ca34c32df1 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs @@ -240,6 +240,99 @@ public static AnotherDynamicModel AnotherDynamicModel(string bar = default) return new AnotherDynamicModel(bar, additionalBinaryDataProperties: null); } + /// An advanced XML model for testing various property types and XML features. + /// A simple string property. + /// An integer property. + /// A boolean property. + /// A float property. + /// An optional string. + /// An optional integer. + /// A nullable string. + /// A string as XML attribute. + /// An integer as XML attribute. + /// A boolean as XML attribute. + /// A property with a custom XML element name. + /// An attribute with a custom XML name. + /// Text content in the element (unwrapped string). + /// An unwrapped array of strings - items appear directly without wrapper. + /// An unwrapped array of integers. + /// An unwrapped array of models. + /// A wrapped array of strings (default). + /// A wrapped array with custom wrapper name. + /// A nested model property. + /// An optional nested model. + /// A dictionary property. + /// A date-time property. + /// A duration property. + /// A bytes property. + /// optional record of unknown. + /// A fixed enum property. + /// An extensible enum property. + /// An optional fixed enum property. + /// An optional extensible enum property. + /// A new instance for mocking. + public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = default, bool enabled = default, float score = default, string optionalString = default, int? optionalInt = default, string nullableString = default, string id = default, int version = default, bool isActive = default, string originalName = default, string xmlIdentifier = default, string content = default, IEnumerable unwrappedStrings = default, IEnumerable unwrappedCounts = default, IEnumerable unwrappedItems = default, IEnumerable wrappedColors = default, IEnumerable items = default, XmlNestedModel nestedModel = default, XmlNestedModel optionalNestedModel = default, IDictionary metadata = default, DateTimeOffset createdAt = default, TimeSpan duration = default, BinaryData data = default, IDictionary optionalRecordUnknown = default, StringFixedEnum fixedEnum = default, StringExtensibleEnum extensibleEnum = default, IntFixedEnum? optionalFixedEnum = default, IntExtensibleEnum? optionalExtensibleEnum = default) + { + unwrappedStrings ??= new ChangeTrackingList(); + unwrappedCounts ??= new ChangeTrackingList(); + unwrappedItems ??= new ChangeTrackingList(); + wrappedColors ??= new ChangeTrackingList(); + items ??= new ChangeTrackingList(); + metadata ??= new ChangeTrackingDictionary(); + optionalRecordUnknown ??= new ChangeTrackingDictionary(); + + return new XmlAdvancedModel( + name, + age, + enabled, + score, + optionalString, + optionalInt, + nullableString, + id, + version, + isActive, + originalName, + xmlIdentifier, + content, + unwrappedStrings.ToList(), + unwrappedCounts.ToList(), + unwrappedItems.ToList(), + wrappedColors.ToList(), + items.ToList(), + nestedModel, + optionalNestedModel, + metadata, + createdAt, + duration, + data, + optionalRecordUnknown, + fixedEnum, + extensibleEnum, + optionalFixedEnum, + optionalExtensibleEnum, + additionalBinaryDataProperties: null); + } + + /// An item model for XML array testing. + /// The item name. + /// The item value. + /// Item ID as attribute. + /// A new instance for mocking. + public static XmlItem XmlItem(string itemName = default, int itemValue = default, string itemId = default) + { + return new XmlItem(itemName, itemValue, itemId, additionalBinaryDataProperties: null); + } + + /// A nested model for XML testing. + /// The value of the nested model. + /// An attribute on the nested model. + /// A new instance for mocking. + public static XmlNestedModel XmlNestedModel(string value = default, int nestedId = default) + { + return new XmlNestedModel(value, nestedId, additionalBinaryDataProperties: null); + } + /// /// Base animal with discriminator /// Please note this is the abstract base class. The derived classes available for instantiation are: and . @@ -271,6 +364,29 @@ public static Dog Dog(string name = default, bool trained = default, string bree return new Dog("pet", name, additionalBinaryDataProperties: null, trained, breed); } + /// Tree is a specific type of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// The age of the tree in years. + /// A new instance for mocking. + public static Tree Tree(string id = default, int height = default, int age = default) + { + return new Tree("tree", id, height, additionalBinaryDataProperties: null, age); + } + + /// + /// Base plant with discriminator + /// Please note this is the abstract base class. The derived classes available for instantiation are: . + /// + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// A new instance for mocking. + public static Plant Plant(string species = default, string id = default, int height = default) + { + return new UnknownPlant(species, id, height, additionalBinaryDataProperties: null); + } + /// The GetWidgetMetricsResponse. /// /// diff --git a/docs/samples/client/csharp/SampleService/main.tsp b/docs/samples/client/csharp/SampleService/main.tsp index e93467b99b1..776307135b9 100644 --- a/docs/samples/client/csharp/SampleService/main.tsp +++ b/docs/samples/client/csharp/SampleService/main.tsp @@ -1,5 +1,6 @@ import "@typespec/rest"; import "@typespec/http"; +import "@typespec/xml"; import "@typespec/http-client-csharp"; import "@azure-tools/typespec-client-generator-core"; import "@azure-tools/typespec-azure-core"; @@ -20,6 +21,7 @@ namespace SampleTypeSpec; using TypeSpec.Http; using TypeSpec.Versioning; using TypeSpec.HttpClient.CSharp; +using TypeSpec.Xml; using Azure.ClientGenerator.Core; alias SampleOAuth2 = OAuth2Auth<[ @@ -309,6 +311,132 @@ model AnotherDynamicModel { bar: string; } +@doc("An advanced XML model for testing various property types and XML features.") +@Xml.name("AdvancedXmlModel") +model XmlAdvancedModel { + @doc("A simple string property") + name: string; + + @doc("An integer property") + age: int32; + + @doc("A boolean property") + enabled: boolean; + + @doc("A float property") + score: float32; + + @doc("An optional string") + optionalString?: string; + + @doc("An optional integer") + optionalInt?: int32; + + @doc("A nullable string") + nullableString: string | null; + + @doc("A string as XML attribute") + @attribute + id: string; + + @doc("An integer as XML attribute") + @attribute + version: int32; + + @doc("A boolean as XML attribute") + @attribute + isActive: boolean; + + @doc("A property with a custom XML element name") + @Xml.name("RenamedProperty") + originalName: string; + + @doc("An attribute with a custom XML name") + @attribute + @Xml.name("xml-id") + xmlIdentifier: string; + + @doc("Text content in the element (unwrapped string)") + @unwrapped + content: string; + + @doc("An unwrapped array of strings - items appear directly without wrapper") + @unwrapped + unwrappedStrings: string[]; + + @doc("An unwrapped array of integers") + @unwrapped + unwrappedCounts: int32[]; + + @doc("An unwrapped array of models") + @unwrapped + unwrappedItems: XmlItem[]; + + @doc("A wrapped array of strings (default)") + wrappedColors: string[]; + + @doc("A wrapped array with custom wrapper name") + @Xml.name("ItemCollection") + items: XmlItem[]; + + @doc("A nested model property") + nestedModel: XmlNestedModel; + + @doc("An optional nested model") + optionalNestedModel?: XmlNestedModel; + + @doc("A dictionary property") + metadata: Record; + + @doc("A date-time property") + createdAt: utcDateTime; + + @doc("A duration property") + duration: duration; + + @doc("A bytes property") + data: bytes; + + @doc("optional record of unknown") + optionalRecordUnknown?: Record; + + @doc("A fixed enum property") + fixedEnum: StringFixedEnum; + + @doc("An extensible enum property") + extensibleEnum: StringExtensibleEnum; + + @doc("An optional fixed enum property") + optionalFixedEnum?: IntFixedEnum; + + @doc("An optional extensible enum property") + optionalExtensibleEnum?: IntExtensibleEnum; +} + +@doc("A nested model for XML testing") +model XmlNestedModel { + @doc("The value of the nested model") + value: string; + + @doc("An attribute on the nested model") + @attribute + nestedId: int32; +} + +@doc("An item model for XML array testing") +@Xml.name("Item") +model XmlItem { + @doc("The item name") + itemName: string; + + @doc("The item value") + itemValue: int32; + + @doc("Item ID as attribute") + @attribute + itemId: string; +} + union DaysOfWeekExtensibleEnum { string, Monday: "Monday", @@ -513,6 +641,14 @@ op EmbeddedParameters(@bodyRoot body: ModelWithEmbeddedNonBodyParameters): void; @post op DynamicModelOperation(@body body: DynamicModel): void; +@route("xmlAdvanced") +@doc("Get an advanced XML model with various property types") +@get +op GetXmlAdvancedModel(): { + @header contentType: "application/xml"; + @body body: XmlAdvancedModel; +}; + @doc("Base animal with discriminator") @discriminator("kind") model Animal { @@ -581,6 +717,38 @@ interface DogOperations { updateDogAsDog(@body dog: Dog): Dog; } +@doc("Base plant with discriminator") +@discriminator("species") +model Plant { + @doc("The species of plant") + species: string; + + @doc("The unique identifier of the plant") + id: string; + + @doc("The height of the plant in centimeters") + height: int32; +} + +@doc("Tree is a specific type of plant") +model Tree extends Plant { + species: "tree"; + + @doc("The age of the tree in years") + age: int32; +} + +@route("/plants") +interface PlantOperations { + @doc("Get a tree as a plant") + @get + @route("/tree/as-plant") + getTree(): { + @header contentType: "application/xml"; + @body body: Tree; + }; +} + @clientInitialization({ initializedBy: InitializedBy.individually | InitializedBy.parent, }) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmKnownParameters.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmKnownParameters.cs index bfbefd24fbb..9ff28ed9363 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmKnownParameters.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmKnownParameters.cs @@ -21,7 +21,6 @@ internal static class ScmKnownParameters public static readonly ParameterProvider XmlWriter = new("writer", FormattableStringHelpers.Empty, typeof(XmlWriter)); public static readonly ParameterProvider NameHint = new("nameHint", FormattableStringHelpers.Empty, typeof(string)); - public static readonly ParameterProvider XElement = new("element", FormattableStringHelpers.Empty, typeof(XElement)); public static readonly ParameterProvider Utf8JsonWriter = new("writer", FormattableStringHelpers.Empty, typeof(Utf8JsonWriter)); public static readonly ParameterProvider Utf8JsonReader = new("reader", FormattableStringHelpers.Empty, typeof(Utf8JsonReader), isRef: true); public static readonly ParameterProvider JsonOptions = new("options", FormattableStringHelpers.Empty, typeof(JsonSerializerOptions)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs new file mode 100644 index 00000000000..98703cd546c --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.Xml.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.ClientModel.Snippets; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Snippets; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Providers +{ + public sealed partial class ModelSerializationExtensionsDefinition + { + private readonly ParameterProvider _xElementParameter = + new ParameterProvider("element", FormattableStringHelpers.Empty, typeof(XElement)); + + private MethodProvider[] BuildXmlExtensionMethods() + { + if (!ScmCodeModelGenerator.Instance.InputLibrary.HasXmlModelSerialization) + { + return []; + } + + return + [ + BuildXmlGetDateTimeOffsetMethodProvider(), + BuildXmlGetTimeSpanMethodProvider(), + BuildXmlGetBytesFromBase64MethodProvider() + ]; + } + + private MethodProvider BuildXmlGetDateTimeOffsetMethodProvider() + { + var signature = new MethodSignature( + Name: _getDateTimeOffsetMethodName, + Modifiers: _methodModifiers, + Parameters: [_xElementParameter, _formatParameter], + ReturnType: typeof(DateTimeOffset), + Description: null, + ReturnDescription: null); + + var element = _xElementParameter.As(); + var body = new SwitchExpression( + _formatParameter, + new SwitchCaseExpression(Literal("U"), DateTimeOffsetSnippets.FromUnixTimeSeconds(element.CastTo(typeof(long)))), + SwitchCaseExpression.Default(TypeFormattersSnippets.ParseDateTimeOffset(element.Value(), _formatParameter))); + + return new MethodProvider(signature, body, this, XmlDocProvider.Empty); + } + + private MethodProvider BuildXmlGetTimeSpanMethodProvider() + { + var signature = new MethodSignature( + Name: _getTimeSpanMethodName, + Modifiers: _methodModifiers, + Parameters: [_xElementParameter, _formatParameter], + ReturnType: typeof(TimeSpan), + Description: null, + ReturnDescription: null); + + var element = _xElementParameter.As(); + var body = TypeFormattersSnippets.ParseTimeSpan(element.Value(), _formatParameter); + + return new MethodProvider(signature, body, this, XmlDocProvider.Empty); + } + + private MethodProvider BuildXmlGetBytesFromBase64MethodProvider() + { + var signature = new MethodSignature( + Name: _getBytesFromBase64MethodName, + Modifiers: _methodModifiers, + Parameters: [_xElementParameter, _formatParameter], + ReturnType: typeof(byte[]), + Description: null, + ReturnDescription: null); + + var element = _xElementParameter.As(); + var body = new SwitchExpression( + _formatParameter, + new SwitchCaseExpression(Literal("U"), TypeFormattersSnippets.FromBase64UrlString(element.Value())), + new SwitchCaseExpression(Literal("D"), Static(typeof(Convert)).Invoke(nameof(Convert.FromBase64String), element.Value())), + SwitchCaseExpression.Default(ThrowExpression(New.ArgumentException(_formatParameter, Literal("Format is not supported: "), true)))); + + return new MethodProvider(signature, body, this, XmlDocProvider.Empty); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs index 5a839f27088..2b1ecb328f4 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs @@ -8,7 +8,6 @@ using System.Diagnostics; using System.Globalization; using System.IO; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using System.Text.Json; @@ -23,7 +22,7 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Providers { - public sealed class ModelSerializationExtensionsDefinition : TypeProvider + public sealed partial class ModelSerializationExtensionsDefinition : TypeProvider { public const string WireOptionsFieldName = "WireOptions"; public const string JsonDocumentOptionsFieldName = "JsonDocumentOptions"; @@ -158,7 +157,8 @@ protected override MethodProvider[] BuildMethods() BuildWriteObjectValueMethodGeneric(), BuildWriteObjectValueMethodProvider(), BuildGetUtf8BytesMethodProvider(), - .. BuildDynamicModelHelpers() + .. BuildDynamicModelHelpers(), + .. BuildXmlExtensionMethods() ]; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Dynamic.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Dynamic.cs index c62dfd0df8b..609019fa210 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Dynamic.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Dynamic.cs @@ -503,14 +503,14 @@ private static string BuildJsonPathForElement(string propertySerializedName, Lis private static ValueExpression GetDeserializationMethodInvocationForType( ModelProvider model, - ScopedApi jsonElementVariable, + ScopedApi element, ValueExpression? dataVariable = null, ValueExpression? optionsVariable = null) { optionsVariable ??= ModelSerializationExtensionsSnippets.Wire; return model is ScmModelProvider { IsDynamicModel: true } - ? model.Type.Deserialize(jsonElementVariable, dataVariable, optionsVariable) - : model.Type.Deserialize(jsonElementVariable, null, optionsVariable); + ? model.Type.Deserialize(element, dataVariable, optionsVariable) + : model.Type.Deserialize(element, null, optionsVariable); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs new file mode 100644 index 00000000000..52a770e8a6a --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.ClientModel.Snippets; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Snippets; +using Microsoft.TypeSpec.Generator.SourceInput; +using Microsoft.TypeSpec.Generator.Statements; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Providers +{ + public partial class MrwSerializationTypeDefinition + { + private readonly ParameterProvider _xElementDeserializationParam = new("element", $"The xml element to deserialize.", typeof(XElement)); + private readonly ScopedApi _xmlElementParameterSnippet; + + /// + /// Represents a property that can be deserialized from XML, categorized by its serialization type. + /// + private record XmlPropertyInfo( + string PropertyName, + CSharpType PropertyType, + VariableExpression PropertyExpression, + XmlWireInformation XmlWireInfo, + SerializationFormat SerializationFormat, + IEnumerable SerializationAttributes); + + /// + /// Categorized XML properties for deserialization. + /// + private record XmlPropertyCategories( + List? AttributeProperties, + List? ElementProperties, + XmlPropertyInfo? TextContentProperty); + + internal MethodProvider BuildXmlDeserializationMethod() + { + var methodName = $"{DeserializationMethodNamePrefix}{_model.Name}"; + var signatureModifiers = MethodSignatureModifiers.Internal | MethodSignatureModifiers.Static; + var parameters = new List + { + _xElementDeserializationParam, + _serializationOptionsParameter, + }; + + var methodBody = _inputModel.DiscriminatedSubtypes.Count > 0 + ? BuildXmlDiscriminatedModelDeserializationMethodBody() + : BuildXmlDeserializationMethodBody(); + + return new MethodProvider( + new MethodSignature(methodName, null, signatureModifiers, _model.Type, null, parameters), + methodBody, + this); + } + + private MethodBodyStatement[] BuildXmlDiscriminatedModelDeserializationMethodBody() + { + var unknownVariant = _model.DerivedModels.First(m => m.IsUnknownDiscriminatorModel); + bool onlyContainsUnknownDerivedModel = _model.DerivedModels.Count == 1; + var discriminator = _model.CanonicalView.Properties.Where(p => p.IsDiscriminator).FirstOrDefault(); + if (discriminator == null && _model.BaseModelProvider != null) + { + // Look for discriminator property in the base model + discriminator = _model.BaseModelProvider.CanonicalView.Properties.Where(p => p.IsDiscriminator).FirstOrDefault(); + } + + var deserializeDiscriminatedModelsConditions = BuildXmlDiscriminatedModelsCondition( + discriminator, + GetXmlDiscriminatorSwitchCases(unknownVariant), + onlyContainsUnknownDerivedModel, + _xmlElementParameterSnippet); + + return + [ + new IfStatement(_xmlElementParameterSnippet.Equal(Null)) { Return(Null) }, + MethodBodyStatement.EmptyLine, + deserializeDiscriminatedModelsConditions, + Return(GetDeserializationMethodInvocationForType(unknownVariant, _xmlElementParameterSnippet, null, _serializationOptionsParameter)) + ]; + } + + private static MethodBodyStatement BuildXmlDiscriminatedModelsCondition( + PropertyProvider? discriminatorProperty, + SwitchCaseStatement[] abstractSwitchCases, + bool onlyContainsUnknownDerivedModel, + ScopedApi elementParameter) + { + if (!onlyContainsUnknownDerivedModel && discriminatorProperty?.WireInfo?.XmlWireInformation?.Name != null) + { + var discriminatorElementName = discriminatorProperty.WireInfo.XmlWireInformation.Name; + var discriminatorElement = new VariableExpression(typeof(XElement), "discriminatorElement"); + + return new MethodBodyStatements( + [ + Declare(discriminatorElement, elementParameter.Element(Literal(discriminatorElementName))), + new IfStatement(discriminatorElement.NotEqual(Null)) + { + new SwitchStatement(discriminatorElement.CastTo(typeof(string)), abstractSwitchCases) + } + ]); + } + + return MethodBodyStatement.Empty; + } + + private SwitchCaseStatement[] GetXmlDiscriminatorSwitchCases(ModelProvider unknownVariant) + { + SwitchCaseStatement[] cases = new SwitchCaseStatement[_model.DerivedModels.Count - 1]; + int index = 0; + for (int i = 0; i < _model.DerivedModels.Count; i++) + { + var model = _model.DerivedModels[i]; + if (ReferenceEquals(model, unknownVariant)) + { + continue; + } + cases[index++] = new SwitchCaseStatement( + Literal(model.DiscriminatorValue!), + Return(GetDeserializationMethodInvocationForType(model, _xmlElementParameterSnippet, _dataParameter, _serializationOptionsParameter))); + } + return cases; + } + + private MethodBodyStatement[] BuildXmlDeserializationMethodBody() + { + var valueKindEqualsNullReturn = _isStruct + ? Return(Default) + : Return(Null); + + var categorizedProperties = CategorizeXmlProperties(); + var statements = new List + { + new IfStatement(_xmlElementParameterSnippet.Equal(Null)) { valueKindEqualsNullReturn }, + MethodBodyStatement.EmptyLine, + GetPropertyVariableDeclarations(), + MethodBodyStatement.EmptyLine + }; + + if (categorizedProperties.AttributeProperties?.Count > 0) + { + statements.Add(CreateXmlDeserializeForEachStatement( + _xmlElementParameterSnippet, + categorizedProperties.AttributeProperties, + isAttributes: true)); + statements.Add(MethodBodyStatement.EmptyLine); + } + + if (categorizedProperties.ElementProperties?.Count > 0) + { + statements.Add(CreateXmlDeserializeForEachStatement( + _xmlElementParameterSnippet, + categorizedProperties.ElementProperties, + isAttributes: false)); + } + + if (categorizedProperties.TextContentProperty != null) + { + statements.Add(categorizedProperties.TextContentProperty.PropertyExpression.Assign(_xmlElementParameterSnippet.Value()).Terminate()); + statements.Add(MethodBodyStatement.EmptyLine); + } + + statements.Add(Return(New.Instance(_model.Type, GetSerializationCtorParameterValues()))); + + return [.. statements]; + } + + private XmlPropertyCategories CategorizeXmlProperties() + { + List? attributeProperties = null; + List? elementProperties = null; + XmlPropertyInfo? textContentProperty = null; + + var parameters = SerializationConstructor.Signature.Parameters; + + // Get the custom serialization attributes + var serializationAttributes = GetSerializationAttributes(); + + for (int i = 0; i < parameters.Count; i++) + { + var parameter = parameters[i]; + if (parameter.Property == null && parameter.Field == null) + { + continue; + } + + var wireInfo = parameter.Property?.WireInfo ?? parameter.Field?.WireInfo; + var xmlWireInfo = wireInfo?.XmlWireInformation; + if (xmlWireInfo == null || wireInfo?.IsHttpMetadata == true) + { + continue; + } + + var propertyType = parameter.Property?.Type ?? parameter.Field?.Type; + var propertyExpression = parameter.Property?.AsVariableExpression ?? parameter.Field?.AsVariableExpression; + var propertyName = parameter.Property?.Name ?? parameter.Field?.Name; + if (propertyType == null || propertyExpression == null || propertyName == null) + { + continue; + } + + var serializationFormat = wireInfo?.SerializationFormat ?? SerializationFormat.Default; + var propertyInfo = new XmlPropertyInfo(propertyName, propertyType, propertyExpression, xmlWireInfo, serializationFormat, serializationAttributes); + + // Categorize by XML serialization type + if (xmlWireInfo.Attribute == true) + { + (attributeProperties ??= []).Add(propertyInfo); + continue; + } + if (xmlWireInfo.Unwrapped == true && !propertyType.IsCollection) + { + textContentProperty = propertyInfo; + continue; + } + + (elementProperties ??= []).Add(propertyInfo); + } + + return new XmlPropertyCategories(attributeProperties, elementProperties, textContentProperty); + } + + private ForEachStatement CreateXmlDeserializeForEachStatement( + ScopedApi elementParameter, + List properties, + bool isAttributes) + { + return isAttributes switch + { + true => new ForEachStatement("attr", elementParameter.Attributes(), out var attr) + { + CreateXmlDeserializeAttributeStatements(attr.As(), properties) + }, + false => new ForEachStatement("child", elementParameter.Elements(), out var child) + { + CreateXmlDeserializeElementStatements(child.As(), properties) + } + }; + } + + private MethodBodyStatement CreateXmlDeserializeElementStatements( + ScopedApi childElement, + List elementProperties) + { + var statements = new List(); + var localNameVariable = new VariableExpression(typeof(string), "localName"); + + statements.Add(Declare(localNameVariable, childElement.GetLocalName())); + + foreach (var prop in elementProperties) + { + MethodBodyStatement deserializationStatement = GetXmlDeserializationHookStatement( + prop.PropertyName, + prop.SerializationAttributes, + childElement, + prop.PropertyExpression, + out bool hasHook); + + if (!hasHook) + { + deserializationStatement = CreateXmlDeserializePropertyAssignment( + childElement, + prop.PropertyType, + prop.PropertyExpression, + prop.XmlWireInfo, + prop.SerializationFormat); + } + + var checkIfLocalNameEquals = new IfStatement(localNameVariable.Equal(Literal(prop.XmlWireInfo.Name))) + { + deserializationStatement, + Continue + }; + + statements.Add(checkIfLocalNameEquals); + } + + return statements; + } + + private static MethodBodyStatement GetXmlDeserializationHookStatement( + string propertyName, + IEnumerable serializationAttributes, + ValueExpression xmlValue, + VariableExpression variableExpression, + out bool hasHook) + { + hasHook = false; + foreach (var attribute in serializationAttributes) + { + if (CodeGenAttributes.TryGetCodeGenSerializationAttributeValue( + attribute, + out var name, + out _, + out _, + out var deserializationHook, + out _) && name == propertyName && deserializationHook != null) + { + hasHook = true; + return Static().Invoke(deserializationHook, xmlValue, ByRef(variableExpression)).Terminate(); + } + } + + return MethodBodyStatement.Empty; + } + + private MethodBodyStatement CreateXmlDeserializePropertyAssignment( + ScopedApi childElement, + CSharpType propertyType, + VariableExpression propertyExpression, + XmlWireInformation xmlWireInfo, + SerializationFormat serializationFormat) + { + if (propertyType.IsList || propertyType.IsArray) + { + return CreateXmlDeserializeListAssignment(childElement, propertyType, propertyExpression, xmlWireInfo, serializationFormat); + } + + if (propertyType.IsDictionary) + { + return CreateXmlDeserializeDictionaryAssignment(childElement, propertyType, propertyExpression, xmlWireInfo, serializationFormat); + } + + var deserializedValue = CreateXmlDeserializeValueExpression(childElement, propertyType, serializationFormat); + return propertyExpression.Assign(deserializedValue).Terminate(); + } + + private MethodBodyStatement CreateXmlDeserializeListAssignment( + ScopedApi childElement, + CSharpType listType, + VariableExpression listExpression, + XmlWireInformation xmlWireInfo, + SerializationFormat serializationFormat) + { + var elementType = listType.ElementType; + if (xmlWireInfo.Unwrapped == true) + { + return new MethodBodyStatements( + [ + new IfStatement(listExpression.Equal(Null)) + { + listExpression.Assign(New.List(elementType)).Terminate(), + }, + DeserializeXmlValue(childElement, elementType, serializationFormat, out var itemValue), + listExpression.Invoke("Add", itemValue).Terminate() + ]); + } + else + { + var itemsName = xmlWireInfo.ItemsName; + var arrayDeclaration = Declare("array", New.List(elementType), out var listVariable); + var foreachStatement = ForEachStatement.Create("e", childElement.Elements(Literal(itemsName)), out ScopedApi item) + .Add(new MethodBodyStatement[] + { + DeserializeXmlValue(item, elementType, serializationFormat, out var deserializedItem), + listVariable.Add(deserializedItem) + }); + + return new MethodBodyStatements( + [ + arrayDeclaration, + foreachStatement, + listExpression.Assign(listVariable).Terminate() + ]); + } + } + + private MethodBodyStatement CreateXmlDeserializeDictionaryAssignment( + ScopedApi childElement, + CSharpType dictionaryType, + VariableExpression dictionaryExpression, + XmlWireInformation xmlWireInfo, + SerializationFormat serializationFormat) + { + var valueType = dictionaryType.ElementType; + if (xmlWireInfo.Unwrapped == true) + { + return new MethodBodyStatements( + [ + new IfStatement(dictionaryExpression.Equal(Null)) + { + dictionaryExpression.Assign(New.Dictionary(dictionaryType.Arguments[0], dictionaryType.Arguments[1])).Terminate(), + }, + CreateXmlDeserializeDictionaryValueStatement(valueType, dictionaryExpression, childElement, serializationFormat) + ]); + } + + var dictionaryDeclaration = Declare( + "dictionary", + New.Dictionary(dictionaryType.Arguments[0], dictionaryType.Arguments[1]), + out var dictVariable); + + var foreachStatement = ForEachStatement.Create("e", childElement.Elements(), out ScopedApi item) + .Add(new MethodBodyStatement[] + { + CreateXmlDeserializeDictionaryValueStatement(valueType, dictVariable, item, serializationFormat) + }); + + return new MethodBodyStatements( + [ + dictionaryDeclaration, + foreachStatement, + dictionaryExpression.Assign(dictVariable).Terminate() + ]); + } + + private MethodBodyStatement CreateXmlDeserializeDictionaryValueStatement( + CSharpType valueType, + ValueExpression dictionary, + ScopedApi element, + SerializationFormat serializationFormat) + { + return new MethodBodyStatement[] + { + DeserializeXmlValue(element, valueType, serializationFormat, out var value), + dictionary.Invoke("Add", element.GetLocalName(), value).Terminate() + }; + } + + private MethodBodyStatement DeserializeXmlValue( + ScopedApi element, + CSharpType valueType, + SerializationFormat serializationFormat, + out ValueExpression value) + { + if (valueType.IsList || valueType.IsArray) + { + var listDeclaration = Declare("list", New.List(valueType.ElementType), out var listVariable); + var foreachStatement = ForEachStatement.Create("item", element.Elements(), out ScopedApi item) + .Add(new MethodBodyStatement[] + { + DeserializeXmlValue(item, valueType.ElementType, serializationFormat, out var deserializedItem), + listVariable.Add(deserializedItem) + }); + + value = listVariable; + return new MethodBodyStatement[] { listDeclaration, foreachStatement }; + } + + if (valueType.IsDictionary) + { + var dictDeclaration = Declare("dict", New.Dictionary(valueType.Arguments[0], valueType.Arguments[1]), out var dictVariable); + var foreachStatement = ForEachStatement.Create("item", element.Elements(), out ScopedApi item) + .Add(CreateXmlDeserializeDictionaryValueStatement(valueType.ElementType, dictVariable, item, serializationFormat)); + + value = dictVariable; + return new MethodBodyStatement[] { dictDeclaration, foreachStatement }; + } + + value = CreateXmlDeserializeValueExpression(element, valueType, serializationFormat); + return MethodBodyStatement.Empty; + } + + private ValueExpression CreateXmlDeserializeValueExpression(ScopedApi element, CSharpType valueType, SerializationFormat serializationFormat) + { + var underlyingType = valueType.IsNullable && valueType.Arguments.Count > 0 + ? valueType.Arguments[0] + : valueType; + + if (underlyingType.IsEnum && underlyingType.UnderlyingEnumType != null) + { + var underlyingExpression = CreateXmlDeserializePrimitiveExpression(element, underlyingType.UnderlyingEnumType, serializationFormat); + return underlyingType.ToEnum(underlyingExpression); + } + + if (!underlyingType.IsFrameworkType) + { + return GetDeserializationMethodInvocationForType(underlyingType, element, null, _serializationOptionsParameter); + } + + return CreateXmlDeserializePrimitiveExpression(element, valueType, serializationFormat); + } + + private static ValueExpression CreateXmlDeserializePrimitiveExpression( + ScopedApi element, + CSharpType valueType, + SerializationFormat serializationFormat) + { + return valueType.FrameworkType switch + { + Type t when t == typeof(Uri) => New.Instance(valueType.FrameworkType, element.Value()), + Type t when t == typeof(IPAddress) => Static().Invoke(nameof(IPAddress.Parse), element.Value()), + Type t when t == typeof(Stream) => BinaryDataSnippets.FromString(element.Value()).ToStream(), + Type t when t == typeof(byte[]) => element.GetBytesFromBase64(serializationFormat.ToFormatSpecifier()), + Type t when t == typeof(BinaryData) => serializationFormat is SerializationFormat.Bytes_Base64 or SerializationFormat.Bytes_Base64Url + ? BinaryDataSnippets.FromBytes(element.GetBytesFromBase64(serializationFormat.ToFormatSpecifier())) + : BinaryDataSnippets.FromString(element.Value()), + Type t when t == typeof(DateTimeOffset) => element.GetDateTimeOffset(serializationFormat.ToFormatSpecifier()), + Type t when t == typeof(TimeSpan) => element.GetTimeSpan(serializationFormat.ToFormatSpecifier()), + Type t when t == typeof(byte) => element.CastTo(typeof(int)).CastTo(typeof(byte)), + Type t when t == typeof(sbyte) => element.CastTo(typeof(int)).CastTo(typeof(sbyte)), + Type t when t == typeof(short) => element.CastTo(typeof(int)).CastTo(typeof(short)), + Type t when t == typeof(ushort) => element.CastTo(typeof(int)).CastTo(typeof(ushort)), + _ => element.CastTo(valueType) + }; + } + + private MethodBodyStatement CreateXmlDeserializeAttributeStatements( + ScopedApi attrVariable, + List attributeProperties) + { + var statements = new List + { + Declare("localName", typeof(string), attrVariable.GetLocalName(), out var localNameVar) + }; + + foreach (var prop in attributeProperties) + { + MethodBodyStatement deserializationStatement = GetXmlDeserializationHookStatement( + prop.PropertyName, + prop.SerializationAttributes, + attrVariable, + prop.PropertyExpression, + out bool hasHook); + + if (!hasHook) + { + var deserializedValue = attrVariable.CastTo(prop.PropertyType); + deserializationStatement = prop.PropertyExpression.Assign(deserializedValue).Terminate(); + } + + var checkIfLocalNameEquals = new IfStatement(localNameVar.Equal(Literal(prop.XmlWireInfo.Name))) + { + deserializationStatement, + Continue + }; + + statements.Add(checkIfLocalNameEquals); + } + + return statements; + } + + private SwitchCaseStatement CreatePersistableModelCreateCoreXmlSwitchCase(CSharpType typeForDeserialize) + { + return new SwitchCaseStatement( + ModelReaderWriterOptionsSnippets.XmlFormat, + new MethodBodyStatement[] + { + new UsingScopeStatement(typeof(Stream), "dataStream", _dataParameter.As().ToStream(), out var streamVar) + { + Return(GetDeserializationMethodInvocationForType( + typeForDeserialize, + XElementSnippets.Load(streamVar.As(), XmlLinqSnippets.PreserveWhitespace), + _dataParameter, + _serializationOptionsParameter)) + }, + }); + } + + private MethodProvider BuildXmlExplicitFromClientResult() + { + var result = new ParameterProvider( + ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi.ResponseParameterName, + $"The {ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi.ClientResponseType:C} to deserialize the {Type:C} from.", + ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi.ClientResponseType); + var modifiers = MethodSignatureModifiers.Public | MethodSignatureModifiers.Static | + MethodSignatureModifiers.Explicit | MethodSignatureModifiers.Operator; + + var response = result.ToApi(); + MethodBodyStatement responseDeclaration; + + if (response.Original == response.GetRawResponse().Original) + { + responseDeclaration = MethodBodyStatement.Empty; + } + else + { + responseDeclaration = UsingDeclare("response", ScmCodeModelGenerator.Instance.TypeFactory.HttpResponseApi.HttpResponseType, result.ToApi().GetRawResponse(), out var responseVar); + response = responseVar.ToApi(); + } + + MethodBodyStatement[] methodBody = + [ + responseDeclaration, + UsingDeclare("stream", typeof(Stream), response.Property(nameof(HttpResponseApi.ContentStream)), out var streamVar), + new IfStatement(streamVar.Equal(Null)) { Return(Default) }, + MethodBodyStatement.EmptyLine, + Return(GetDeserializationMethodInvocationForType( + _model, + XElementSnippets.Load(streamVar.As(), XmlLinqSnippets.PreserveWhitespace))) + ]; + + return new MethodProvider( + new MethodSignature(Type.Name, null, modifiers, Type, null, [result]), + methodBody, + this); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs index 3fe0464ffcb..e1231ebfa19 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs @@ -10,6 +10,7 @@ using System.Net; using System.Text; using System.Text.Json; +using System.Xml.Linq; using Microsoft.TypeSpec.Generator.ClientModel.Snippets; using Microsoft.TypeSpec.Generator.ClientModel.Utilities; using Microsoft.TypeSpec.Generator.EmitterRpc; @@ -34,6 +35,7 @@ public partial class MrwSerializationTypeDefinition : TypeProvider private const string JsonModelCreateCoreMethodName = "JsonModelCreateCore"; private const string PersistableModelWriteCoreMethodName = "PersistableModelWriteCore"; private const string PersistableModelCreateCoreMethodName = "PersistableModelCreateCore"; + private const string DeserializationMethodNamePrefix = "Deserialize"; private const string WriteAction = "writing"; private const string ReadAction = "reading"; private readonly ParameterProvider _utf8JsonWriterParameter = new("writer", $"The JSON writer.", typeof(Utf8JsonWriter)); @@ -57,6 +59,8 @@ public partial class MrwSerializationTypeDefinition : TypeProvider private readonly Lazy _additionalBinaryDataProperty; private readonly PropertyProvider? _jsonPatchProperty; private readonly bool _isStruct; + private readonly bool _supportsJson; + private readonly bool _supportsXml; private ConstructorProvider? _serializationConstructor; // Flag to determine if the model should override the serialization methods private readonly bool _shouldOverrideMethods; @@ -73,6 +77,8 @@ public MrwSerializationTypeDefinition(InputModelType inputModel, ModelProvider m : null; _inputModel = inputModel; _isStruct = _model.DeclarationModifiers.HasFlag(TypeSignatureModifiers.Struct); + _supportsJson = inputModel.Usage.HasFlag(InputModelTypeUsage.Json); + _supportsXml = inputModel.Usage.HasFlag(InputModelTypeUsage.Xml); // Initialize the serialization interfaces var interfaceType = inputModel.IsUnknownDiscriminatorModel ? ScmCodeModelGenerator.Instance.TypeFactory.CreateModel(inputModel.BaseModel!)! : _model; _jsonModelTInterface = new CSharpType(typeof(IJsonModel<>), interfaceType.Type); @@ -86,6 +92,7 @@ public MrwSerializationTypeDefinition(InputModelType inputModel, ModelProvider m _utf8JsonWriterSnippet = _utf8JsonWriterParameter.As(); _mrwOptionsParameterSnippet = _serializationOptionsParameter.As(); _jsonElementParameterSnippet = _jsonElementDeserializationParam.As(); + _xmlElementParameterSnippet = _xElementDeserializationParam.As(); _isNotEqualToWireConditionSnippet = _mrwOptionsParameterSnippet.Format().NotEqual(ModelReaderWriterOptionsSnippets.WireFormat); } @@ -165,45 +172,63 @@ protected override ConstructorProvider[] BuildConstructors() /// A list of serialization and deserialization methods for the model. protected override MethodProvider[] BuildMethods() { - var jsonModelWriteCoreMethod = BuildJsonModelWriteCoreMethod(); - var methods = new List() + var methods = new List(); + + if (_supportsJson || _supportsXml) { - // Add JsonModel serialization methods - BuildJsonModelWriteMethod(jsonModelWriteCoreMethod), - jsonModelWriteCoreMethod, + // TO-DO: Add all persistable model methods when XML support is complete. + methods.Add(BuildPersistableModelCreateCoreMethod()); + if (!_inputModel.IsUnknownDiscriminatorModel) + { + if (ScmCodeModelGenerator.Instance.TypeFactory.RootOutputModels.Contains(_inputModel)) + { + methods.Add(GetExplicitFromClientResultMethod(_supportsXml)); + } + } + } + + // Add JsonModel serialization methods only if the model supports JSON + if (_supportsJson) + { + var jsonModelWriteCoreMethod = BuildJsonModelWriteCoreMethod(); + methods.Add(BuildJsonModelWriteMethod(jsonModelWriteCoreMethod)); + methods.Add(jsonModelWriteCoreMethod); // Add JsonModel deserialization methods - BuildJsonModelCreateMethod(), - BuildJsonModelCreateCoreMethod(), - BuildDeserializationMethod(), + methods.Add(BuildJsonModelCreateMethod()); + methods.Add(BuildJsonModelCreateCoreMethod()); + methods.Add(BuildDeserializationMethod()); // Add PersistableModel serialization methods - BuildPersistableModelWriteMethod(), - BuildPersistableModelWriteCoreMethod(), - BuildPersistableModelCreateMethod(), - BuildPersistableModelCreateCoreMethod(), - BuildPersistableModelGetFormatFromOptionsMethod(), - }; + methods.Add(BuildPersistableModelWriteMethod()); + methods.Add(BuildPersistableModelWriteCoreMethod()); + methods.Add(BuildPersistableModelCreateMethod()); + methods.Add(BuildPersistableModelGetFormatFromOptionsMethod()); - if (!_inputModel.IsUnknownDiscriminatorModel) - { - //cast operators - if (ScmCodeModelGenerator.Instance.TypeFactory.RootInputModels.Contains(_inputModel)) + if (!_inputModel.IsUnknownDiscriminatorModel) { - methods.Add(BuildImplicitToBinaryContent()); + //cast operators + if (ScmCodeModelGenerator.Instance.TypeFactory.RootInputModels.Contains(_inputModel)) + { + methods.Add(BuildImplicitToBinaryContent()); + } } - if (ScmCodeModelGenerator.Instance.TypeFactory.RootOutputModels.Contains(_inputModel)) + if (_isStruct) { - methods.Add(BuildExplicitFromClientResult()); + methods.Add(BuildJsonModelWriteMethodObjectDeclaration()); + methods.Add(BuildJsonModelCreateMethodObjectDeclaration()); + methods.Add(BuildPersistableModelWriteMethodObjectDeclaration()); + methods.Add(BuildPersistableModelGetFormatFromOptionsObjectDeclaration()); + methods.Add(BuildPersistableModelCreateMethodObjectDeclaration()); } } - if (_isStruct) + if (_supportsXml) { - methods.Add(BuildJsonModelWriteMethodObjectDeclaration()); - methods.Add(BuildJsonModelCreateMethodObjectDeclaration()); - methods.Add(BuildPersistableModelWriteMethodObjectDeclaration()); - methods.Add(BuildPersistableModelGetFormatFromOptionsObjectDeclaration()); - methods.Add(BuildPersistableModelCreateMethodObjectDeclaration()); + var xmlDeserializationMethod = BuildXmlDeserializationMethod(); + if (xmlDeserializationMethod != null) + { + methods.Add(xmlDeserializationMethod); + } } if (_model is ScmModelProvider { IsDynamicModel: true, HasDynamicProperties: true }) @@ -214,6 +239,16 @@ protected override MethodProvider[] BuildMethods() return [.. methods]; } + private MethodProvider GetExplicitFromClientResultMethod(bool supportsXml) + { + if (supportsXml) + { + return BuildXmlExplicitFromClientResult(); + } + + return BuildExplicitFromClientResult(); + } + private MethodProvider BuildExplicitFromClientResult() { var result = new ParameterProvider( @@ -287,16 +322,18 @@ private MethodProvider BuildImplicitToBinaryContent() /// An array of types that the model implements. protected override CSharpType[] BuildImplements() { - int interfaceCount = _jsonModelObjectInterface != null ? 2 : 1; - CSharpType[] interfaces = new CSharpType[interfaceCount]; - interfaces[0] = _jsonModelTInterface; + var interfaces = new List(); - if (_jsonModelObjectInterface != null) + if (_supportsJson) { - interfaces[1] = _jsonModelObjectInterface; + interfaces.Add(_jsonModelTInterface); + if (_jsonModelObjectInterface != null) + { + interfaces.Add(_jsonModelObjectInterface); + } } - return interfaces; + return [.. interfaces]; } /// @@ -507,7 +544,7 @@ internal MethodProvider BuildJsonModelCreateCoreMethod() /// internal MethodProvider BuildDeserializationMethod() { - var methodName = $"Deserialize{_model.Name}"; + var methodName = $"{DeserializationMethodNamePrefix}{_model.Name}"; var signatureModifiers = MethodSignatureModifiers.Internal | MethodSignatureModifiers.Static; List parameters = _model is ScmModelProvider { IsDynamicModel: true } ? [_jsonElementDeserializationParam, _dataParameter, _serializationOptionsParameter] @@ -838,19 +875,30 @@ private MethodBodyStatement[] BuildPersistableModelWriteCoreMethodBody() private MethodBodyStatement[] BuildPersistableModelCreateCoreMethodBody() { var typeForDeserialize = _model.IsUnknownDiscriminatorModel ? _model.Type.BaseType! : _model.Type; - var switchCase = new SwitchCaseStatement( - ModelReaderWriterOptionsSnippets.JsonFormat, - new MethodBodyStatement[] - { - new UsingScopeStatement(typeof(JsonDocument), "document", JsonDocumentSnippets.Parse(_dataParameter, ModelSerializationExtensionsSnippets.JsonDocumentOptions), out var jsonDocumentVar) + var switchCases = new List(); + + if (_supportsJson) + { + switchCases.Add(new SwitchCaseStatement( + ModelReaderWriterOptionsSnippets.JsonFormat, + new MethodBodyStatement[] { - Return(GetDeserializationMethodInvocationForType( - typeForDeserialize, - jsonDocumentVar.As().RootElement(), - _dataParameter, - _serializationOptionsParameter)) - }, - }); + new UsingScopeStatement(typeof(JsonDocument), "document", JsonDocumentSnippets.Parse(_dataParameter, ModelSerializationExtensionsSnippets.JsonDocumentOptions), out var jsonDocumentVar) + { + Return(GetDeserializationMethodInvocationForType( + typeForDeserialize, + jsonDocumentVar.As().RootElement(), + _dataParameter, + _serializationOptionsParameter)) + }, + })); + } + + if (_supportsXml) + { + switchCases.Add(CreatePersistableModelCreateCoreXmlSwitchCase(typeForDeserialize)); + } + var typeOfT = _persistableModelTInterface.Arguments[0]; var defaultCase = SwitchCaseStatement.Default( ThrowValidationFailException(_mrwOptionsParameterSnippet.Format(), typeOfT, ReadAction)); @@ -858,7 +906,7 @@ private MethodBodyStatement[] BuildPersistableModelCreateCoreMethodBody() return [ GetConcreteFormat(_mrwOptionsParameterSnippet, _persistableModelTInterface, out VariableExpression format), - new SwitchStatement(format, [switchCase, defaultCase]) + new SwitchStatement(format, [.. switchCases, defaultCase]) ]; } @@ -924,23 +972,8 @@ private List BuildDeserializePropertiesStatements(ScopedApi Dictionary> additionalPropsValueKindBodyStatements = []; var parameters = SerializationConstructor.Signature.Parameters; - // Parse the custom serialization attributes - List serializationAttributes = _model.CustomCodeView?.Attributes - .Where(a => a.Type.Name == CodeGenAttributes.CodeGenSerializationAttributeName) - .ToList() ?? []; - var baseModelProvider = _model.BaseModelProvider; - - while (baseModelProvider != null) - { - var customCodeView = baseModelProvider.CustomCodeView; - if (customCodeView != null) - { - serializationAttributes - .AddRange(customCodeView.Attributes - .Where(a => a.Type.Name == CodeGenAttributes.CodeGenSerializationAttributeName)); - } - baseModelProvider = baseModelProvider.BaseModelProvider; - } + // Get the custom serialization attributes + var serializationAttributes = GetSerializationAttributes(); // Create each property's deserialization statement for (int i = 0; i < parameters.Count; i++) @@ -990,7 +1023,7 @@ private List BuildDeserializePropertiesStatements(ScopedApi var rawBinaryData = _rawDataField; if (rawBinaryData == null) { - baseModelProvider = _model.BaseModelProvider; + var baseModelProvider = _model.BaseModelProvider; while (baseModelProvider != null) { var field = baseModelProvider.Fields.FirstOrDefault(f => f.Name == AdditionalPropertiesHelper.AdditionalBinaryDataPropsFieldName); @@ -2424,6 +2457,28 @@ private MethodBodyStatement CreateWriteAdditionalPropertiesStatement() p => p.BackingField?.Name == AdditionalPropertiesHelper.AdditionalBinaryDataPropsFieldName); } + private List GetSerializationAttributes() + { + List serializationAttributes = _model.CustomCodeView?.Attributes + .Where(a => a.Type.Name == CodeGenAttributes.CodeGenSerializationAttributeName) + .ToList() ?? []; + var baseModelProvider = _model.BaseModelProvider; + + while (baseModelProvider != null) + { + var customCodeView = baseModelProvider.CustomCodeView; + if (customCodeView != null) + { + serializationAttributes + .AddRange(customCodeView.Attributes + .Where(a => a.Type.Name == CodeGenAttributes.CodeGenSerializationAttributeName)); + } + baseModelProvider = baseModelProvider.BaseModelProvider; + } + + return serializationAttributes; + } + private static bool TypeRequiresNullCheckInSerialization(CSharpType type) { if (type.IsCollection) @@ -2446,14 +2501,14 @@ private static bool TypeRequiresNullCheckInSerialization(CSharpType type) internal static ValueExpression GetDeserializationMethodInvocationForType( CSharpType modelType, - ScopedApi jsonElementVariable, - ValueExpression dataVariable, + ScopedApi element, + ValueExpression? dataVariable, ValueExpression? optionsVariable = null) { return ScmCodeModelGenerator.Instance.TypeFactory.CSharpTypeMap.TryGetValue(modelType, out var provider) && provider is ModelProvider modelProvider - ? GetDeserializationMethodInvocationForType(modelProvider, jsonElementVariable, dataVariable, optionsVariable) - : modelType.Deserialize(jsonElementVariable, null, optionsVariable); + ? GetDeserializationMethodInvocationForType(modelProvider, element, dataVariable, optionsVariable) + : modelType.Deserialize(element, null, optionsVariable); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs index 73127364c4e..bd301b41e96 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs @@ -143,7 +143,7 @@ protected override IReadOnlyList CreateSerializationsCore(InputTyp { switch (inputType) { - case InputModelType inputModel when inputModel.Usage.HasFlag(InputModelTypeUsage.Json): + case InputModelType inputModel when (inputModel.Usage & (InputModelTypeUsage.Json | InputModelTypeUsage.Xml)) != 0: if (typeProvider is ModelProvider modelProvider) { return [new MrwSerializationTypeDefinition(inputModel, modelProvider)]; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs index 614719f2f29..f7b4ba31709 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelReaderWriterOptionsSnippets.cs @@ -14,6 +14,7 @@ internal static class ModelReaderWriterOptionsSnippets public static ValueExpression Format(this ScopedApi mrwOptions) => mrwOptions.Property(nameof(ModelReaderWriterOptions.Format)); internal static ScopedApi WireFormat => Literal("W"); internal static ScopedApi JsonFormat => Literal("J"); + internal static ScopedApi XmlFormat => Literal("X"); internal static ScopedApi InitializeWireOptions => New.Instance(typeof(ModelReaderWriterOptions), Wire).As(); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs new file mode 100644 index 00000000000..bb86a4e3ad5 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.Xml.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Snippets; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Snippets +{ + internal static partial class ModelSerializationExtensionsSnippets + { + public static InvokeMethodExpression GetDateTimeOffset(ScopedApi element, string? format) + => element.Invoke(GetDateTimeOffsetMethodName, Literal(format)); + + public static InvokeMethodExpression GetTimeSpan(ScopedApi element, string? format) + => element.Invoke(GetTimeSpanMethodName, Literal(format)); + + public static InvokeMethodExpression GetBytesFromBase64(ScopedApi element, string? format) + => element.Invoke(GetBytesFromBase64MethodName, Literal(format)); + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs index 6652c0fc730..e2dcd5ceec7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/ModelSerializationExtensionsSnippets.cs @@ -11,7 +11,7 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Snippets { - internal static class ModelSerializationExtensionsSnippets + internal static partial class ModelSerializationExtensionsSnippets { private const string WriteStringValueMethodName = "WriteStringValue"; private const string WriteBase64StringValueMethodName = "WriteBase64StringValue"; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs new file mode 100644 index 00000000000..cb4a0565191 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Snippets; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Snippets +{ + /// + /// Provides extension methods for generating code that works with and . + /// + internal static class XElementSnippets + { + public static ScopedApi Name(this ScopedApi element) + => element.Property(nameof(XElement.Name)).As(); + public static ScopedApi GetLocalName(this ScopedApi element) + => Name(element).Property(nameof(XName.LocalName)).As(); + + public static ScopedApi> Elements(this ScopedApi element) + => element.Invoke(nameof(XElement.Elements)).As>(); + + public static ScopedApi> Elements(this ScopedApi element, ValueExpression name) + => element.Invoke(nameof(XElement.Elements), name).As>(); + + public static ScopedApi Element(this ScopedApi element, ValueExpression name) + => element.Invoke(nameof(XElement.Element), name).As(); + + public static ScopedApi Value(this ScopedApi element) + => element.Property(nameof(XElement.Value)).As(); + + public static ScopedApi> Attributes(this ScopedApi element) + => element.Invoke(nameof(XElement.Attributes)).As>(); + public static ScopedApi Name(this ScopedApi attribute) + => attribute.Property(nameof(XAttribute.Name)).As(); + + public static ScopedApi GetLocalName(this ScopedApi attribute) + => Name(attribute).Property(nameof(XName.LocalName)).As(); + + public static ScopedApi Load(params ValueExpression[] args) + => Static().Invoke(nameof(XElement.Load), args).As(); + + public static ScopedApi GetDateTimeOffset(this ScopedApi element, string? format) + => ModelSerializationExtensionsSnippets.GetDateTimeOffset(element, format).As(); + + public static ScopedApi GetTimeSpan(this ScopedApi element, string? format) + => ModelSerializationExtensionsSnippets.GetTimeSpan(element, format).As(); + + public static ScopedApi GetBytesFromBase64(this ScopedApi element, string? format) + => ModelSerializationExtensionsSnippets.GetBytesFromBase64(element, format).As(); + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XmlLinqSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XmlLinqSnippets.cs new file mode 100644 index 00000000000..fb783735891 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XmlLinqSnippets.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.Snippets; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Snippets +{ + public class XmlLinqSnippets + { + public static ScopedApi PreserveWhitespace + => Static().Property(nameof(LoadOptions.PreserveWhitespace)).As(); + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs index a9e2b5677a3..9be3a31b1b6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/ModelSerializationExtensionsDefinitionTests.cs @@ -5,10 +5,10 @@ using System.ClientModel.Primitives; using System.Linq; using System.Text.Json; +using System.Xml.Linq; using Microsoft.TypeSpec.Generator.ClientModel.Providers; -using Microsoft.TypeSpec.Generator.ClientModel.Tests; +using Microsoft.TypeSpec.Generator.Input; using Microsoft.TypeSpec.Generator.Primitives; -using Microsoft.TypeSpec.Generator.Providers; using Microsoft.TypeSpec.Generator.Tests.Common; using NUnit.Framework; @@ -428,5 +428,110 @@ public void ValidateGetRemainder() var file = writer.Write(); Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); } + + [Test] + public void ValidateXmlGetDateTimeOffsetMethodIsGenerated() + { + // Create a model with XML usage to enable XML extension methods + var xmlModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("Name", InputPrimitiveType.String)]); + MockHelpers.LoadMockGenerator(inputModels: () => [xmlModel]); + + var definition = new ModelSerializationExtensionsDefinition(); + var methods = definition.Methods; + + Assert.IsNotNull(methods); + var getDateTimeOffsetMethods = methods.Where(m => m.Signature.Name == "GetDateTimeOffset").ToList(); + Assert.IsTrue(getDateTimeOffsetMethods.Count >= 2, "GetDateTimeOffset methods should include both JsonElement and XElement versions"); + + // Check XElement version + var xElementMethod = getDateTimeOffsetMethods.SingleOrDefault(m => + m.Signature.Parameters.Count == 2 && + m.Signature.Parameters[0].Type.FrameworkType == typeof(XElement)); + Assert.IsNotNull(xElementMethod, "GetDateTimeOffset for XElement should be generated"); + Assert.AreEqual(typeof(DateTimeOffset), xElementMethod!.Signature.ReturnType?.FrameworkType); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Public)); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Static)); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Extension)); + Assert.AreEqual(typeof(string), xElementMethod.Signature.Parameters[1].Type.FrameworkType); + } + + [Test] + public void ValidateXmlGetTimeSpanMethodIsGenerated() + { + // Create a model with XML usage to enable XML extension methods + var xmlModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("Name", InputPrimitiveType.String)]); + MockHelpers.LoadMockGenerator(inputModels: () => [xmlModel]); + + var definition = new ModelSerializationExtensionsDefinition(); + var methods = definition.Methods; + + Assert.IsNotNull(methods); + var getTimeSpanMethods = methods.Where(m => m.Signature.Name == "GetTimeSpan").ToList(); + Assert.IsTrue(getTimeSpanMethods.Count >= 2, "GetTimeSpan methods should include both JsonElement and XElement versions"); + + // Check XElement version + var xElementMethod = getTimeSpanMethods.SingleOrDefault(m => + m.Signature.Parameters.Count == 2 && + m.Signature.Parameters[0].Type.FrameworkType == typeof(XElement)); + Assert.IsNotNull(xElementMethod, "GetTimeSpan for XElement should be generated"); + Assert.AreEqual(typeof(TimeSpan), xElementMethod!.Signature.ReturnType?.FrameworkType); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Public)); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Static)); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Extension)); + Assert.AreEqual(typeof(string), xElementMethod.Signature.Parameters[1].Type.FrameworkType); + } + + [Test] + public void ValidateXmlGetBytesFromBase64MethodIsGenerated() + { + // Create a model with XML usage to enable XML extension methods + var xmlModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("Name", InputPrimitiveType.String)]); + MockHelpers.LoadMockGenerator(inputModels: () => [xmlModel]); + + var definition = new ModelSerializationExtensionsDefinition(); + var methods = definition.Methods; + + Assert.IsNotNull(methods); + var getBytesFromBase64Methods = methods.Where(m => m.Signature.Name == "GetBytesFromBase64").ToList(); + Assert.IsTrue(getBytesFromBase64Methods.Count >= 2, "GetBytesFromBase64 methods should include both JsonElement and XElement versions"); + + // Check XElement version + var xElementMethod = getBytesFromBase64Methods.SingleOrDefault(m => + m.Signature.Parameters.Count == 2 && + m.Signature.Parameters[0].Type.FrameworkType == typeof(XElement)); + Assert.IsNotNull(xElementMethod, "GetBytesFromBase64 for XElement should be generated"); + Assert.AreEqual(typeof(byte[]), xElementMethod!.Signature.ReturnType?.FrameworkType); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Public)); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Static)); + Assert.IsTrue(xElementMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Extension)); + Assert.AreEqual(typeof(string), xElementMethod.Signature.Parameters[1].Type.FrameworkType); + } + + [Test] + public void ValidateXmlMethodsAreNotGeneratedWhenNoXmlSupport() + { + // Load generator without any XML models + MockHelpers.LoadMockGenerator(); + + var definition = new ModelSerializationExtensionsDefinition(); + var methods = definition.Methods; + + Assert.IsNotNull(methods); + + // Verify that no XElement methods are generated + var xElementMethods = methods.Where(m => + m.Signature.Parameters.Count > 0 && + m.Signature.Parameters[0].Type.FrameworkType == typeof(XElement)).ToList(); + Assert.AreEqual(0, xElementMethods.Count, "No XElement methods should be generated when library doesn't support XML"); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DiscriminatorTests/TestNestedDiscriminatedModelWithOwnDiscriminator.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DiscriminatorTests/TestNestedDiscriminatedModelWithOwnDiscriminator.cs index d4675768e7f..748bf293368 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DiscriminatorTests/TestNestedDiscriminatedModelWithOwnDiscriminator.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/DiscriminatorTests/TestNestedDiscriminatedModelWithOwnDiscriminator.cs @@ -15,6 +15,21 @@ internal Tree() { } + protected override global::Sample.Models.Plant PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.Tree.DeserializeTree(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Tree)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -80,21 +95,6 @@ protected override void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrit global::Sample.Models.Tree global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => ((global::Sample.Models.Tree)this.PersistableModelCreateCore(data, options)); - protected override global::Sample.Models.Plant PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.Tree.DeserializeTree(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Tree)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeBaseType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeBaseType.cs index bb9d644eb64..657f3b2331f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeBaseType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeBaseType.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::Sample.Models.MockInputModelBase, global::System.ClientModel.Primitives.IJsonModel { + protected override global::Sample.Models.MockInputModelBase PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -81,21 +96,6 @@ protected override void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrit global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => ((global::Sample.Models.MockInputModel)this.PersistableModelCreateCore(data, options)); - protected override global::Sample.Models.MockInputModelBase PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFieldFrameworkType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFieldFrameworkType.cs index 38e17d785be..22a79db7281 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFieldFrameworkType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFieldFrameworkType.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -104,21 +119,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFrameworkType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFrameworkType.cs index 93e46da235a..5389ec20280 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFrameworkType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeEnumToFrameworkType.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -104,21 +119,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeFixedEnumString.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeFixedEnumString.cs index 00e8913cdb3..607117a3e2e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeFixedEnumString.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeFixedEnumString.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -101,21 +116,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeNullableStringToFixedEnum.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeNullableStringToFixedEnum.cs index 00e8913cdb3..607117a3e2e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeNullableStringToFixedEnum.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeNullableStringToFixedEnum.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -101,21 +116,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizePropertyIntoReadOnlyMemory.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizePropertyIntoReadOnlyMemory.cs index 6727533f0aa..57c3384cabe 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizePropertyIntoReadOnlyMemory.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizePropertyIntoReadOnlyMemory.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -113,21 +128,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeStringToFixedEnum.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeStringToFixedEnum.cs index 00e8913cdb3..607117a3e2e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeStringToFixedEnum.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeStringToFixedEnum.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -101,21 +116,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeUriProperty.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeUriProperty.cs index 5c8284fd70b..9a6ed500c58 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeUriProperty.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/ModelCustomizationTests/CanCustomizeUriProperty.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -104,21 +119,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeDictionaryToBinaryData.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeDictionaryToBinaryData.cs index b70e90d45af..8a104994f99 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeDictionaryToBinaryData.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeDictionaryToBinaryData.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -111,21 +126,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeListOfEnumPropToListOfExtensibleEnum.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeListOfEnumPropToListOfExtensibleEnum.cs index 60d445a0f33..a75598c3e63 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeListOfEnumPropToListOfExtensibleEnum.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangeListOfEnumPropToListOfExtensibleEnum.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class Model : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.Model PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.Model.DeserializeModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Model)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -114,21 +129,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.Model global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.Model PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.Model.DeserializeModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Model)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyName.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyName.cs index 3dc952dc48b..bde6cc93224 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyName.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyName.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class Model : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.Model PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.Model.DeserializeModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Model)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -126,21 +141,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.Model global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.Model PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.Model.DeserializeModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Model)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyNameAndRedefineOriginal.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyNameAndRedefineOriginal.cs index a626b935d49..524791e62b5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyNameAndRedefineOriginal.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertyNameAndRedefineOriginal.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -126,21 +141,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertySerializedName.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertySerializedName.cs index a75d78aba6e..13203e10936 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertySerializedName.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanChangePropertySerializedName.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -122,21 +137,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(int32).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(int32).cs index 3e9ead1f328..1c90ef6cfa1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(int32).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(int32).cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -101,21 +116,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(string).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(string).cs index 80b879dab03..44a832f6dd7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(string).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeExtensibleEnum(string).cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -101,21 +116,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(int32,1).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(int32,1).cs index 3e9ead1f328..1c90ef6cfa1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(int32,1).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(int32,1).cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -101,21 +116,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(string,foo).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(string,foo).cs index 80b879dab03..44a832f6dd7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(string,foo).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeLiteralExtensibleEnum(string,foo).cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -101,21 +116,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizePropertyUsingField.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizePropertyUsingField.cs index 8c7070f8b3e..962cbd82531 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizePropertyUsingField.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizePropertyUsingField.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -100,21 +115,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethod.cs index d566c635d4b..df202055c99 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethod.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethod.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -111,21 +126,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForPropertyInBase.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForPropertyInBase.cs index cab0cb71425..0c15f3deb51 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForPropertyInBase.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForPropertyInBase.cs @@ -16,6 +16,21 @@ internal MockInputModel() { } + protected override global::Sample.Models.BaseModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -93,21 +108,6 @@ protected override void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrit global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => ((global::Sample.Models.MockInputModel)this.PersistableModelCreateCore(data, options)); - protected override global::Sample.Models.BaseModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForRenamedProperty.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForRenamedProperty.cs index 51b90cdb410..15bd725f087 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForRenamedProperty.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanCustomizeSerializationMethodForRenamedProperty.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -111,21 +126,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceDeserializationMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceDeserializationMethod.cs index 3c6dc1297ae..e86cec3d352 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceDeserializationMethod.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceDeserializationMethod.cs @@ -11,6 +11,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -81,21 +96,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceSerializationMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceSerializationMethod.cs index cc858e50137..43e2aa37d23 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceSerializationMethod.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/CanReplaceSerializationMethod.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class MockInputModel : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -82,21 +97,6 @@ public partial class MockInputModel : global::System.ClientModel.Primitives.IJso global::Sample.Models.MockInputModel global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.MockInputModel.DeserializeMockInputModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/ReadOnlyMemPropertyType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/ReadOnlyMemPropertyType.cs index d8b360de9d2..8e292f8f84d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/ReadOnlyMemPropertyType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/SerializationCustomizationTests/ReadOnlyMemPropertyType.cs @@ -12,6 +12,21 @@ namespace Sample.Models { public partial class Model : global::System.ClientModel.Primitives.IJsonModel { + protected virtual global::Sample.Models.Model PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) + { + return global::Sample.Models.Model.DeserializeModel(document.RootElement, options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Model)} does not support reading '{options.Format}' format."); + } + } + void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -140,21 +155,6 @@ protected virtual void JsonModelWriteCore(global::System.Text.Json.Utf8JsonWrite global::Sample.Models.Model global::System.ClientModel.Primitives.IPersistableModel.Create(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => this.PersistableModelCreateCore(data, options); - protected virtual global::Sample.Models.Model PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) - { - string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(data, global::Sample.ModelSerializationExtensions.JsonDocumentOptions)) - { - return global::Sample.Models.Model.DeserializeModel(document.RootElement, options); - } - default: - throw new global::System.FormatException($"The model {nameof(global::Sample.Models.Model)} does not support reading '{options.Format}' format."); - } - } - string global::System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(global::System.ClientModel.Primitives.ModelReaderWriterOptions options) => "J"; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedBaseType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedBaseType.cs new file mode 100644 index 00000000000..ea3a0c1f542 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedBaseType.cs @@ -0,0 +1,32 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class Pet + { + internal static global::Sample.Models.Pet DeserializePet(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + global::System.Xml.Linq.XElement discriminatorElement = element.Element("kind"); + if ((discriminatorElement != null)) + { + switch (((string)discriminatorElement)) + { + case "cat": + return global::Sample.Models.Cat.DeserializeCat(element, options); + } + } + return global::Sample.Models.UnknownPet.DeserializeUnknownPet(element, options); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedSubtype.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedSubtype.cs new file mode 100644 index 00000000000..1c8d7084b5b --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationForDiscriminatedSubtype.cs @@ -0,0 +1,49 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class Cat + { + internal static global::Sample.Models.Cat DeserializeCat(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + string kind = "cat"; + string name = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + bool meows = default; + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "kind")) + { + kind = ((string)child); + continue; + } + if ((localName == "name")) + { + name = ((string)child); + continue; + } + if ((localName == "meows")) + { + meows = ((bool)child); + continue; + } + } + return new global::Sample.Models.Cat(kind, name, additionalBinaryDataProperties, meows); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeProperties.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeProperties.cs new file mode 100644 index 00000000000..d78f351b8f9 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeProperties.cs @@ -0,0 +1,48 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class TestXmlModel + { + internal static global::Sample.Models.TestXmlModel DeserializeTestXmlModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + string id = default; + string name = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var attr in element.Attributes()) + { + string localName = attr.Name.LocalName; + if ((localName == "id")) + { + id = ((string)attr); + continue; + } + } + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "name")) + { + name = ((string)child); + continue; + } + } + return new global::Sample.Models.TestXmlModel(id, name, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodBodyContainsPropertyDeserialization.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodBodyContainsPropertyDeserialization.cs new file mode 100644 index 00000000000..40b0111a9ce --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodBodyContainsPropertyDeserialization.cs @@ -0,0 +1,57 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using Sample; + +namespace Sample.Models +{ + public partial class TestXmlModel + { + internal TestXmlModel() + { + } + + protected virtual global::Sample.Models.TestXmlModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (global::System.IO.Stream dataStream = data.ToStream()) + { + return global::Sample.Models.TestXmlModel.DeserializeTestXmlModel(global::System.Xml.Linq.XElement.Load(dataStream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.TestXmlModel)} does not support reading '{options.Format}' format."); + } + } + + internal static global::Sample.Models.TestXmlModel DeserializeTestXmlModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + string name = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "name")) + { + name = ((string)child); + continue; + } + } + return new global::Sample.Models.TestXmlModel(name, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs new file mode 100644 index 00000000000..45cf27068de --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesNestedModel.cs @@ -0,0 +1,53 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using Sample; + +namespace Sample.Models +{ + public partial class OuterModel + { + protected virtual global::Sample.Models.OuterModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (global::System.IO.Stream dataStream = data.ToStream()) + { + return global::Sample.Models.OuterModel.DeserializeOuterModel(global::System.Xml.Linq.XElement.Load(dataStream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.OuterModel)} does not support reading '{options.Format}' format."); + } + } + + internal static global::Sample.Models.OuterModel DeserializeOuterModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + global::Sample.Models.InnerModel inner = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "inner")) + { + inner = global::Sample.Models.InnerModel.DeserializeInnerModel(child, options); + continue; + } + } + return new global::Sample.Models.OuterModel(inner, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesUnwrappedListProperty.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesUnwrappedListProperty.cs new file mode 100644 index 00000000000..be2d5fea638 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesUnwrappedListProperty.cs @@ -0,0 +1,61 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using Sample; + +namespace Sample.Models +{ + public partial class TestXmlModel + { + internal TestXmlModel() + { + } + + protected virtual global::Sample.Models.TestXmlModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (global::System.IO.Stream dataStream = data.ToStream()) + { + return global::Sample.Models.TestXmlModel.DeserializeTestXmlModel(global::System.Xml.Linq.XElement.Load(dataStream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.TestXmlModel)} does not support reading '{options.Format}' format."); + } + } + + internal static global::Sample.Models.TestXmlModel DeserializeTestXmlModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + global::System.Collections.Generic.IList colors = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "colors")) + { + if ((colors == null)) + { + colors = new global::System.Collections.Generic.List(); + } + colors.Add(((string)child)); + continue; + } + } + return new global::Sample.Models.TestXmlModel(colors, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesWrappedListProperty.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesWrappedListProperty.cs new file mode 100644 index 00000000000..94a8f60a8e1 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationMethodHandlesWrappedListProperty.cs @@ -0,0 +1,62 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using Sample; + +namespace Sample.Models +{ + public partial class TestXmlModel + { + internal TestXmlModel() + { + } + + protected virtual global::Sample.Models.TestXmlModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (global::System.IO.Stream dataStream = data.ToStream()) + { + return global::Sample.Models.TestXmlModel.DeserializeTestXmlModel(global::System.Xml.Linq.XElement.Load(dataStream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.TestXmlModel)} does not support reading '{options.Format}' format."); + } + } + + internal static global::Sample.Models.TestXmlModel DeserializeTestXmlModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + global::System.Collections.Generic.IList counts = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "counts")) + { + global::System.Collections.Generic.List array = new global::System.Collections.Generic.List(); + foreach (var e in child.Elements("int32")) + { + array.Add(((int)e)); + } + counts = array; + continue; + } + } + return new global::Sample.Models.TestXmlModel(counts, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName.cs new file mode 100644 index 00000000000..4ac8d4b185b --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName.cs @@ -0,0 +1,37 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class Model + { + internal static global::Sample.Models.Model DeserializeModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + string prop2 = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "prop1")) + { + prop2 = ((string)child); + continue; + } + } + return new global::Sample.Models.Model(prop2, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName/Model.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName/Model.cs new file mode 100644 index 00000000000..9c9442f5a3f --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanChangePropertyName/Model.cs @@ -0,0 +1,12 @@ + +using SampleTypeSpec; +using Microsoft.TypeSpec.Generator.Customizations; + +namespace Sample.Models +{ + public partial class Model + { + [CodeGenMember("Prop1")] + public string Prop2 { get; set; } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod.cs new file mode 100644 index 00000000000..0670d9d22c3 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod.cs @@ -0,0 +1,48 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class MockInputModel + { + internal static global::Sample.Models.MockInputModel DeserializeMockInputModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + string id = default; + string name = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var attr in element.Attributes()) + { + string localName = attr.Name.LocalName; + if ((localName == "id")) + { + DeserializationMethod(attr, ref id); + continue; + } + } + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "name")) + { + name = ((string)child); + continue; + } + } + return new global::Sample.Models.MockInputModel(id, name, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod/MockInputModel.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod/MockInputModel.cs new file mode 100644 index 00000000000..8a2fec05f39 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeAttributeDeserializationMethod/MockInputModel.cs @@ -0,0 +1,12 @@ +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.Customizations; + +namespace Sample.Models +{ + [CodeGenSerialization(nameof(Id), DeserializationValueHook = nameof(DeserializationMethod))] + public partial class MockInputModel + { + private static void DeserializationMethod(XAttribute attribute, ref string fieldValue) + => fieldValue = attribute.Value; + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod.cs new file mode 100644 index 00000000000..0cc66cbc057 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod.cs @@ -0,0 +1,43 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class MockInputModel + { + internal static global::Sample.Models.MockInputModel DeserializeMockInputModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + string prop1 = default; + string prop2 = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "prop1")) + { + DeserializationMethod(child, ref prop1); + continue; + } + if ((localName == "prop2")) + { + DeserializationMethod(child, ref prop2); + continue; + } + } + return new global::Sample.Models.MockInputModel(prop1, prop2, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod/MockInputModel.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod/MockInputModel.cs new file mode 100644 index 00000000000..b80993c8457 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanCustomizeDeserializationMethod/MockInputModel.cs @@ -0,0 +1,13 @@ +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.Customizations; + +namespace Sample.Models +{ + [CodeGenSerialization(nameof(Prop1), DeserializationValueHook = nameof(DeserializationMethod))] + [CodeGenSerialization(nameof(Prop2), DeserializationValueHook = nameof(DeserializationMethod))] + public partial class MockInputModel + { + private static void DeserializationMethod(XElement element, ref string fieldValue) + => fieldValue = element.Value; + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod.cs new file mode 100644 index 00000000000..f9e50726c31 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.IO; +using System.Xml.Linq; + +namespace Sample.Models +{ + public partial class MockInputModel + { + protected virtual global::Sample.Models.MockInputModel PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (global::System.IO.Stream dataStream = data.ToStream()) + { + return global::Sample.Models.MockInputModel.DeserializeMockInputModel(global::System.Xml.Linq.XElement.Load(dataStream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), options); + } + default: + throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support reading '{options.Format}' format."); + } + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod/MockInputModel.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod/MockInputModel.cs new file mode 100644 index 00000000000..fef26bfa2df --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlSerializationCustomizationTests/CanReplaceDeserializationMethod/MockInputModel.cs @@ -0,0 +1,36 @@ +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample; + +namespace Sample.Models +{ + /// + public partial class MockInputModel + { + internal static MockInputModel DeserializeMockInputModel(XElement element, ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + string prop1 = default; + string prop2 = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if ((localName == "prop1")) + { + prop1 = ((string)child); + continue; + } + // customization: remove Prop2 deserialization + } + return new MockInputModel(prop1, prop2, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs new file mode 100644 index 00000000000..1026d88a497 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.ClientModel.Providers; +using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Tests.Common; +using NUnit.Framework; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Tests.Providers.MrwSerializationTypeDefinitions +{ + public class XmlDeserializationTests + { + [SetUp] + public void SetUp() + { + MockHelpers.LoadMockGenerator(createSerializationsCore: (inputType, typeProvider) + => inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); + } + + [Test] + public void XmlDeserializationMethodIsGeneratedForXmlModel() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("Name", InputPrimitiveType.String)]); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestXmlModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + Assert.IsNotNull(xmlDeserializationMethod, "XML deserialization method should be generated for models with XML usage"); + Assert.AreEqual("DeserializeTestXmlModel", xmlDeserializationMethod!.Signature.Name); + Assert.AreEqual(2, xmlDeserializationMethod.Signature.Parameters.Count); + Assert.AreEqual(typeof(XElement), xmlDeserializationMethod.Signature.Parameters[0].Type.FrameworkType); + Assert.IsTrue(xmlDeserializationMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Internal)); + Assert.IsTrue(xmlDeserializationMethod.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Static)); + } + + [Test] + public void XmlDeserializationMethodIsNotGeneratedForJsonOnlyModel() + { + var inputModel = InputFactory.Model( + "TestJsonModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Output | InputModelTypeUsage.Json, + properties: [InputFactory.Property("Name", InputPrimitiveType.String)]); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestJsonModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + Assert.IsNull(xmlDeserializationMethod, "XML deserialization method should NOT be generated for JSON-only models"); + } + + [Test] + public async Task XmlDeserializationMethodBodyContainsPropertyDeserialization() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("name", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("name"))]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "TestXmlModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(serializationProvider); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public async Task XmlDeserializationMethodHandlesNestedModel() + { + var innerModel = InputFactory.Model( + "InnerModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("value", InputPrimitiveType.String, xmlSerializationOptions: new("value"))]); + var outerModel = InputFactory.Model( + "OuterModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property("inner", innerModel, xmlSerializationOptions: new("inner"))]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [innerModel, outerModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "OuterModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(serializationProvider); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public async Task XmlDeserializationMethodHandlesUnwrappedListProperty() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "colors", + InputFactory.Array(InputPrimitiveType.String), + isRequired: true, + xmlSerializationOptions: new("colors", unwrapped: true))]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "TestXmlModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(serializationProvider); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public async Task XmlDeserializationMethodHandlesWrappedListProperty() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "counts", + InputFactory.Array(InputPrimitiveType.Int32), + isRequired: true, + xmlSerializationOptions: new("counts", unwrapped: false, itemsName: "int32"))]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "TestXmlModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(serializationProvider); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public void XmlDeserializationHandlesDateTimeOffsetProperty() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "timestamp", + new InputDateTimeType(DateTimeKnownEncoding.Rfc3339, "utcDateTime", "TypeSpec.utcDateTime", InputPrimitiveType.String), + xmlSerializationOptions: new("timestamp"))]); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestXmlModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + + Assert.IsNotNull(xmlDeserializationMethod); + var methodBody = xmlDeserializationMethod!.BodyStatements!.ToDisplayString(); + + Assert.IsTrue(methodBody.Contains("timestamp = child.GetDateTimeOffset(\"O\")"), + $"DateTimeOffset property should use child.GetDateTimeOffset(\"O\") with RFC3339 format. Actual:\n{methodBody}"); + } + + [Test] + public void XmlDeserializationHandlesTimeSpanProperty() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "duration", + new InputDurationType(DurationKnownEncoding.Iso8601, "duration", "TypeSpec.duration", InputPrimitiveType.String, null), + xmlSerializationOptions: new("duration"))]); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestXmlModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + + Assert.IsNotNull(xmlDeserializationMethod); + var methodBody = xmlDeserializationMethod!.BodyStatements!.ToDisplayString(); + + Assert.IsTrue(methodBody.Contains("duration = child.GetTimeSpan(\"P\")"), + $"TimeSpan property should use child.GetTimeSpan(\"P\") with ISO8601 format. Actual:\n{methodBody}"); + } + + [Test] + public void XmlDeserializationHandlesBytesProperty() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "data", + InputPrimitiveType.Base64, + xmlSerializationOptions: new("data"))]); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestXmlModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + + Assert.IsNotNull(xmlDeserializationMethod); + var methodBody = xmlDeserializationMethod!.BodyStatements!.ToDisplayString(); + + Assert.IsTrue(methodBody.Contains("child.GetBytesFromBase64(\"D\")"), + $"Bytes property should use child.GetBytesFromBase64(\"D\") with Base64 format. Actual:\n{methodBody}"); + } + + [Test] + public void XmlDeserializationHandlesBinaryDataProperty() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "content", + InputPrimitiveType.Any, + xmlSerializationOptions: new("content"))]); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestXmlModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + + Assert.IsNotNull(xmlDeserializationMethod); + var methodBody = xmlDeserializationMethod!.BodyStatements!.ToDisplayString(); + + Assert.IsTrue(methodBody.Contains("content = global::System.BinaryData.FromString(child.Value)"), + $"BinaryData property should use BinaryData.FromString(child.Value) for deserialization. Actual:\n{methodBody}"); + } + + [Test] + public void XmlDeserializationHandlesFixedEnumProperty() + { + var enumType = InputFactory.StringEnum( + "TestEnum", + [("Value1", "value1"), ("Value2", "value2")], + isExtensible: false); + + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "status", + enumType, + xmlSerializationOptions: new("status"))]); + + MockHelpers.LoadMockGenerator( + inputEnums: () => [enumType], + createSerializationsCore: (inputType, typeProvider) + => inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestXmlModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + + Assert.IsNotNull(xmlDeserializationMethod); + var methodBody = xmlDeserializationMethod!.BodyStatements!.ToDisplayString(); + + Assert.IsTrue(methodBody.Contains("status = ((string)child).ToTestEnum()"), + $"Fixed enum property should use ToEnumName() extension method. Actual:\n{methodBody}"); + } + + [Test] + public void XmlDeserializationHandlesExtensibleEnumProperty() + { + var enumType = InputFactory.StringEnum( + "TestEnum", + [("Value1", "value1"), ("Value2", "value2")], + isExtensible: true); + + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: [InputFactory.Property( + "status", + enumType, + xmlSerializationOptions: new("status"))]); + + MockHelpers.LoadMockGenerator( + inputEnums: () => [enumType], + createSerializationsCore: (inputType, typeProvider) + => inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); + + var modelProvider = new ModelProvider(inputModel); + var mrwProvider = modelProvider.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + var xmlDeserializationMethod = mrwProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeTestXmlModel" && + m.Signature.Parameters.Any(p => p.Type.Equals(typeof(XElement)))); + + Assert.IsNotNull(xmlDeserializationMethod); + var methodBody = xmlDeserializationMethod!.BodyStatements!.ToDisplayString(); + + Assert.IsTrue(methodBody.Contains("status = new global::Sample.Models.TestEnum(((string)child))"), + $"Extensible enum property should use new EnumName(value) constructor. Actual:\n{methodBody}"); + } + + [Test] + public async Task XmlDeserializationForDiscriminatedBaseType() + { + var catModel = InputFactory.Model( + "cat", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + discriminatedKind: "cat", + properties: + [ + InputFactory.Property("meows", InputPrimitiveType.Boolean, isRequired: true, xmlSerializationOptions: new("meows")) + ]); + var baseModel = InputFactory.Model( + "pet", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("kind", InputPrimitiveType.String, isRequired: true, isDiscriminator: true, xmlSerializationOptions: new("kind")), + InputFactory.Property("name", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("name")) + ], + discriminatedModels: new Dictionary() { { "cat", catModel } }); + + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [baseModel, catModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "Pet") as ModelProvider; + Assert.IsNotNull(modelProvider); + var mrwProvider = modelProvider!.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + + // Validate proxy attribute is generated for discriminated base type + var proxyAttribute = mrwProvider!.Attributes.FirstOrDefault(a => a.Type.Equals(typeof(PersistableModelProxyAttribute))); + Assert.IsNotNull(proxyAttribute, "Base discriminated type should have PersistableModelProxyAttribute"); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + mrwProvider!, + name => name == "DeserializePet")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public async Task XmlDeserializationForDiscriminatedSubtype() + { + var catModel = InputFactory.Model( + "cat", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + discriminatedKind: "cat", + properties: + [ + InputFactory.Property("meows", InputPrimitiveType.Boolean, isRequired: true, xmlSerializationOptions: new("meows")) + ]); + var baseModel = InputFactory.Model( + "pet", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("kind", InputPrimitiveType.String, isRequired: true, isDiscriminator: true, xmlSerializationOptions: new("kind")), + InputFactory.Property("name", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("name")) + ], + discriminatedModels: new Dictionary() { { "cat", catModel } }); + + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [baseModel, catModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "Cat") as ModelProvider; + Assert.IsNotNull(modelProvider); + var mrwProvider = modelProvider!.SerializationProviders.FirstOrDefault() as MrwSerializationTypeDefinition; + Assert.IsNotNull(mrwProvider); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + mrwProvider!, + name => name == "DeserializeCat")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public async Task XmlDeserializationHandlesAttributeProperties() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("id", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("id", attribute: true)), + InputFactory.Property("name", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("name")) + ]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "TestXmlModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serializationProvider, + name => name == "DeserializeTestXmlModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlSerializationCustomizationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlSerializationCustomizationTests.cs new file mode 100644 index 00000000000..df2142e1193 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlSerializationCustomizationTests.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Linq; +using System.Threading.Tasks; +using Microsoft.TypeSpec.Generator.ClientModel.Providers; +using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Tests.Common; +using NUnit.Framework; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Tests.Providers.MrwSerializationTypeDefinitions +{ + public class XmlSerializationCustomizationTests + { + // Validates that the generated deserialization method is replaced when a custom one is provided. + [Test] + public async Task CanReplaceDeserializationMethod() + { + var inputModel = InputFactory.Model( + "mockInputModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("Prop1", InputPrimitiveType.String, xmlSerializationOptions: new("prop1")), + InputFactory.Property("Prop2", new InputNullableType(InputPrimitiveType.String), xmlSerializationOptions: new("prop2")) + ]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel], + compilation: async () => await Helpers.GetCompilationFromDirectoryAsync()); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var methods = serializationProvider!.Methods; + + // Validate the deserialization method doesn't exist in the serialization provider + Assert.IsNull(methods.FirstOrDefault(m => m.Signature.Name == "DeserializeMockInputModel")); + + var canonicalView = modelProvider.CanonicalView; + Assert.IsNotNull(canonicalView); + + var canonicalMethods = canonicalView.Methods; + Assert.IsNotNull(canonicalMethods); + Assert.IsNotNull(canonicalMethods.FirstOrDefault(m => m.Signature.Name == "DeserializeMockInputModel")); + + + var writer = new TypeProviderWriter(serializationProvider); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + // Validates that a property name can be changed using CodeGenMember attribute and + // the deserialization method uses the renamed property. + [Test] + public async Task CanChangePropertyName() + { + var inputModel = InputFactory.Model( + "model", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("Prop1", InputPrimitiveType.String, xmlSerializationOptions: new("prop1")) + ]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel], + compilation: async () => await Helpers.GetCompilationFromDirectoryAsync()); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + + Assert.IsNotNull(modelProvider); + Assert.IsNotNull(serializationProvider); + + // Validate that the Color property was renamed to CustomColor + var customCodeView = modelProvider.CustomCodeView; + Assert.IsNotNull(customCodeView); + var customProperties = customCodeView!.Properties; + Assert.AreEqual(1, customProperties.Count); + Assert.AreEqual("Prop2", customProperties[0].Name); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serializationProvider, + name => name == "DeserializeModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + // Validates that a custom deserialization hook can be used to customize property deserialization. + [Test] + public async Task CanCustomizeDeserializationMethod() + { + var inputModel = InputFactory.Model( + "mockInputModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("Prop1", InputPrimitiveType.String, xmlSerializationOptions: new("prop1")), + InputFactory.Property("Prop2", new InputNullableType(InputPrimitiveType.String), xmlSerializationOptions: new("prop2")) + ]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel], + compilation: async () => await Helpers.GetCompilationFromDirectoryAsync()); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serializationProvider!, + name => name == "DeserializeMockInputModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + // Validates that a custom deserialization hook can be used to customize attribute property deserialization. + [Test] + public async Task CanCustomizeAttributeDeserializationMethod() + { + var inputModel = InputFactory.Model( + "mockInputModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("Id", InputPrimitiveType.String, xmlSerializationOptions: new("id", attribute: true)), + InputFactory.Property("Name", InputPrimitiveType.String, xmlSerializationOptions: new("name")) + ]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel], + compilation: async () => await Helpers.GetCompilationFromDirectoryAsync()); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serializationProvider!, + name => name == "DeserializeMockInputModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/InputLibrary.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/InputLibrary.cs index d49942c1e39..01ceed10a25 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/InputLibrary.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/InputLibrary.cs @@ -45,6 +45,9 @@ internal InputNamespace Load() private bool? _hasMultiServiceClient; public bool HasMultiServiceClient => _hasMultiServiceClient ??= GetHasMultiServiceClient(); + private bool? _hasXmlModelSerialization; + public bool HasXmlModelSerialization => _hasXmlModelSerialization ??= GetHasXmlModelSerialization(); + private bool GetHasMultipartFormDataOperation() { foreach (var client in InputNamespace.Clients) @@ -73,5 +76,25 @@ private bool GetHasMultiServiceClient() return false; } + + private bool GetHasXmlModelSerialization() + { + foreach (var model in InputNamespace.Models) + { + if (model.Usage.HasFlag(InputModelTypeUsage.Xml)) + { + return true; + } + } + + foreach (var enumType in InputNamespace.Enums) + { + if (enumType.Usage.HasFlag(InputModelTypeUsage.Xml)) + { + return true; + } + } + return false; + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs index 68b43a1c015..65a3c166bad 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs @@ -16,6 +16,8 @@ public class PropertyWireInformation : WireInformation public bool IsHttpMetadata { get; } public bool IsApiVersion { get; } internal FormattableString? Description { get; } + public XmlWireInformation? XmlWireInformation { get; } + public PropertyWireInformation(SerializationFormat serializationFormat, bool isRequired, bool isReadOnly, bool isNullable, bool isDiscriminator, string serializedName, bool isHttpMetadata, bool isApiVersion) : base(serializationFormat, serializedName) { @@ -43,6 +45,9 @@ internal PropertyWireInformation(InputProperty inputProperty) IsDiscriminator = modelProperty != null && modelProperty.IsDiscriminator; Description = DocHelpers.GetFormattableDescription(inputProperty.Summary, inputProperty.Doc); IsApiVersion = inputProperty.IsApiVersion; + XmlWireInformation = modelProperty?.SerializationOptions?.Xml != null + ? new XmlWireInformation(modelProperty.SerializationOptions.Xml) + : null; } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs new file mode 100644 index 00000000000..a8352ddddfa --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.TypeSpec.Generator.Input; + +namespace Microsoft.TypeSpec.Generator.Primitives +{ + public class XmlWireInformation + { + public XmlWireInformation(InputXmlSerializationOptions xmlOptions) + { + Name = xmlOptions.Name; + Attribute = xmlOptions.Attribute; + Namespace = xmlOptions.Namespace != null + ? new(xmlOptions.Namespace) + : null; + Unwrapped = xmlOptions.Unwrapped; + ItemsName = xmlOptions.ItemsName; + ItemsNamespace = xmlOptions.ItemsNamespace != null + ? new(xmlOptions.ItemsNamespace) + : null; + } + + public string Name { get; } + + public bool? Attribute { get; } + + public XmlWireNamespaceOptions? Namespace { get; } + + public bool? Unwrapped { get; } + + public string? ItemsName { get; } + + public XmlWireNamespaceOptions? ItemsNamespace { get; } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs new file mode 100644 index 00000000000..7b1645c2db5 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.TypeSpec.Generator.Input; + +namespace Microsoft.TypeSpec.Generator.Primitives +{ + public class XmlWireNamespaceOptions + { + public XmlWireNamespaceOptions(InputXmlNamespaceOptions options) + { + Namespace = options.Namespace; + Prefix = options.Prefix; + } + + public string Namespace { get; } + + public string Prefix { get; } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/common/InputFactory.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/common/InputFactory.cs index f117d6d42d1..9f6ef1b7b5f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/common/InputFactory.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/common/InputFactory.cs @@ -6,6 +6,7 @@ using System.Reflection; using Microsoft.TypeSpec.Generator.Input; using Microsoft.TypeSpec.Generator.Input.Extensions; +using Microsoft.TypeSpec.Generator.Primitives; namespace Microsoft.TypeSpec.Generator.Tests.Common { @@ -245,8 +246,13 @@ public static InputModelProperty Property( string? wireName = null, string? summary = null, string? serializedName = null, - string? doc = null) + string? doc = null, + InputXmlSerializationOptions? xmlSerializationOptions = null) { + var serializationOptions = new InputSerializationOptions( + json: new(wireName ?? name.ToVariableName()), + xml: xmlSerializationOptions); + return new InputModelProperty( name: name, summary: summary, @@ -260,7 +266,7 @@ public static InputModelProperty Property( access: null, isDiscriminator: isDiscriminator, serializedName: serializedName ?? wireName ?? name.ToVariableName(), - serializationOptions: new(json: new(wireName ?? name.ToVariableName()))); + serializationOptions: serializationOptions); } public static InputHeaderParameter HeaderParameter( diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs index 099511239df..2382cbb0f08 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs @@ -14,6 +14,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Text.Json; +using System.Xml.Linq; namespace SampleTypeSpec { @@ -342,5 +343,20 @@ public static ReadOnlySpan GetRemainder(this ReadOnlySpan jsonPath, { return index >= jsonPath.Length ? ReadOnlySpan.Empty : jsonPath[index] == '.' ? jsonPath.Slice(index) : jsonPath.Slice(index + 2); } + + public static DateTimeOffset GetDateTimeOffset(this XElement element, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds((long)element), + _ => TypeFormatters.ParseDateTimeOffset(element.Value, format) + }; + + public static TimeSpan GetTimeSpan(this XElement element, string format) => TypeFormatters.ParseTimeSpan(element.Value, format); + + public static byte[] GetBytesFromBase64(this XElement element, string format) => format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.Value), + "D" => Convert.FromBase64String(element.Value), + _ => throw new ArgumentException("Format is not supported: ", nameof(format)) + }; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs index 36d704a717f..8e21be79945 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Animal.Serialization.cs @@ -24,6 +24,31 @@ internal Animal() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAnimal(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Animal)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator Animal(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAnimal(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -121,23 +146,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. Animal IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeAnimal(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Animal)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; @@ -150,13 +158,5 @@ public static implicit operator BinaryContent(Animal animal) } return BinaryContent.Create(animal, ModelSerializationExtensions.WireOptions); } - - /// The to deserialize the from. - public static explicit operator Animal(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnimal(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/AnotherDynamicModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/AnotherDynamicModel.Serialization.cs index 05e288342d8..76d814574ca 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/AnotherDynamicModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/AnotherDynamicModel.Serialization.cs @@ -20,6 +20,23 @@ internal AnotherDynamicModel() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AnotherDynamicModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAnotherDynamicModel(document.RootElement, data, options); + } + default: + throw new FormatException($"The model {nameof(AnotherDynamicModel)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -119,23 +136,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. AnotherDynamicModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual AnotherDynamicModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeAnotherDynamicModel(document.RootElement, data, options); - } - default: - throw new FormatException($"The model {nameof(AnotherDynamicModel)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs index 470450f2c6e..e312c1a2ec5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Dog.Serialization.cs @@ -21,6 +21,31 @@ internal Dog() { } + /// The data to parse. + /// The client options for reading and writing models. + protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeDog(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Dog)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator Dog(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDog(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -124,23 +149,6 @@ protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. Dog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (Dog)PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeDog(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Dog)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; @@ -153,13 +161,5 @@ public static implicit operator BinaryContent(Dog dog) } return BinaryContent.Create(dog, ModelSerializationExtensions.WireOptions); } - - /// The to deserialize the from. - public static explicit operator Dog(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDog(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs index acf28b88405..64d91d7577a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/DynamicModel.Serialization.cs @@ -22,6 +22,23 @@ internal DynamicModel() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DynamicModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeDynamicModel(document.RootElement, data, options); + } + default: + throw new FormatException($"The model {nameof(DynamicModel)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -725,23 +742,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. DynamicModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual DynamicModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeDynamicModel(document.RootElement, data, options); - } - default: - throw new FormatException($"The model {nameof(DynamicModel)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs index 715466fac81..9368f2860ec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Friend.Serialization.cs @@ -22,6 +22,31 @@ internal Friend() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Friend PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeFriend(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Friend)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator Friend(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFriend(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -121,23 +146,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. Friend IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual Friend PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeFriend(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Friend)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; @@ -150,13 +158,5 @@ public static implicit operator BinaryContent(Friend friend) } return BinaryContent.Create(friend, ModelSerializationExtensions.WireOptions); } - - /// The to deserialize the from. - public static explicit operator Friend(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFriend(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResponse.Serialization.cs index d7a261e2e5b..203f73fcd66 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResponse.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/GetWidgetMetricsResponse.Serialization.cs @@ -21,6 +21,31 @@ internal GetWidgetMetricsResponse() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual GetWidgetMetricsResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeGetWidgetMetricsResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetWidgetMetricsResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator GetWidgetMetricsResponse(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetWidgetMetricsResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -128,32 +153,7 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. GetWidgetMetricsResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual GetWidgetMetricsResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeGetWidgetMetricsResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(GetWidgetMetricsResponse)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator GetWidgetMetricsResponse(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeGetWidgetMetricsResponse(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResponse.Serialization.cs index 753e36cf347..39b7850d230 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResponse.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenHeaderResponseResponse.Serialization.cs @@ -21,6 +21,31 @@ internal ListWithContinuationTokenHeaderResponseResponse() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListWithContinuationTokenHeaderResponseResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeListWithContinuationTokenHeaderResponseResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListWithContinuationTokenHeaderResponseResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator ListWithContinuationTokenHeaderResponseResponse(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithContinuationTokenHeaderResponseResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -130,32 +155,7 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. ListWithContinuationTokenHeaderResponseResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual ListWithContinuationTokenHeaderResponseResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeListWithContinuationTokenHeaderResponseResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ListWithContinuationTokenHeaderResponseResponse)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator ListWithContinuationTokenHeaderResponseResponse(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeListWithContinuationTokenHeaderResponseResponse(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResponse.Serialization.cs index 1f3bdc3a151..5768d610033 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResponse.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithContinuationTokenResponse.Serialization.cs @@ -21,6 +21,31 @@ internal ListWithContinuationTokenResponse() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListWithContinuationTokenResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeListWithContinuationTokenResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListWithContinuationTokenResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator ListWithContinuationTokenResponse(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithContinuationTokenResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -141,32 +166,7 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. ListWithContinuationTokenResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual ListWithContinuationTokenResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeListWithContinuationTokenResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ListWithContinuationTokenResponse)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator ListWithContinuationTokenResponse(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeListWithContinuationTokenResponse(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResponse.Serialization.cs index a7b7a76b808..c7de729f4a5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResponse.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithNextLinkResponse.Serialization.cs @@ -21,6 +21,31 @@ internal ListWithNextLinkResponse() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListWithNextLinkResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeListWithNextLinkResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListWithNextLinkResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator ListWithNextLinkResponse(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithNextLinkResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -145,32 +170,7 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. ListWithNextLinkResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual ListWithNextLinkResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeListWithNextLinkResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ListWithNextLinkResponse)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator ListWithNextLinkResponse(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeListWithNextLinkResponse(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResponse.Serialization.cs index d67a1f445b4..74606f9283c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResponse.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ListWithStringNextLinkResponse.Serialization.cs @@ -21,6 +21,31 @@ internal ListWithStringNextLinkResponse() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListWithStringNextLinkResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeListWithStringNextLinkResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListWithStringNextLinkResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator ListWithStringNextLinkResponse(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeListWithStringNextLinkResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -141,32 +166,7 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. ListWithStringNextLinkResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual ListWithStringNextLinkResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeListWithStringNextLinkResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ListWithStringNextLinkResponse)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator ListWithStringNextLinkResponse(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeListWithStringNextLinkResponse(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs index 89013095b0b..3278bcbccd6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithEmbeddedNonBodyParameters.Serialization.cs @@ -21,6 +21,23 @@ internal ModelWithEmbeddedNonBodyParameters() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ModelWithEmbeddedNonBodyParameters PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeModelWithEmbeddedNonBodyParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelWithEmbeddedNonBodyParameters)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -130,23 +147,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. ModelWithEmbeddedNonBodyParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual ModelWithEmbeddedNonBodyParameters PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeModelWithEmbeddedNonBodyParameters(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ModelWithEmbeddedNonBodyParameters)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs index 9871324e6a1..7671388ac90 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs @@ -20,6 +20,23 @@ internal ModelWithRequiredNullableProperties() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ModelWithRequiredNullableProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeModelWithRequiredNullableProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelWithRequiredNullableProperties)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -171,23 +188,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. ModelWithRequiredNullableProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual ModelWithRequiredNullableProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeModelWithRequiredNullableProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ModelWithRequiredNullableProperties)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs index c1c6b331996..dda7f8cd2dc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/PageThing.Serialization.cs @@ -21,6 +21,31 @@ internal PageThing() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PageThing PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePageThing(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PageThing)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator PageThing(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePageThing(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -130,32 +155,7 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. PageThing IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual PageThing PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializePageThing(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PageThing)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator PageThing(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePageThing(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs index e7d61d27402..9f6c2a6fd5d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Pet.Serialization.cs @@ -20,6 +20,31 @@ internal Pet() { } + /// The data to parse. + /// The client options for reading and writing models. + protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePet(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Pet)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator Pet(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePet(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -99,23 +124,6 @@ protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. Pet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (Pet)PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializePet(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Pet)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; @@ -128,13 +136,5 @@ public static implicit operator BinaryContent(Pet pet) } return BinaryContent.Create(pet, ModelSerializationExtensions.WireOptions); } - - /// The to deserialize the from. - public static explicit operator Pet(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePet(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs new file mode 100644 index 00000000000..2833e195475 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.IO; +using System.Xml.Linq; + +namespace SampleTypeSpec +{ + /// + /// Base plant with discriminator + /// Please note this is the abstract base class. The derived classes available for instantiation are: . + /// + [PersistableModelProxy(typeof(UnknownPlant))] + public abstract partial class Plant + { + /// Initializes a new instance of for deserialization. + internal Plant() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Plant PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (Stream dataStream = data.ToStream()) + { + return DeserializePlant(XElement.Load(dataStream, LoadOptions.PreserveWhitespace), options); + } + default: + throw new FormatException($"The model {nameof(Plant)} does not support reading '{options.Format}' format."); + } + } + + /// The xml element to deserialize. + /// The client options for reading and writing models. + internal static Plant DeserializePlant(XElement element, ModelReaderWriterOptions options) + { + if (element == null) + { + return null; + } + + XElement discriminatorElement = element.Element("species"); + if (discriminatorElement != null) + { + switch ((string)discriminatorElement) + { + case "tree": + return Tree.DeserializeTree(element, options); + } + } + return UnknownPlant.DeserializeUnknownPlant(element, options); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.cs new file mode 100644 index 00000000000..cb9bb91da1d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// + /// Base plant with discriminator + /// Please note this is the abstract base class. The derived classes available for instantiation are: . + /// + public abstract partial class Plant + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + private protected Plant(string species, string id, int height) + { + Species = species; + Id = id; + Height = height; + } + + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// Keeps track of any properties unknown to the library. + internal Plant(string species, string id, int height, IDictionary additionalBinaryDataProperties) + { + Species = species; + Id = id; + Height = height; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The species of plant. + internal string Species { get; set; } + + /// The unique identifier of the plant. + public string Id { get; } + + /// The height of the plant in centimeters. + public int Height { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs index 667d863ca58..ec084524432 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RenamedModelCustom.Serialization.cs @@ -22,6 +22,31 @@ internal RenamedModelCustom() { } + /// The data to parse. + /// The client options for reading and writing models. + protected override Friend PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeRenamedModelCustom(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RenamedModelCustom)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator RenamedModelCustom(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRenamedModelCustom(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -113,23 +138,6 @@ protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. RenamedModelCustom IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (RenamedModelCustom)PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected override Friend PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeRenamedModelCustom(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RenamedModelCustom)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; @@ -142,13 +150,5 @@ public static implicit operator BinaryContent(RenamedModelCustom renamedModelCus } return BinaryContent.Create(renamedModelCustom, ModelSerializationExtensions.WireOptions); } - - /// The to deserialize the from. - public static explicit operator RenamedModelCustom(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRenamedModelCustom(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs index 28685cb3e92..9bfad705646 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs @@ -16,6 +16,31 @@ namespace SampleTypeSpec /// The ReturnsAnonymousModelResponse. public partial class ReturnsAnonymousModelResponse : IJsonModel { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ReturnsAnonymousModelResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeReturnsAnonymousModelResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ReturnsAnonymousModelResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator ReturnsAnonymousModelResponse(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeReturnsAnonymousModelResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -107,32 +132,7 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. ReturnsAnonymousModelResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual ReturnsAnonymousModelResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeReturnsAnonymousModelResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ReturnsAnonymousModelResponse)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator ReturnsAnonymousModelResponse(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeReturnsAnonymousModelResponse(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs index 59152f4ac49..569577f9543 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs @@ -21,6 +21,31 @@ internal RoundTripModel() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RoundTripModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeRoundTripModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RoundTripModel)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator RoundTripModel(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRoundTripModel(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -625,23 +650,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. RoundTripModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual RoundTripModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeRoundTripModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RoundTripModel)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; @@ -654,13 +662,5 @@ public static implicit operator BinaryContent(RoundTripModel roundTripModel) } return BinaryContent.Create(roundTripModel, ModelSerializationExtensions.WireOptions); } - - /// The to deserialize the from. - public static explicit operator RoundTripModel(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRoundTripModel(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs index 2a2fe6a977f..1e4f6317497 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs @@ -28,12 +28,18 @@ namespace SampleTypeSpec [ModelReaderWriterBuildable(typeof(ModelWithRequiredNullableProperties))] [ModelReaderWriterBuildable(typeof(PageThing))] [ModelReaderWriterBuildable(typeof(Pet))] + [ModelReaderWriterBuildable(typeof(Plant))] [ModelReaderWriterBuildable(typeof(RenamedModelCustom))] [ModelReaderWriterBuildable(typeof(ReturnsAnonymousModelResponse))] [ModelReaderWriterBuildable(typeof(RoundTripModel))] [ModelReaderWriterBuildable(typeof(Thing))] + [ModelReaderWriterBuildable(typeof(Tree))] [ModelReaderWriterBuildable(typeof(UnknownAnimal))] [ModelReaderWriterBuildable(typeof(UnknownPet))] + [ModelReaderWriterBuildable(typeof(UnknownPlant))] + [ModelReaderWriterBuildable(typeof(XmlAdvancedModel))] + [ModelReaderWriterBuildable(typeof(XmlItem))] + [ModelReaderWriterBuildable(typeof(XmlNestedModel))] public partial class SampleTypeSpecContext : ModelReaderWriterContext { } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs index cc309d6d3ad..36d8bd8a023 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Thing.Serialization.cs @@ -21,6 +21,31 @@ internal Thing() { } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Thing PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeThing(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Thing)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator Thing(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeThing(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -372,23 +397,6 @@ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. Thing IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected virtual Thing PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeThing(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Thing)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; @@ -401,13 +409,5 @@ public static implicit operator BinaryContent(Thing thing) } return BinaryContent.Create(thing, ModelSerializationExtensions.WireOptions); } - - /// The to deserialize the from. - public static explicit operator Thing(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeThing(document.RootElement, ModelSerializationExtensions.WireOptions); - } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs new file mode 100644 index 00000000000..43988081548 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; + +namespace SampleTypeSpec +{ + /// Tree is a specific type of plant. + public partial class Tree : Plant + { + /// Initializes a new instance of for deserialization. + internal Tree() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected override Plant PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (Stream dataStream = data.ToStream()) + { + return DeserializeTree(XElement.Load(dataStream, LoadOptions.PreserveWhitespace), options); + } + default: + throw new FormatException($"The model {nameof(Tree)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator Tree(ClientResult result) + { + using PipelineResponse response = result.GetRawResponse(); + using Stream stream = response.ContentStream; + if (stream == null) + { + return default; + } + + return DeserializeTree(XElement.Load(stream, LoadOptions.PreserveWhitespace), ModelSerializationExtensions.WireOptions); + } + + /// The xml element to deserialize. + /// The client options for reading and writing models. + internal static Tree DeserializeTree(XElement element, ModelReaderWriterOptions options) + { + if (element == null) + { + return null; + } + + string species = "tree"; + string id = default; + int height = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + int age = default; + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if (localName == "species") + { + species = (string)child; + continue; + } + if (localName == "id") + { + id = (string)child; + continue; + } + if (localName == "height") + { + height = (int)child; + continue; + } + if (localName == "age") + { + age = (int)child; + continue; + } + } + return new Tree(species, id, height, additionalBinaryDataProperties, age); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.cs new file mode 100644 index 00000000000..58ad9ded32e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// Tree is a specific type of plant. + public partial class Tree : Plant + { + /// Initializes a new instance of . + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// The age of the tree in years. + internal Tree(string id, int height, int age) : base("tree", id, height) + { + Age = age; + } + + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// Keeps track of any properties unknown to the library. + /// The age of the tree in years. + internal Tree(string species, string id, int height, IDictionary additionalBinaryDataProperties, int age) : base(species, id, height, additionalBinaryDataProperties) + { + Age = age; + } + + /// The age of the tree in years. + public int Age { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownAnimal.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownAnimal.Serialization.cs index 535dd928e85..02f798558f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownAnimal.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownAnimal.Serialization.cs @@ -19,6 +19,23 @@ internal UnknownAnimal() { } + /// The data to parse. + /// The client options for reading and writing models. + protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAnimal(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Animal)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -108,23 +125,6 @@ protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. Animal IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeAnimal(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Animal)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPet.Serialization.cs index b0074ad04b3..6a2c3ad5adc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPet.Serialization.cs @@ -19,6 +19,23 @@ internal UnknownPet() { } + /// The data to parse. + /// The client options for reading and writing models. + protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePet(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Pet)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) @@ -114,23 +131,6 @@ protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions /// The client options for reading and writing models. Pet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (UnknownPet)PersistableModelCreateCore(data, options); - /// The data to parse. - /// The client options for reading and writing models. - protected override Animal PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializePet(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Pet)} does not support reading '{options.Format}' format."); - } - } - /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs new file mode 100644 index 00000000000..cfaa979b6ce --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; + +namespace SampleTypeSpec +{ + internal partial class UnknownPlant : Plant + { + /// Initializes a new instance of for deserialization. + internal UnknownPlant() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected override Plant PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (Stream dataStream = data.ToStream()) + { + return DeserializePlant(XElement.Load(dataStream, LoadOptions.PreserveWhitespace), options); + } + default: + throw new FormatException($"The model {nameof(Plant)} does not support reading '{options.Format}' format."); + } + } + + /// The xml element to deserialize. + /// The client options for reading and writing models. + internal static UnknownPlant DeserializeUnknownPlant(XElement element, ModelReaderWriterOptions options) + { + if (element == null) + { + return null; + } + + string species = "unknown"; + string id = default; + int height = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if (localName == "species") + { + species = (string)child; + continue; + } + if (localName == "id") + { + id = (string)child; + continue; + } + if (localName == "height") + { + height = (int)child; + continue; + } + } + return new UnknownPlant(species, id, height, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.cs new file mode 100644 index 00000000000..3b2b318e66f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + internal partial class UnknownPlant : Plant + { + /// Initializes a new instance of . + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// Keeps track of any properties unknown to the library. + internal UnknownPlant(string species, string id, int height, IDictionary additionalBinaryDataProperties) : base(species ?? "unknown", id, height, additionalBinaryDataProperties) + { + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs new file mode 100644 index 00000000000..8d815eebdda --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; + +namespace SampleTypeSpec +{ + /// An advanced XML model for testing various property types and XML features. + public partial class XmlAdvancedModel + { + /// Initializes a new instance of for deserialization. + internal XmlAdvancedModel() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlAdvancedModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (Stream dataStream = data.ToStream()) + { + return DeserializeXmlAdvancedModel(XElement.Load(dataStream, LoadOptions.PreserveWhitespace), options); + } + default: + throw new FormatException($"The model {nameof(XmlAdvancedModel)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator XmlAdvancedModel(ClientResult result) + { + using PipelineResponse response = result.GetRawResponse(); + using Stream stream = response.ContentStream; + if (stream == null) + { + return default; + } + + return DeserializeXmlAdvancedModel(XElement.Load(stream, LoadOptions.PreserveWhitespace), ModelSerializationExtensions.WireOptions); + } + + /// The xml element to deserialize. + /// The client options for reading and writing models. + internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, ModelReaderWriterOptions options) + { + if (element == null) + { + return null; + } + + string name = default; + int age = default; + bool enabled = default; + float score = default; + string optionalString = default; + int? optionalInt = default; + string nullableString = default; + string id = default; + int version = default; + bool isActive = default; + string originalName = default; + string xmlIdentifier = default; + string content = default; + IList unwrappedStrings = default; + IList unwrappedCounts = default; + IList unwrappedItems = default; + IList wrappedColors = default; + IList items = default; + XmlNestedModel nestedModel = default; + XmlNestedModel optionalNestedModel = default; + IDictionary metadata = default; + DateTimeOffset createdAt = default; + TimeSpan duration = default; + BinaryData data = default; + IDictionary optionalRecordUnknown = default; + StringFixedEnum fixedEnum = default; + StringExtensibleEnum extensibleEnum = default; + IntFixedEnum? optionalFixedEnum = default; + IntExtensibleEnum? optionalExtensibleEnum = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + + foreach (var attr in element.Attributes()) + { + string localName = attr.Name.LocalName; + if (localName == "id") + { + id = (string)attr; + continue; + } + if (localName == "version") + { + version = (int)attr; + continue; + } + if (localName == "isActive") + { + isActive = (bool)attr; + continue; + } + if (localName == "xml-id") + { + xmlIdentifier = (string)attr; + continue; + } + } + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if (localName == "name") + { + name = (string)child; + continue; + } + if (localName == "age") + { + age = (int)child; + continue; + } + if (localName == "enabled") + { + enabled = (bool)child; + continue; + } + if (localName == "score") + { + score = (float)child; + continue; + } + if (localName == "optionalString") + { + optionalString = (string)child; + continue; + } + if (localName == "optionalInt") + { + optionalInt = (int?)child; + continue; + } + if (localName == "nullableString") + { + nullableString = (string)child; + continue; + } + if (localName == "RenamedProperty") + { + originalName = (string)child; + continue; + } + if (localName == "unwrappedStrings") + { + if (unwrappedStrings == null) + { + unwrappedStrings = new List(); + } + unwrappedStrings.Add((string)child); + continue; + } + if (localName == "unwrappedCounts") + { + if (unwrappedCounts == null) + { + unwrappedCounts = new List(); + } + unwrappedCounts.Add((int)child); + continue; + } + if (localName == "unwrappedItems") + { + if (unwrappedItems == null) + { + unwrappedItems = new List(); + } + unwrappedItems.Add(XmlItem.DeserializeXmlItem(child, options)); + continue; + } + if (localName == "wrappedColors") + { + List array = new List(); + foreach (var e in child.Elements("string")) + { + array.Add((string)e); + } + wrappedColors = array; + continue; + } + if (localName == "ItemCollection") + { + List array = new List(); + foreach (var e in child.Elements("Item")) + { + array.Add(XmlItem.DeserializeXmlItem(e, options)); + } + items = array; + continue; + } + if (localName == "nestedModel") + { + nestedModel = XmlNestedModel.DeserializeXmlNestedModel(child, options); + continue; + } + if (localName == "optionalNestedModel") + { + optionalNestedModel = XmlNestedModel.DeserializeXmlNestedModel(child, options); + continue; + } + if (localName == "metadata") + { + Dictionary dictionary = new Dictionary(); + foreach (var e in child.Elements()) + { + dictionary.Add(e.Name.LocalName, (string)e); + } + metadata = dictionary; + continue; + } + if (localName == "createdAt") + { + createdAt = child.GetDateTimeOffset("O"); + continue; + } + if (localName == "duration") + { + duration = child.GetTimeSpan("P"); + continue; + } + if (localName == "data") + { + data = BinaryData.FromBytes(child.GetBytesFromBase64("D")); + continue; + } + if (localName == "optionalRecordUnknown") + { + Dictionary dictionary = new Dictionary(); + foreach (var e in child.Elements()) + { + dictionary.Add(e.Name.LocalName, BinaryData.FromString(e.Value)); + } + optionalRecordUnknown = dictionary; + continue; + } + if (localName == "fixedEnum") + { + fixedEnum = ((string)child).ToStringFixedEnum(); + continue; + } + if (localName == "extensibleEnum") + { + extensibleEnum = new StringExtensibleEnum((string)child); + continue; + } + if (localName == "optionalFixedEnum") + { + optionalFixedEnum = ((int)child).ToIntFixedEnum(); + continue; + } + if (localName == "optionalExtensibleEnum") + { + optionalExtensibleEnum = new IntExtensibleEnum((int)child); + continue; + } + } + content = element.Value; + + return new XmlAdvancedModel( + name, + age, + enabled, + score, + optionalString, + optionalInt, + nullableString, + id, + version, + isActive, + originalName, + xmlIdentifier, + content, + unwrappedStrings, + unwrappedCounts, + unwrappedItems, + wrappedColors, + items, + nestedModel, + optionalNestedModel, + metadata, + createdAt, + duration, + data, + optionalRecordUnknown ?? new ChangeTrackingDictionary(), + fixedEnum, + extensibleEnum, + optionalFixedEnum, + optionalExtensibleEnum, + additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs new file mode 100644 index 00000000000..bc544f69e6e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// An advanced XML model for testing various property types and XML features. + public partial class XmlAdvancedModel + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// A simple string property. + /// An integer property. + /// A boolean property. + /// A float property. + /// A nullable string. + /// A string as XML attribute. + /// An integer as XML attribute. + /// A boolean as XML attribute. + /// A property with a custom XML element name. + /// An attribute with a custom XML name. + /// Text content in the element (unwrapped string). + /// An unwrapped array of strings - items appear directly without wrapper. + /// An unwrapped array of integers. + /// An unwrapped array of models. + /// A wrapped array of strings (default). + /// A wrapped array with custom wrapper name. + /// A nested model property. + /// A dictionary property. + /// A date-time property. + /// A duration property. + /// A bytes property. + /// A fixed enum property. + /// An extensible enum property. + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IEnumerable unwrappedStrings, IEnumerable unwrappedCounts, IEnumerable unwrappedItems, IEnumerable wrappedColors, IEnumerable items, XmlNestedModel nestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum) + { + Name = name; + Age = age; + Enabled = enabled; + Score = score; + NullableString = nullableString; + Id = id; + Version = version; + IsActive = isActive; + OriginalName = originalName; + XmlIdentifier = xmlIdentifier; + Content = content; + UnwrappedStrings = unwrappedStrings.ToList(); + UnwrappedCounts = unwrappedCounts.ToList(); + UnwrappedItems = unwrappedItems.ToList(); + WrappedColors = wrappedColors.ToList(); + Items = items.ToList(); + NestedModel = nestedModel; + Metadata = metadata; + CreatedAt = createdAt; + Duration = duration; + Data = data; + OptionalRecordUnknown = new ChangeTrackingDictionary(); + FixedEnum = fixedEnum; + ExtensibleEnum = extensibleEnum; + } + + /// Initializes a new instance of . + /// A simple string property. + /// An integer property. + /// A boolean property. + /// A float property. + /// An optional string. + /// An optional integer. + /// A nullable string. + /// A string as XML attribute. + /// An integer as XML attribute. + /// A boolean as XML attribute. + /// A property with a custom XML element name. + /// An attribute with a custom XML name. + /// Text content in the element (unwrapped string). + /// An unwrapped array of strings - items appear directly without wrapper. + /// An unwrapped array of integers. + /// An unwrapped array of models. + /// A wrapped array of strings (default). + /// A wrapped array with custom wrapper name. + /// A nested model property. + /// An optional nested model. + /// A dictionary property. + /// A date-time property. + /// A duration property. + /// A bytes property. + /// optional record of unknown. + /// A fixed enum property. + /// An extensible enum property. + /// An optional fixed enum property. + /// An optional extensible enum property. + /// Keeps track of any properties unknown to the library. + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string optionalString, int? optionalInt, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IList unwrappedStrings, IList unwrappedCounts, IList unwrappedItems, IList wrappedColors, IList items, XmlNestedModel nestedModel, XmlNestedModel optionalNestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, IDictionary optionalRecordUnknown, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, IntFixedEnum? optionalFixedEnum, IntExtensibleEnum? optionalExtensibleEnum, IDictionary additionalBinaryDataProperties) + { + Name = name; + Age = age; + Enabled = enabled; + Score = score; + OptionalString = optionalString; + OptionalInt = optionalInt; + NullableString = nullableString; + Id = id; + Version = version; + IsActive = isActive; + OriginalName = originalName; + XmlIdentifier = xmlIdentifier; + Content = content; + UnwrappedStrings = unwrappedStrings; + UnwrappedCounts = unwrappedCounts; + UnwrappedItems = unwrappedItems; + WrappedColors = wrappedColors; + Items = items; + NestedModel = nestedModel; + OptionalNestedModel = optionalNestedModel; + Metadata = metadata; + CreatedAt = createdAt; + Duration = duration; + Data = data; + OptionalRecordUnknown = optionalRecordUnknown; + FixedEnum = fixedEnum; + ExtensibleEnum = extensibleEnum; + OptionalFixedEnum = optionalFixedEnum; + OptionalExtensibleEnum = optionalExtensibleEnum; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A simple string property. + public string Name { get; } + + /// An integer property. + public int Age { get; } + + /// A boolean property. + public bool Enabled { get; } + + /// A float property. + public float Score { get; } + + /// An optional string. + public string OptionalString { get; } + + /// An optional integer. + public int? OptionalInt { get; } + + /// A nullable string. + public string NullableString { get; } + + /// A string as XML attribute. + public string Id { get; } + + /// An integer as XML attribute. + public int Version { get; } + + /// A boolean as XML attribute. + public bool IsActive { get; } + + /// A property with a custom XML element name. + public string OriginalName { get; } + + /// An attribute with a custom XML name. + public string XmlIdentifier { get; } + + /// Text content in the element (unwrapped string). + public string Content { get; } + + /// An unwrapped array of strings - items appear directly without wrapper. + public IList UnwrappedStrings { get; } + + /// An unwrapped array of integers. + public IList UnwrappedCounts { get; } + + /// An unwrapped array of models. + public IList UnwrappedItems { get; } + + /// A wrapped array of strings (default). + public IList WrappedColors { get; } + + /// A wrapped array with custom wrapper name. + public IList Items { get; } + + /// A nested model property. + public XmlNestedModel NestedModel { get; } + + /// An optional nested model. + public XmlNestedModel OptionalNestedModel { get; } + + /// A dictionary property. + public IDictionary Metadata { get; } + + /// A date-time property. + public DateTimeOffset CreatedAt { get; } + + /// A duration property. + public TimeSpan Duration { get; } + + /// + /// A bytes property + /// + /// To assign a byte[] to this property use . + /// The byte[] will be serialized to a Base64 encoded string. + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromBytes(new byte[] { 1, 2, 3 }). + /// Creates a payload of "AQID". + /// + /// + /// + /// + public BinaryData Data { get; } + + /// + /// optional record of unknown + /// To assign an object to the value of this property use . + /// To assign an already formatted json string to this property use . + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo"). + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\""). + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }). + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}"). + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IDictionary OptionalRecordUnknown { get; } + + /// A fixed enum property. + public StringFixedEnum FixedEnum { get; } + + /// An extensible enum property. + public StringExtensibleEnum ExtensibleEnum { get; } + + /// An optional fixed enum property. + public IntFixedEnum? OptionalFixedEnum { get; } + + /// An optional extensible enum property. + public IntExtensibleEnum? OptionalExtensibleEnum { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.Serialization.cs new file mode 100644 index 00000000000..7193aaf7514 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; + +namespace SampleTypeSpec +{ + /// An item model for XML array testing. + public partial class XmlItem + { + /// Initializes a new instance of for deserialization. + internal XmlItem() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlItem PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (Stream dataStream = data.ToStream()) + { + return DeserializeXmlItem(XElement.Load(dataStream, LoadOptions.PreserveWhitespace), options); + } + default: + throw new FormatException($"The model {nameof(XmlItem)} does not support reading '{options.Format}' format."); + } + } + + /// The xml element to deserialize. + /// The client options for reading and writing models. + internal static XmlItem DeserializeXmlItem(XElement element, ModelReaderWriterOptions options) + { + if (element == null) + { + return null; + } + + string itemName = default; + int itemValue = default; + string itemId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + + foreach (var attr in element.Attributes()) + { + string localName = attr.Name.LocalName; + if (localName == "itemId") + { + itemId = (string)attr; + continue; + } + } + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if (localName == "itemName") + { + itemName = (string)child; + continue; + } + if (localName == "itemValue") + { + itemValue = (int)child; + continue; + } + } + return new XmlItem(itemName, itemValue, itemId, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.cs new file mode 100644 index 00000000000..80e1f6264e0 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlItem.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// An item model for XML array testing. + public partial class XmlItem + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The item name. + /// The item value. + /// Item ID as attribute. + internal XmlItem(string itemName, int itemValue, string itemId) + { + ItemName = itemName; + ItemValue = itemValue; + ItemId = itemId; + } + + /// Initializes a new instance of . + /// The item name. + /// The item value. + /// Item ID as attribute. + /// Keeps track of any properties unknown to the library. + internal XmlItem(string itemName, int itemValue, string itemId, IDictionary additionalBinaryDataProperties) + { + ItemName = itemName; + ItemValue = itemValue; + ItemId = itemId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The item name. + public string ItemName { get; } + + /// The item value. + public int ItemValue { get; } + + /// Item ID as attribute. + public string ItemId { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.Serialization.cs new file mode 100644 index 00000000000..d1b5e34c9bf --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.Serialization.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; + +namespace SampleTypeSpec +{ + /// A nested model for XML testing. + public partial class XmlNestedModel + { + /// Initializes a new instance of for deserialization. + internal XmlNestedModel() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlNestedModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (Stream dataStream = data.ToStream()) + { + return DeserializeXmlNestedModel(XElement.Load(dataStream, LoadOptions.PreserveWhitespace), options); + } + default: + throw new FormatException($"The model {nameof(XmlNestedModel)} does not support reading '{options.Format}' format."); + } + } + + /// The xml element to deserialize. + /// The client options for reading and writing models. + internal static XmlNestedModel DeserializeXmlNestedModel(XElement element, ModelReaderWriterOptions options) + { + if (element == null) + { + return null; + } + + string value = default; + int nestedId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + + foreach (var attr in element.Attributes()) + { + string localName = attr.Name.LocalName; + if (localName == "nestedId") + { + nestedId = (int)attr; + continue; + } + } + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if (localName == "value") + { + value = (string)child; + continue; + } + } + return new XmlNestedModel(value, nestedId, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.cs new file mode 100644 index 00000000000..a0245f806ab --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlNestedModel.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// A nested model for XML testing. + public partial class XmlNestedModel + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The value of the nested model. + /// An attribute on the nested model. + internal XmlNestedModel(string value, int nestedId) + { + Value = value; + NestedId = nestedId; + } + + /// Initializes a new instance of . + /// The value of the nested model. + /// An attribute on the nested model. + /// Keeps track of any properties unknown to the library. + internal XmlNestedModel(string value, int nestedId, IDictionary additionalBinaryDataProperties) + { + Value = value; + NestedId = nestedId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The value of the nested model. + public string Value { get; } + + /// An attribute on the nested model. + public int NestedId { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs new file mode 100644 index 00000000000..5c9c1b8aaf4 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace SampleTypeSpec +{ + /// + public partial class PlantOperations + { + private static PipelineMessageClassifier _pipelineMessageClassifier200; + + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + + internal PipelineMessage CreateGetTreeRequest(RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/plants/tree/as-plant", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200); + PipelineRequest request = message.Request; + request.Headers.Set("Accept", "application/xml"); + message.Apply(options); + return message; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs new file mode 100644 index 00000000000..184684e4ba6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; + +namespace SampleTypeSpec +{ + /// The PlantOperations sub-client. + public partial class PlantOperations + { + private readonly Uri _endpoint; + + /// Initializes a new instance of PlantOperations for mocking. + protected PlantOperations() + { + } + + /// Initializes a new instance of PlantOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + internal PlantOperations(ClientPipeline pipeline, Uri endpoint) + { + _endpoint = endpoint; + Pipeline = pipeline; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } + + /// + /// [Protocol Method] Get a tree as a plant + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetTree(RequestOptions options) + { + using PipelineMessage message = CreateGetTreeRequest(options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] Get a tree as a plant + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetTreeAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetTreeRequest(options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// Get a tree as a plant. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual ClientResult GetTree(CancellationToken cancellationToken = default) + { + ClientResult result = GetTree(cancellationToken.ToRequestOptions()); + return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + } + + /// Get a tree as a plant. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task> GetTreeAsync(CancellationToken cancellationToken = default) + { + ClientResult result = await GetTreeAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue((Tree)result, result.GetRawResponse()); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.RestClient.cs index ef5e2f87d29..808b5d40608 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.RestClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.RestClient.cs @@ -406,5 +406,17 @@ internal PipelineMessage CreateDynamicModelOperationRequest(BinaryContent conten message.Apply(options); return message; } + + internal PipelineMessage CreateGetXmlAdvancedModelRequest(RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/xmlAdvanced", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200); + PipelineRequest request = message.Request; + request.Headers.Set("Accept", "application/xml"); + message.Apply(options); + return message; + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs index 83acde20eb0..ee2db0406fc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs @@ -39,6 +39,7 @@ public partial class SampleTypeSpecClient private AnimalOperations _cachedAnimalOperations; private PetOperations _cachedPetOperations; private DogOperations _cachedDogOperations; + private PlantOperations _cachedPlantOperations; private Metrics _cachedMetrics; /// Initializes a new instance of SampleTypeSpecClient for mocking. @@ -1735,6 +1736,58 @@ public virtual async Task DynamicModelOperationAsync(DynamicModel return await DynamicModelOperationAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); } + /// + /// [Protocol Method] Get an advanced XML model with various property types + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult GetXmlAdvancedModel(RequestOptions options) + { + using PipelineMessage message = CreateGetXmlAdvancedModelRequest(options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] Get an advanced XML model with various property types + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetXmlAdvancedModelAsync(RequestOptions options) + { + using PipelineMessage message = CreateGetXmlAdvancedModelRequest(options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// Get an advanced XML model with various property types. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual ClientResult GetXmlAdvancedModel(CancellationToken cancellationToken = default) + { + ClientResult result = GetXmlAdvancedModel(cancellationToken.ToRequestOptions()); + return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + } + + /// Get an advanced XML model with various property types. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task> GetXmlAdvancedModelAsync(CancellationToken cancellationToken = default) + { + ClientResult result = await GetXmlAdvancedModelAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse()); + } + /// Initializes a new instance of AnimalOperations. public virtual AnimalOperations GetAnimalOperationsClient() { @@ -1753,6 +1806,12 @@ public virtual DogOperations GetDogOperationsClient() return Volatile.Read(ref _cachedDogOperations) ?? Interlocked.CompareExchange(ref _cachedDogOperations, new DogOperations(Pipeline, _endpoint), null) ?? _cachedDogOperations; } + /// Initializes a new instance of PlantOperations. + public virtual PlantOperations GetPlantOperationsClient() + { + return Volatile.Read(ref _cachedPlantOperations) ?? Interlocked.CompareExchange(ref _cachedPlantOperations, new PlantOperations(Pipeline, _endpoint), null) ?? _cachedPlantOperations; + } + /// Initializes a new instance of Metrics. public virtual Metrics GetMetricsClient() { diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs index f8616b3f57e..a696916968d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs @@ -236,6 +236,99 @@ public static AnotherDynamicModel AnotherDynamicModel(string bar = default) return new AnotherDynamicModel(bar, default); } + /// An advanced XML model for testing various property types and XML features. + /// A simple string property. + /// An integer property. + /// A boolean property. + /// A float property. + /// An optional string. + /// An optional integer. + /// A nullable string. + /// A string as XML attribute. + /// An integer as XML attribute. + /// A boolean as XML attribute. + /// A property with a custom XML element name. + /// An attribute with a custom XML name. + /// Text content in the element (unwrapped string). + /// An unwrapped array of strings - items appear directly without wrapper. + /// An unwrapped array of integers. + /// An unwrapped array of models. + /// A wrapped array of strings (default). + /// A wrapped array with custom wrapper name. + /// A nested model property. + /// An optional nested model. + /// A dictionary property. + /// A date-time property. + /// A duration property. + /// A bytes property. + /// optional record of unknown. + /// A fixed enum property. + /// An extensible enum property. + /// An optional fixed enum property. + /// An optional extensible enum property. + /// A new instance for mocking. + public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = default, bool enabled = default, float score = default, string optionalString = default, int? optionalInt = default, string nullableString = default, string id = default, int version = default, bool isActive = default, string originalName = default, string xmlIdentifier = default, string content = default, IEnumerable unwrappedStrings = default, IEnumerable unwrappedCounts = default, IEnumerable unwrappedItems = default, IEnumerable wrappedColors = default, IEnumerable items = default, XmlNestedModel nestedModel = default, XmlNestedModel optionalNestedModel = default, IDictionary metadata = default, DateTimeOffset createdAt = default, TimeSpan duration = default, BinaryData data = default, IDictionary optionalRecordUnknown = default, StringFixedEnum fixedEnum = default, StringExtensibleEnum extensibleEnum = default, IntFixedEnum? optionalFixedEnum = default, IntExtensibleEnum? optionalExtensibleEnum = default) + { + unwrappedStrings ??= new ChangeTrackingList(); + unwrappedCounts ??= new ChangeTrackingList(); + unwrappedItems ??= new ChangeTrackingList(); + wrappedColors ??= new ChangeTrackingList(); + items ??= new ChangeTrackingList(); + metadata ??= new ChangeTrackingDictionary(); + optionalRecordUnknown ??= new ChangeTrackingDictionary(); + + return new XmlAdvancedModel( + name, + age, + enabled, + score, + optionalString, + optionalInt, + nullableString, + id, + version, + isActive, + originalName, + xmlIdentifier, + content, + unwrappedStrings.ToList(), + unwrappedCounts.ToList(), + unwrappedItems.ToList(), + wrappedColors.ToList(), + items.ToList(), + nestedModel, + optionalNestedModel, + metadata, + createdAt, + duration, + data, + optionalRecordUnknown, + fixedEnum, + extensibleEnum, + optionalFixedEnum, + optionalExtensibleEnum, + additionalBinaryDataProperties: null); + } + + /// An item model for XML array testing. + /// The item name. + /// The item value. + /// Item ID as attribute. + /// A new instance for mocking. + public static XmlItem XmlItem(string itemName = default, int itemValue = default, string itemId = default) + { + return new XmlItem(itemName, itemValue, itemId, additionalBinaryDataProperties: null); + } + + /// A nested model for XML testing. + /// The value of the nested model. + /// An attribute on the nested model. + /// A new instance for mocking. + public static XmlNestedModel XmlNestedModel(string value = default, int nestedId = default) + { + return new XmlNestedModel(value, nestedId, additionalBinaryDataProperties: null); + } + /// /// Base animal with discriminator /// Please note this is the abstract base class. The derived classes available for instantiation are: and . @@ -267,6 +360,29 @@ public static Dog Dog(string name = default, bool trained = default, string bree return new Dog("pet", name, additionalBinaryDataProperties: null, trained, breed); } + /// Tree is a specific type of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// The age of the tree in years. + /// A new instance for mocking. + public static Tree Tree(string id = default, int height = default, int age = default) + { + return new Tree("tree", id, height, additionalBinaryDataProperties: null, age); + } + + /// + /// Base plant with discriminator + /// Please note this is the abstract base class. The derived classes available for instantiation are: . + /// + /// The species of plant. + /// The unique identifier of the plant. + /// The height of the plant in centimeters. + /// A new instance for mocking. + public static Plant Plant(string species = default, string id = default, int height = default) + { + return new UnknownPlant(species, id, height, additionalBinaryDataProperties: null); + } + /// The GetWidgetMetricsResponse. /// /// diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json index 43e7b9552c0..3e91444def8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json @@ -214,7 +214,7 @@ "doc": "Simple enum", "isFixed": true, "isFlags": false, - "usage": "Input,Output,Json", + "usage": "Input,Output,Json,Xml", "decorators": [] }, { @@ -274,7 +274,7 @@ "doc": "Extensible enum", "isFixed": false, "isFlags": false, - "usage": "Input,Output,Json", + "usage": "Input,Output,Json,Xml", "decorators": [] }, { @@ -334,7 +334,7 @@ "doc": "Int based extensible enum", "isFixed": false, "isFlags": false, - "usage": "Input,Output,Json", + "usage": "Input,Output,Json,Xml", "decorators": [] }, { @@ -634,7 +634,7 @@ "doc": "int fixed enum", "isFixed": true, "isFlags": false, - "usage": "Input,Output,Json", + "usage": "Input,Output,Json,Xml", "decorators": [] }, { @@ -911,9 +911,9 @@ { "$id": "84", "kind": "constant", - "name": "sayHiContentType", - "namespace": "", - "usage": "None", + "name": "TreeSpecies", + "namespace": "SampleTypeSpec", + "usage": "Output,Xml", "valueType": { "$id": "85", "kind": "string", @@ -921,13 +921,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/json", + "value": "tree", "decorators": [] }, { "$id": "86", "kind": "constant", - "name": "HelloAgainRequestContentType", + "name": "sayHiContentType", "namespace": "", "usage": "None", "valueType": { @@ -937,13 +937,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "text/plain", + "value": "application/json", "decorators": [] }, { "$id": "88", "kind": "constant", - "name": "helloAgainContentType", + "name": "HelloAgainRequestContentType", "namespace": "", "usage": "None", "valueType": { @@ -953,13 +953,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/json", + "value": "text/plain", "decorators": [] }, { "$id": "90", "kind": "constant", - "name": "HelloAgainRequestContentType1", + "name": "helloAgainContentType", "namespace": "", "usage": "None", "valueType": { @@ -969,13 +969,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "text/plain", + "value": "application/json", "decorators": [] }, { "$id": "92", "kind": "constant", - "name": "noContentTypeContentType", + "name": "HelloAgainRequestContentType1", "namespace": "", "usage": "None", "valueType": { @@ -985,13 +985,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/json", + "value": "text/plain", "decorators": [] }, { "$id": "94", "kind": "constant", - "name": "noContentTypeContentType1", + "name": "noContentTypeContentType", "namespace": "", "usage": "None", "valueType": { @@ -1007,7 +1007,7 @@ { "$id": "96", "kind": "constant", - "name": "helloDemo2ContentType", + "name": "noContentTypeContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1023,7 +1023,7 @@ { "$id": "98", "kind": "constant", - "name": "createLiteralContentType", + "name": "helloDemo2ContentType", "namespace": "", "usage": "None", "valueType": { @@ -1039,7 +1039,7 @@ { "$id": "100", "kind": "constant", - "name": "createLiteralContentType1", + "name": "createLiteralContentType", "namespace": "", "usage": "None", "valueType": { @@ -1055,7 +1055,7 @@ { "$id": "102", "kind": "constant", - "name": "HelloLiteralRequestP1", + "name": "createLiteralContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1065,17 +1065,33 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "test", + "value": "application/json", "decorators": [] }, { "$id": "104", "kind": "constant", - "name": "ThingRequiredLiteralInt1", + "name": "HelloLiteralRequestP1", "namespace": "", "usage": "None", "valueType": { "$id": "105", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "test", + "decorators": [] + }, + { + "$id": "106", + "kind": "constant", + "name": "ThingRequiredLiteralInt1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "107", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -1085,13 +1101,13 @@ "decorators": [] }, { - "$id": "106", + "$id": "108", "kind": "constant", "name": "ThingOptionalLiteralBool1", "namespace": "", "usage": "None", "valueType": { - "$id": "107", + "$id": "109", "kind": "boolean", "name": "boolean", "crossLanguageDefinitionId": "TypeSpec.boolean", @@ -1101,13 +1117,13 @@ "decorators": [] }, { - "$id": "108", + "$id": "110", "kind": "constant", "name": "helloLiteralContentType", "namespace": "", "usage": "None", "valueType": { - "$id": "109", + "$id": "111", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1117,13 +1133,13 @@ "decorators": [] }, { - "$id": "110", + "$id": "112", "kind": "constant", "name": "HelloLiteralRequestP11", "namespace": "", "usage": "None", "valueType": { - "$id": "111", + "$id": "113", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1133,13 +1149,13 @@ "decorators": [] }, { - "$id": "112", + "$id": "114", "kind": "constant", "name": "ThingRequiredLiteralInt2", "namespace": "", "usage": "None", "valueType": { - "$id": "113", + "$id": "115", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -1149,13 +1165,13 @@ "decorators": [] }, { - "$id": "114", + "$id": "116", "kind": "constant", "name": "ThingOptionalLiteralBool2", "namespace": "", "usage": "None", "valueType": { - "$id": "115", + "$id": "117", "kind": "boolean", "name": "boolean", "crossLanguageDefinitionId": "TypeSpec.boolean", @@ -1165,13 +1181,13 @@ "decorators": [] }, { - "$id": "116", + "$id": "118", "kind": "constant", "name": "topActionContentType", "namespace": "", "usage": "None", "valueType": { - "$id": "117", + "$id": "119", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1181,13 +1197,13 @@ "decorators": [] }, { - "$id": "118", + "$id": "120", "kind": "constant", "name": "topAction2ContentType", "namespace": "", "usage": "None", "valueType": { - "$id": "119", + "$id": "121", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1197,13 +1213,13 @@ "decorators": [] }, { - "$id": "120", + "$id": "122", "kind": "constant", "name": "patchActionContentType", "namespace": "", "usage": "None", "valueType": { - "$id": "121", + "$id": "123", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1213,13 +1229,13 @@ "decorators": [] }, { - "$id": "122", + "$id": "124", "kind": "constant", "name": "patchActionContentType1", "namespace": "", "usage": "None", "valueType": { - "$id": "123", + "$id": "125", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1229,13 +1245,13 @@ "decorators": [] }, { - "$id": "124", + "$id": "126", "kind": "constant", "name": "AnonymousBodyRequestRequiredQueryParam", "namespace": "", "usage": "None", "valueType": { - "$id": "125", + "$id": "127", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1245,13 +1261,13 @@ "decorators": [] }, { - "$id": "126", + "$id": "128", "kind": "constant", "name": "AnonymousBodyRequestRequiredHeader", "namespace": "", "usage": "None", "valueType": { - "$id": "127", + "$id": "129", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1261,13 +1277,13 @@ "decorators": [] }, { - "$id": "128", + "$id": "130", "kind": "constant", "name": "anonymousBodyContentType", "namespace": "", "usage": "None", "valueType": { - "$id": "129", + "$id": "131", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1277,13 +1293,13 @@ "decorators": [] }, { - "$id": "130", + "$id": "132", "kind": "constant", "name": "anonymousBodyContentType1", "namespace": "", "usage": "None", "valueType": { - "$id": "131", + "$id": "133", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1293,13 +1309,13 @@ "decorators": [] }, { - "$id": "132", + "$id": "134", "kind": "constant", "name": "ThingRequiredLiteralString1", "namespace": "", "usage": "None", "valueType": { - "$id": "133", + "$id": "135", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1309,13 +1325,13 @@ "decorators": [] }, { - "$id": "134", + "$id": "136", "kind": "constant", "name": "ThingRequiredLiteralInt3", "namespace": "", "usage": "None", "valueType": { - "$id": "135", + "$id": "137", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -1325,13 +1341,13 @@ "decorators": [] }, { - "$id": "136", + "$id": "138", "kind": "constant", "name": "ThingRequiredLiteralFloat1", "namespace": "", "usage": "None", "valueType": { - "$id": "137", + "$id": "139", "kind": "float32", "name": "float32", "crossLanguageDefinitionId": "TypeSpec.float32", @@ -1341,13 +1357,13 @@ "decorators": [] }, { - "$id": "138", + "$id": "140", "kind": "constant", "name": "ThingRequiredLiteralBool1", "namespace": "", "usage": "None", "valueType": { - "$id": "139", + "$id": "141", "kind": "boolean", "name": "boolean", "crossLanguageDefinitionId": "TypeSpec.boolean", @@ -1357,13 +1373,13 @@ "decorators": [] }, { - "$id": "140", + "$id": "142", "kind": "constant", "name": "ThingOptionalLiteralBool3", "namespace": "", "usage": "None", "valueType": { - "$id": "141", + "$id": "143", "kind": "boolean", "name": "boolean", "crossLanguageDefinitionId": "TypeSpec.boolean", @@ -1372,26 +1388,10 @@ "value": true, "decorators": [] }, - { - "$id": "142", - "kind": "constant", - "name": "AnonymousBodyRequestRequiredQueryParam1", - "namespace": "", - "usage": "None", - "valueType": { - "$id": "143", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "value": "someRequiredLiteralQueryParam", - "decorators": [] - }, { "$id": "144", "kind": "constant", - "name": "AnonymousBodyRequestRequiredHeader1", + "name": "AnonymousBodyRequestRequiredQueryParam1", "namespace": "", "usage": "None", "valueType": { @@ -1401,13 +1401,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "someRequiredLiteralHeader", + "value": "someRequiredLiteralQueryParam", "decorators": [] }, { "$id": "146", "kind": "constant", - "name": "friendlyModelContentType", + "name": "AnonymousBodyRequestRequiredHeader1", "namespace": "", "usage": "None", "valueType": { @@ -1417,13 +1417,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/json", + "value": "someRequiredLiteralHeader", "decorators": [] }, { "$id": "148", "kind": "constant", - "name": "friendlyModelContentType1", + "name": "friendlyModelContentType", "namespace": "", "usage": "None", "valueType": { @@ -1439,7 +1439,7 @@ { "$id": "150", "kind": "constant", - "name": "projectedNameModelContentType", + "name": "friendlyModelContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1455,7 +1455,7 @@ { "$id": "152", "kind": "constant", - "name": "projectedNameModelContentType1", + "name": "projectedNameModelContentType", "namespace": "", "usage": "None", "valueType": { @@ -1471,7 +1471,7 @@ { "$id": "154", "kind": "constant", - "name": "returnsAnonymousModelContentType", + "name": "projectedNameModelContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1487,7 +1487,7 @@ { "$id": "156", "kind": "constant", - "name": "internalProtocolContentType", + "name": "returnsAnonymousModelContentType", "namespace": "", "usage": "None", "valueType": { @@ -1503,7 +1503,7 @@ { "$id": "158", "kind": "constant", - "name": "internalProtocolContentType1", + "name": "internalProtocolContentType", "namespace": "", "usage": "None", "valueType": { @@ -1519,7 +1519,7 @@ { "$id": "160", "kind": "constant", - "name": "ListWithNextLinkContentType", + "name": "internalProtocolContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1535,7 +1535,7 @@ { "$id": "162", "kind": "constant", - "name": "ListWithStringNextLinkContentType", + "name": "ListWithNextLinkContentType", "namespace": "", "usage": "None", "valueType": { @@ -1551,7 +1551,7 @@ { "$id": "164", "kind": "constant", - "name": "ListWithContinuationTokenContentType", + "name": "ListWithStringNextLinkContentType", "namespace": "", "usage": "None", "valueType": { @@ -1567,7 +1567,7 @@ { "$id": "166", "kind": "constant", - "name": "ListWithContinuationTokenHeaderResponseContentType", + "name": "ListWithContinuationTokenContentType", "namespace": "", "usage": "None", "valueType": { @@ -1583,7 +1583,7 @@ { "$id": "168", "kind": "constant", - "name": "ListWithPagingContentType", + "name": "ListWithContinuationTokenHeaderResponseContentType", "namespace": "", "usage": "None", "valueType": { @@ -1599,7 +1599,7 @@ { "$id": "170", "kind": "constant", - "name": "EmbeddedParametersContentType", + "name": "ListWithPagingContentType", "namespace": "", "usage": "None", "valueType": { @@ -1615,7 +1615,7 @@ { "$id": "172", "kind": "constant", - "name": "DynamicModelOperationContentType", + "name": "EmbeddedParametersContentType", "namespace": "", "usage": "None", "valueType": { @@ -1631,7 +1631,7 @@ { "$id": "174", "kind": "constant", - "name": "updatePetAsAnimalContentType", + "name": "DynamicModelOperationContentType", "namespace": "", "usage": "None", "valueType": { @@ -1647,7 +1647,7 @@ { "$id": "176", "kind": "constant", - "name": "updatePetAsAnimalContentType1", + "name": "GetXmlAdvancedModelContentType", "namespace": "", "usage": "None", "valueType": { @@ -1657,13 +1657,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/json", + "value": "application/xml", "decorators": [] }, { "$id": "178", "kind": "constant", - "name": "updateDogAsAnimalContentType", + "name": "GetXmlAdvancedModelResponseContentType", "namespace": "", "usage": "None", "valueType": { @@ -1673,13 +1673,13 @@ "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/json", + "value": "application/xml", "decorators": [] }, { "$id": "180", "kind": "constant", - "name": "updateDogAsAnimalContentType1", + "name": "updatePetAsAnimalContentType", "namespace": "", "usage": "None", "valueType": { @@ -1695,7 +1695,7 @@ { "$id": "182", "kind": "constant", - "name": "updatePetAsPetContentType", + "name": "updatePetAsAnimalContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1711,7 +1711,7 @@ { "$id": "184", "kind": "constant", - "name": "updatePetAsPetContentType1", + "name": "updateDogAsAnimalContentType", "namespace": "", "usage": "None", "valueType": { @@ -1727,7 +1727,7 @@ { "$id": "186", "kind": "constant", - "name": "updateDogAsPetContentType", + "name": "updateDogAsAnimalContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1743,7 +1743,7 @@ { "$id": "188", "kind": "constant", - "name": "updateDogAsPetContentType1", + "name": "updatePetAsPetContentType", "namespace": "", "usage": "None", "valueType": { @@ -1759,7 +1759,7 @@ { "$id": "190", "kind": "constant", - "name": "updateDogAsDogContentType", + "name": "updatePetAsPetContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1775,7 +1775,7 @@ { "$id": "192", "kind": "constant", - "name": "updateDogAsDogContentType1", + "name": "updateDogAsPetContentType", "namespace": "", "usage": "None", "valueType": { @@ -1791,7 +1791,7 @@ { "$id": "194", "kind": "constant", - "name": "getWidgetMetricsContentType", + "name": "updateDogAsPetContentType1", "namespace": "", "usage": "None", "valueType": { @@ -1803,74 +1803,154 @@ }, "value": "application/json", "decorators": [] - } - ], - "models": [ + }, { "$id": "196", - "kind": "model", - "name": "Thing", - "namespace": "SampleTypeSpec", - "crossLanguageDefinitionId": "SampleTypeSpec.Thing", - "usage": "Input,Output,Spread,Json", - "doc": "A model with a few properties of literal types", - "decorators": [], - "serializationOptions": { - "json": { - "name": "Thing" - } + "kind": "constant", + "name": "updateDogAsDogContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "197", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] }, - "properties": [ - { - "$id": "197", - "kind": "property", - "name": "name", - "serializedName": "name", - "doc": "name of the Thing", - "type": { - "$id": "198", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "optional": false, - "readOnly": false, - "discriminator": false, - "flatten": false, - "decorators": [], - "crossLanguageDefinitionId": "SampleTypeSpec.Thing.name", - "serializationOptions": { - "json": { - "name": "name" - } - }, - "isHttpMetadata": false - }, - { - "$id": "199", - "kind": "property", - "name": "requiredUnion", - "serializedName": "requiredUnion", - "doc": "required Union", - "type": { - "$id": "200", - "kind": "union", - "name": "ThingRequiredUnion", + "value": "application/json", + "decorators": [] + }, + { + "$id": "198", + "kind": "constant", + "name": "updateDogAsDogContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "199", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "200", + "kind": "constant", + "name": "getTreeContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "201", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/xml", + "decorators": [] + }, + { + "$id": "202", + "kind": "constant", + "name": "GetXmlAdvancedModelResponseContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "203", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/xml", + "decorators": [] + }, + { + "$id": "204", + "kind": "constant", + "name": "getWidgetMetricsContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "205", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + } + ], + "models": [ + { + "$id": "206", + "kind": "model", + "name": "Thing", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.Thing", + "usage": "Input,Output,Spread,Json", + "doc": "A model with a few properties of literal types", + "decorators": [], + "serializationOptions": { + "json": { + "name": "Thing" + } + }, + "properties": [ + { + "$id": "207", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "name of the Thing", + "type": { + "$id": "208", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Thing.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + }, + { + "$id": "209", + "kind": "property", + "name": "requiredUnion", + "serializedName": "requiredUnion", + "doc": "required Union", + "type": { + "$id": "210", + "kind": "union", + "name": "ThingRequiredUnion", "variantTypes": [ { - "$id": "201", + "$id": "211", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, { - "$id": "202", + "$id": "212", "kind": "array", "name": "Array", "valueType": { - "$id": "203", + "$id": "213", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1880,7 +1960,7 @@ "decorators": [] }, { - "$id": "204", + "$id": "214", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -1904,7 +1984,7 @@ "isHttpMetadata": false }, { - "$id": "205", + "$id": "215", "kind": "property", "name": "requiredLiteralString", "serializedName": "requiredLiteralString", @@ -1926,16 +2006,16 @@ "isHttpMetadata": false }, { - "$id": "206", + "$id": "216", "kind": "property", "name": "requiredNullableString", "serializedName": "requiredNullableString", "doc": "required nullable string", "type": { - "$id": "207", + "$id": "217", "kind": "nullable", "type": { - "$id": "208", + "$id": "218", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1957,16 +2037,16 @@ "isHttpMetadata": false }, { - "$id": "209", + "$id": "219", "kind": "property", "name": "optionalNullableString", "serializedName": "optionalNullableString", "doc": "required optional string", "type": { - "$id": "210", + "$id": "220", "kind": "nullable", "type": { - "$id": "211", + "$id": "221", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1988,7 +2068,7 @@ "isHttpMetadata": false }, { - "$id": "212", + "$id": "222", "kind": "property", "name": "requiredLiteralInt", "serializedName": "requiredLiteralInt", @@ -2010,7 +2090,7 @@ "isHttpMetadata": false }, { - "$id": "213", + "$id": "223", "kind": "property", "name": "requiredLiteralFloat", "serializedName": "requiredLiteralFloat", @@ -2032,7 +2112,7 @@ "isHttpMetadata": false }, { - "$id": "214", + "$id": "224", "kind": "property", "name": "requiredLiteralBool", "serializedName": "requiredLiteralBool", @@ -2054,7 +2134,7 @@ "isHttpMetadata": false }, { - "$id": "215", + "$id": "225", "kind": "property", "name": "optionalLiteralString", "serializedName": "optionalLiteralString", @@ -2076,13 +2156,13 @@ "isHttpMetadata": false }, { - "$id": "216", + "$id": "226", "kind": "property", "name": "requiredNullableLiteralString", "serializedName": "requiredNullableLiteralString", "doc": "required nullable literal string", "type": { - "$id": "217", + "$id": "227", "kind": "nullable", "type": { "$ref": "5" @@ -2103,7 +2183,7 @@ "isHttpMetadata": false }, { - "$id": "218", + "$id": "228", "kind": "property", "name": "optionalLiteralInt", "serializedName": "optionalLiteralInt", @@ -2125,7 +2205,7 @@ "isHttpMetadata": false }, { - "$id": "219", + "$id": "229", "kind": "property", "name": "optionalLiteralFloat", "serializedName": "optionalLiteralFloat", @@ -2147,7 +2227,7 @@ "isHttpMetadata": false }, { - "$id": "220", + "$id": "230", "kind": "property", "name": "optionalLiteralBool", "serializedName": "optionalLiteralBool", @@ -2169,13 +2249,13 @@ "isHttpMetadata": false }, { - "$id": "221", + "$id": "231", "kind": "property", "name": "requiredBadDescription", "serializedName": "requiredBadDescription", "doc": "description with xml <|endoftext|>", "type": { - "$id": "222", + "$id": "232", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2195,20 +2275,20 @@ "isHttpMetadata": false }, { - "$id": "223", + "$id": "233", "kind": "property", "name": "optionalNullableList", "serializedName": "optionalNullableList", "doc": "optional nullable collection", "type": { - "$id": "224", + "$id": "234", "kind": "nullable", "type": { - "$id": "225", + "$id": "235", "kind": "array", "name": "Array1", "valueType": { - "$id": "226", + "$id": "236", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -2233,16 +2313,16 @@ "isHttpMetadata": false }, { - "$id": "227", + "$id": "237", "kind": "property", "name": "requiredNullableList", "serializedName": "requiredNullableList", "doc": "required nullable collection", "type": { - "$id": "228", + "$id": "238", "kind": "nullable", "type": { - "$ref": "225" + "$ref": "235" }, "namespace": "SampleTypeSpec" }, @@ -2260,13 +2340,13 @@ "isHttpMetadata": false }, { - "$id": "229", + "$id": "239", "kind": "property", "name": "propertyWithSpecialDocs", "serializedName": "propertyWithSpecialDocs", "doc": "This tests:\n- Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines.\n- Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation.\n- Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output.\n- Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases.\n- **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines.\n- *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines.", "type": { - "$id": "230", + "$id": "240", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2288,7 +2368,7 @@ ] }, { - "$id": "231", + "$id": "241", "kind": "model", "name": "RoundTripModel", "namespace": "SampleTypeSpec", @@ -2303,13 +2383,13 @@ }, "properties": [ { - "$id": "232", + "$id": "242", "kind": "property", "name": "requiredString", "serializedName": "requiredString", "doc": "Required string, illustrating a reference type property.", "type": { - "$id": "233", + "$id": "243", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2329,13 +2409,13 @@ "isHttpMetadata": false }, { - "$id": "234", + "$id": "244", "kind": "property", "name": "requiredInt", "serializedName": "requiredInt", "doc": "Required int, illustrating a value type property.", "type": { - "$id": "235", + "$id": "245", "kind": "int32", "name": "int32", "encode": "string", @@ -2356,13 +2436,13 @@ "isHttpMetadata": false }, { - "$id": "236", + "$id": "246", "kind": "property", "name": "requiredCollection", "serializedName": "requiredCollection", "doc": "Required collection of enums", "type": { - "$id": "237", + "$id": "247", "kind": "array", "name": "ArrayStringFixedEnum", "valueType": { @@ -2385,16 +2465,16 @@ "isHttpMetadata": false }, { - "$id": "238", + "$id": "248", "kind": "property", "name": "requiredDictionary", "serializedName": "requiredDictionary", "doc": "Required dictionary of enums", "type": { - "$id": "239", + "$id": "249", "kind": "dict", "keyType": { - "$id": "240", + "$id": "250", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2419,13 +2499,13 @@ "isHttpMetadata": false }, { - "$id": "241", + "$id": "251", "kind": "property", "name": "requiredModel", "serializedName": "requiredModel", "doc": "Required model", "type": { - "$ref": "196" + "$ref": "206" }, "optional": false, "readOnly": false, @@ -2441,7 +2521,7 @@ "isHttpMetadata": false }, { - "$id": "242", + "$id": "252", "kind": "property", "name": "intExtensibleEnum", "serializedName": "intExtensibleEnum", @@ -2463,13 +2543,13 @@ "isHttpMetadata": false }, { - "$id": "243", + "$id": "253", "kind": "property", "name": "intExtensibleEnumCollection", "serializedName": "intExtensibleEnumCollection", "doc": "this is a collection of int based extensible enum", "type": { - "$id": "244", + "$id": "254", "kind": "array", "name": "ArrayIntExtensibleEnum", "valueType": { @@ -2492,7 +2572,7 @@ "isHttpMetadata": false }, { - "$id": "245", + "$id": "255", "kind": "property", "name": "floatExtensibleEnum", "serializedName": "floatExtensibleEnum", @@ -2514,7 +2594,7 @@ "isHttpMetadata": false }, { - "$id": "246", + "$id": "256", "kind": "property", "name": "floatExtensibleEnumWithIntValue", "serializedName": "floatExtensibleEnumWithIntValue", @@ -2536,13 +2616,13 @@ "isHttpMetadata": false }, { - "$id": "247", + "$id": "257", "kind": "property", "name": "floatExtensibleEnumCollection", "serializedName": "floatExtensibleEnumCollection", "doc": "this is a collection of float based extensible enum", "type": { - "$id": "248", + "$id": "258", "kind": "array", "name": "ArrayFloatExtensibleEnum", "valueType": { @@ -2565,7 +2645,7 @@ "isHttpMetadata": false }, { - "$id": "249", + "$id": "259", "kind": "property", "name": "floatFixedEnum", "serializedName": "floatFixedEnum", @@ -2587,7 +2667,7 @@ "isHttpMetadata": false }, { - "$id": "250", + "$id": "260", "kind": "property", "name": "floatFixedEnumWithIntValue", "serializedName": "floatFixedEnumWithIntValue", @@ -2609,13 +2689,13 @@ "isHttpMetadata": false }, { - "$id": "251", + "$id": "261", "kind": "property", "name": "floatFixedEnumCollection", "serializedName": "floatFixedEnumCollection", "doc": "this is a collection of float based fixed enum", "type": { - "$id": "252", + "$id": "262", "kind": "array", "name": "ArrayFloatFixedEnum", "valueType": { @@ -2638,7 +2718,7 @@ "isHttpMetadata": false }, { - "$id": "253", + "$id": "263", "kind": "property", "name": "intFixedEnum", "serializedName": "intFixedEnum", @@ -2660,13 +2740,13 @@ "isHttpMetadata": false }, { - "$id": "254", + "$id": "264", "kind": "property", "name": "intFixedEnumCollection", "serializedName": "intFixedEnumCollection", "doc": "this is a collection of int based fixed enum", "type": { - "$id": "255", + "$id": "265", "kind": "array", "name": "ArrayIntFixedEnum", "valueType": { @@ -2689,7 +2769,7 @@ "isHttpMetadata": false }, { - "$id": "256", + "$id": "266", "kind": "property", "name": "stringFixedEnum", "serializedName": "stringFixedEnum", @@ -2711,13 +2791,13 @@ "isHttpMetadata": false }, { - "$id": "257", + "$id": "267", "kind": "property", "name": "requiredUnknown", "serializedName": "requiredUnknown", "doc": "required unknown", "type": { - "$id": "258", + "$id": "268", "kind": "unknown", "name": "unknown", "crossLanguageDefinitionId": "", @@ -2737,13 +2817,13 @@ "isHttpMetadata": false }, { - "$id": "259", + "$id": "269", "kind": "property", "name": "optionalUnknown", "serializedName": "optionalUnknown", "doc": "optional unknown", "type": { - "$id": "260", + "$id": "270", "kind": "unknown", "name": "unknown", "crossLanguageDefinitionId": "", @@ -2763,23 +2843,23 @@ "isHttpMetadata": false }, { - "$id": "261", + "$id": "271", "kind": "property", "name": "requiredRecordUnknown", "serializedName": "requiredRecordUnknown", "doc": "required record of unknown", "type": { - "$id": "262", + "$id": "272", "kind": "dict", "keyType": { - "$id": "263", + "$id": "273", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "valueType": { - "$id": "264", + "$id": "274", "kind": "unknown", "name": "unknown", "crossLanguageDefinitionId": "", @@ -2801,13 +2881,13 @@ "isHttpMetadata": false }, { - "$id": "265", + "$id": "275", "kind": "property", "name": "optionalRecordUnknown", "serializedName": "optionalRecordUnknown", "doc": "optional record of unknown", "type": { - "$ref": "262" + "$ref": "272" }, "optional": true, "readOnly": false, @@ -2823,13 +2903,13 @@ "isHttpMetadata": false }, { - "$id": "266", + "$id": "276", "kind": "property", "name": "readOnlyRequiredRecordUnknown", "serializedName": "readOnlyRequiredRecordUnknown", "doc": "required readonly record of unknown", "type": { - "$ref": "262" + "$ref": "272" }, "optional": false, "readOnly": true, @@ -2845,13 +2925,13 @@ "isHttpMetadata": false }, { - "$id": "267", + "$id": "277", "kind": "property", "name": "readOnlyOptionalRecordUnknown", "serializedName": "readOnlyOptionalRecordUnknown", "doc": "optional readonly record of unknown", "type": { - "$ref": "262" + "$ref": "272" }, "optional": true, "readOnly": true, @@ -2867,13 +2947,13 @@ "isHttpMetadata": false }, { - "$id": "268", + "$id": "278", "kind": "property", "name": "modelWithRequiredNullable", "serializedName": "modelWithRequiredNullable", "doc": "this is a model with required nullable properties", "type": { - "$id": "269", + "$id": "279", "kind": "model", "name": "ModelWithRequiredNullableProperties", "namespace": "SampleTypeSpec", @@ -2888,16 +2968,16 @@ }, "properties": [ { - "$id": "270", + "$id": "280", "kind": "property", "name": "requiredNullablePrimitive", "serializedName": "requiredNullablePrimitive", "doc": "required nullable primitive type", "type": { - "$id": "271", + "$id": "281", "kind": "nullable", "type": { - "$id": "272", + "$id": "282", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -2919,13 +2999,13 @@ "isHttpMetadata": false }, { - "$id": "273", + "$id": "283", "kind": "property", "name": "requiredExtensibleEnum", "serializedName": "requiredExtensibleEnum", "doc": "required nullable extensible enum type", "type": { - "$id": "274", + "$id": "284", "kind": "nullable", "type": { "$ref": "22" @@ -2946,13 +3026,13 @@ "isHttpMetadata": false }, { - "$id": "275", + "$id": "285", "kind": "property", "name": "requiredFixedEnum", "serializedName": "requiredFixedEnum", "doc": "required nullable fixed enum type", "type": { - "$id": "276", + "$id": "286", "kind": "nullable", "type": { "$ref": "17" @@ -2988,13 +3068,13 @@ "isHttpMetadata": false }, { - "$id": "277", + "$id": "287", "kind": "property", "name": "requiredBytes", "serializedName": "requiredBytes", "doc": "Required bytes", "type": { - "$id": "278", + "$id": "288", "kind": "bytes", "name": "bytes", "encode": "base64", @@ -3017,10 +3097,10 @@ ] }, { - "$ref": "269" + "$ref": "279" }, { - "$id": "279", + "$id": "289", "kind": "model", "name": "Friend", "namespace": "SampleTypeSpec", @@ -3035,13 +3115,13 @@ }, "properties": [ { - "$id": "280", + "$id": "290", "kind": "property", "name": "name", "serializedName": "name", "doc": "name of the NotFriend", "type": { - "$id": "281", + "$id": "291", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3063,7 +3143,7 @@ ] }, { - "$id": "282", + "$id": "292", "kind": "model", "name": "RenamedModel", "namespace": "SampleTypeSpec", @@ -3078,13 +3158,13 @@ }, "properties": [ { - "$id": "283", + "$id": "293", "kind": "property", "name": "otherName", "serializedName": "otherName", "doc": "name of the ModelWithClientName", "type": { - "$id": "284", + "$id": "294", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3106,7 +3186,7 @@ ] }, { - "$id": "285", + "$id": "295", "kind": "model", "name": "ReturnsAnonymousModelResponse", "namespace": "SampleTypeSpec", @@ -3121,7 +3201,7 @@ "properties": [] }, { - "$id": "286", + "$id": "296", "kind": "model", "name": "ListWithNextLinkResponse", "namespace": "SampleTypeSpec", @@ -3135,16 +3215,16 @@ }, "properties": [ { - "$id": "287", + "$id": "297", "kind": "property", "name": "things", "serializedName": "things", "type": { - "$id": "288", + "$id": "298", "kind": "array", "name": "ArrayThing", "valueType": { - "$ref": "196" + "$ref": "206" }, "crossLanguageDefinitionId": "TypeSpec.Array", "decorators": [] @@ -3163,12 +3243,12 @@ "isHttpMetadata": false }, { - "$id": "289", + "$id": "299", "kind": "property", "name": "next", "serializedName": "next", "type": { - "$id": "290", + "$id": "300", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -3190,7 +3270,7 @@ ] }, { - "$id": "291", + "$id": "301", "kind": "model", "name": "ListWithStringNextLinkResponse", "namespace": "SampleTypeSpec", @@ -3204,12 +3284,12 @@ }, "properties": [ { - "$id": "292", + "$id": "302", "kind": "property", "name": "things", "serializedName": "things", "type": { - "$ref": "288" + "$ref": "298" }, "optional": false, "readOnly": false, @@ -3225,12 +3305,12 @@ "isHttpMetadata": false }, { - "$id": "293", + "$id": "303", "kind": "property", "name": "next", "serializedName": "next", "type": { - "$id": "294", + "$id": "304", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3252,7 +3332,7 @@ ] }, { - "$id": "295", + "$id": "305", "kind": "model", "name": "ListWithContinuationTokenResponse", "namespace": "SampleTypeSpec", @@ -3266,12 +3346,12 @@ }, "properties": [ { - "$id": "296", + "$id": "306", "kind": "property", "name": "things", "serializedName": "things", "type": { - "$ref": "288" + "$ref": "298" }, "optional": false, "readOnly": false, @@ -3287,12 +3367,12 @@ "isHttpMetadata": false }, { - "$id": "297", + "$id": "307", "kind": "property", "name": "nextToken", "serializedName": "nextToken", "type": { - "$id": "298", + "$id": "308", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3314,7 +3394,7 @@ ] }, { - "$id": "299", + "$id": "309", "kind": "model", "name": "ListWithContinuationTokenHeaderResponseResponse", "namespace": "", @@ -3328,12 +3408,12 @@ }, "properties": [ { - "$id": "300", + "$id": "310", "kind": "property", "name": "things", "serializedName": "things", "type": { - "$ref": "288" + "$ref": "298" }, "optional": false, "readOnly": false, @@ -3351,7 +3431,7 @@ ] }, { - "$id": "301", + "$id": "311", "kind": "model", "name": "PageThing", "namespace": "SampleTypeSpec", @@ -3365,12 +3445,12 @@ }, "properties": [ { - "$id": "302", + "$id": "312", "kind": "property", "name": "items", "serializedName": "items", "type": { - "$ref": "288" + "$ref": "298" }, "optional": false, "readOnly": false, @@ -3388,7 +3468,7 @@ ] }, { - "$id": "303", + "$id": "313", "kind": "model", "name": "ModelWithEmbeddedNonBodyParameters", "namespace": "SampleTypeSpec", @@ -3402,13 +3482,13 @@ }, "properties": [ { - "$id": "304", + "$id": "314", "kind": "property", "name": "name", "serializedName": "name", "doc": "name of the ModelWithEmbeddedNonBodyParameters", "type": { - "$id": "305", + "$id": "315", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3428,13 +3508,13 @@ "isHttpMetadata": false }, { - "$id": "306", + "$id": "316", "kind": "property", "name": "requiredHeader", "serializedName": "requiredHeader", "doc": "required header parameter", "type": { - "$id": "307", + "$id": "317", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3454,13 +3534,13 @@ "isHttpMetadata": true }, { - "$id": "308", + "$id": "318", "kind": "property", "name": "optionalHeader", "serializedName": "optionalHeader", "doc": "optional header parameter", "type": { - "$id": "309", + "$id": "319", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3480,13 +3560,13 @@ "isHttpMetadata": true }, { - "$id": "310", + "$id": "320", "kind": "property", "name": "requiredQuery", "serializedName": "requiredQuery", "doc": "required query parameter", "type": { - "$id": "311", + "$id": "321", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3506,13 +3586,13 @@ "isHttpMetadata": true }, { - "$id": "312", + "$id": "322", "kind": "property", "name": "optionalQuery", "serializedName": "optionalQuery", "doc": "optional query parameter", "type": { - "$id": "313", + "$id": "323", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3534,7 +3614,7 @@ ] }, { - "$id": "314", + "$id": "324", "kind": "model", "name": "DynamicModel", "namespace": "SampleTypeSpec", @@ -3554,12 +3634,12 @@ }, "properties": [ { - "$id": "315", + "$id": "325", "kind": "property", "name": "name", "serializedName": "name", "type": { - "$id": "316", + "$id": "326", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3579,12 +3659,12 @@ "isHttpMetadata": false }, { - "$id": "317", + "$id": "327", "kind": "property", "name": "optionalUnknown", "serializedName": "optionalUnknown", "type": { - "$id": "318", + "$id": "328", "kind": "unknown", "name": "unknown", "crossLanguageDefinitionId": "", @@ -3604,12 +3684,12 @@ "isHttpMetadata": false }, { - "$id": "319", + "$id": "329", "kind": "property", "name": "optionalInt", "serializedName": "optionalInt", "type": { - "$id": "320", + "$id": "330", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -3629,15 +3709,15 @@ "isHttpMetadata": false }, { - "$id": "321", + "$id": "331", "kind": "property", "name": "optionalNullableList", "serializedName": "optionalNullableList", "type": { - "$id": "322", + "$id": "332", "kind": "nullable", "type": { - "$ref": "225" + "$ref": "235" }, "namespace": "SampleTypeSpec" }, @@ -3655,15 +3735,15 @@ "isHttpMetadata": false }, { - "$id": "323", + "$id": "333", "kind": "property", "name": "requiredNullableList", "serializedName": "requiredNullableList", "type": { - "$id": "324", + "$id": "334", "kind": "nullable", "type": { - "$ref": "225" + "$ref": "235" }, "namespace": "SampleTypeSpec" }, @@ -3681,25 +3761,25 @@ "isHttpMetadata": false }, { - "$id": "325", + "$id": "335", "kind": "property", "name": "optionalNullableDictionary", "serializedName": "optionalNullableDictionary", "type": { - "$id": "326", + "$id": "336", "kind": "nullable", "type": { - "$id": "327", + "$id": "337", "kind": "dict", "keyType": { - "$id": "328", + "$id": "338", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "valueType": { - "$id": "329", + "$id": "339", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -3723,15 +3803,15 @@ "isHttpMetadata": false }, { - "$id": "330", + "$id": "340", "kind": "property", "name": "requiredNullableDictionary", "serializedName": "requiredNullableDictionary", "type": { - "$id": "331", + "$id": "341", "kind": "nullable", "type": { - "$ref": "327" + "$ref": "337" }, "namespace": "SampleTypeSpec" }, @@ -3749,12 +3829,12 @@ "isHttpMetadata": false }, { - "$id": "332", + "$id": "342", "kind": "property", "name": "primitiveDictionary", "serializedName": "primitiveDictionary", "type": { - "$ref": "327" + "$ref": "337" }, "optional": false, "readOnly": false, @@ -3770,12 +3850,12 @@ "isHttpMetadata": false }, { - "$id": "333", + "$id": "343", "kind": "property", "name": "foo", "serializedName": "foo", "type": { - "$id": "334", + "$id": "344", "kind": "model", "name": "AnotherDynamicModel", "namespace": "SampleTypeSpec", @@ -3795,12 +3875,12 @@ }, "properties": [ { - "$id": "335", + "$id": "345", "kind": "property", "name": "bar", "serializedName": "bar", "type": { - "$id": "336", + "$id": "346", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3835,16 +3915,16 @@ "isHttpMetadata": false }, { - "$id": "337", + "$id": "347", "kind": "property", "name": "listFoo", "serializedName": "listFoo", "type": { - "$id": "338", + "$id": "348", "kind": "array", "name": "ArrayAnotherDynamicModel", "valueType": { - "$ref": "334" + "$ref": "344" }, "crossLanguageDefinitionId": "TypeSpec.Array", "decorators": [] @@ -3863,16 +3943,16 @@ "isHttpMetadata": false }, { - "$id": "339", + "$id": "349", "kind": "property", "name": "listOfListFoo", "serializedName": "listOfListFoo", "type": { - "$id": "340", + "$id": "350", "kind": "array", "name": "ArrayArray", "valueType": { - "$ref": "338" + "$ref": "348" }, "crossLanguageDefinitionId": "TypeSpec.Array", "decorators": [] @@ -3891,22 +3971,22 @@ "isHttpMetadata": false }, { - "$id": "341", + "$id": "351", "kind": "property", "name": "dictionaryFoo", "serializedName": "dictionaryFoo", "type": { - "$id": "342", + "$id": "352", "kind": "dict", "keyType": { - "$id": "343", + "$id": "353", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "valueType": { - "$ref": "334" + "$ref": "344" }, "decorators": [] }, @@ -3924,22 +4004,22 @@ "isHttpMetadata": false }, { - "$id": "344", + "$id": "354", "kind": "property", "name": "dictionaryOfDictionaryFoo", "serializedName": "dictionaryOfDictionaryFoo", "type": { - "$id": "345", + "$id": "355", "kind": "dict", "keyType": { - "$id": "346", + "$id": "356", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "valueType": { - "$ref": "342" + "$ref": "352" }, "decorators": [] }, @@ -3957,22 +4037,22 @@ "isHttpMetadata": false }, { - "$id": "347", + "$id": "357", "kind": "property", "name": "dictionaryListFoo", "serializedName": "dictionaryListFoo", "type": { - "$id": "348", + "$id": "358", "kind": "dict", "keyType": { - "$id": "349", + "$id": "359", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "valueType": { - "$ref": "338" + "$ref": "348" }, "decorators": [] }, @@ -3990,16 +4070,16 @@ "isHttpMetadata": false }, { - "$id": "350", + "$id": "360", "kind": "property", "name": "listOfDictionaryFoo", "serializedName": "listOfDictionaryFoo", "type": { - "$id": "351", + "$id": "361", "kind": "array", "name": "ArrayRecord", "valueType": { - "$ref": "342" + "$ref": "352" }, "crossLanguageDefinitionId": "TypeSpec.Array", "decorators": [] @@ -4020,60 +4100,40 @@ ] }, { - "$ref": "334" + "$ref": "344" }, { - "$id": "352", + "$id": "362", "kind": "model", - "name": "Animal", + "name": "XmlAdvancedModel", "namespace": "SampleTypeSpec", - "crossLanguageDefinitionId": "SampleTypeSpec.Animal", - "usage": "Input,Output,Json", - "doc": "Base animal with discriminator", - "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel", + "usage": "Output,Xml", + "doc": "An advanced XML model for testing various property types and XML features.", + "decorators": [ + { + "name": "TypeSpec.Xml.@name", + "arguments": { + "name": "AdvancedXmlModel" + } + } + ], "serializationOptions": { - "json": { - "name": "Animal" + "xml": { + "name": "AdvancedXmlModel", + "attribute": false, + "unwrapped": false } }, - "discriminatorProperty": { - "$id": "353", - "kind": "property", - "name": "kind", - "serializedName": "kind", - "doc": "The kind of animal", - "type": { - "$id": "354", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "optional": false, - "readOnly": false, - "discriminator": true, - "flatten": false, - "decorators": [], - "crossLanguageDefinitionId": "SampleTypeSpec.Animal.kind", - "serializationOptions": { - "json": { - "name": "kind" - } - }, - "isHttpMetadata": false - }, "properties": [ { - "$ref": "353" - }, - { - "$id": "355", + "$id": "363", "kind": "property", "name": "name", "serializedName": "name", - "doc": "Name of the animal", + "doc": "A simple string property", "type": { - "$id": "356", + "$id": "364", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4084,33 +4144,1144 @@ "discriminator": false, "flatten": false, "decorators": [], - "crossLanguageDefinitionId": "SampleTypeSpec.Animal.name", + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.name", "serializationOptions": { - "json": { - "name": "name" + "xml": { + "name": "name", + "attribute": false, + "unwrapped": false } }, "isHttpMetadata": false - } - ], - "discriminatedSubtypes": { - "pet": { - "$id": "357", - "kind": "model", - "name": "Pet", - "namespace": "SampleTypeSpec", - "crossLanguageDefinitionId": "SampleTypeSpec.Pet", - "usage": "Input,Output,Json", - "doc": "Pet is a discriminated animal", - "discriminatorValue": "pet", + }, + { + "$id": "365", + "kind": "property", + "name": "age", + "serializedName": "age", + "doc": "An integer property", + "type": { + "$id": "366", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.age", "serializationOptions": { - "json": { - "name": "Pet" + "xml": { + "name": "age", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "367", + "kind": "property", + "name": "enabled", + "serializedName": "enabled", + "doc": "A boolean property", + "type": { + "$id": "368", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.enabled", + "serializationOptions": { + "xml": { + "name": "enabled", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "369", + "kind": "property", + "name": "score", + "serializedName": "score", + "doc": "A float property", + "type": { + "$id": "370", + "kind": "float32", + "name": "float32", + "crossLanguageDefinitionId": "TypeSpec.float32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.score", + "serializationOptions": { + "xml": { + "name": "score", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "371", + "kind": "property", + "name": "optionalString", + "serializedName": "optionalString", + "doc": "An optional string", + "type": { + "$id": "372", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.optionalString", + "serializationOptions": { + "xml": { + "name": "optionalString", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "373", + "kind": "property", + "name": "optionalInt", + "serializedName": "optionalInt", + "doc": "An optional integer", + "type": { + "$id": "374", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.optionalInt", + "serializationOptions": { + "xml": { + "name": "optionalInt", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "375", + "kind": "property", + "name": "nullableString", + "serializedName": "nullableString", + "doc": "A nullable string", + "type": { + "$id": "376", + "kind": "nullable", + "type": { + "$id": "377", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "namespace": "SampleTypeSpec" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.nullableString", + "serializationOptions": { + "xml": { + "name": "nullableString", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "378", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "A string as XML attribute", + "type": { + "$id": "379", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@attribute", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.id", + "serializationOptions": { + "xml": { + "name": "id", + "attribute": true, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "380", + "kind": "property", + "name": "version", + "serializedName": "version", + "doc": "An integer as XML attribute", + "type": { + "$id": "381", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@attribute", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.version", + "serializationOptions": { + "xml": { + "name": "version", + "attribute": true, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "382", + "kind": "property", + "name": "isActive", + "serializedName": "isActive", + "doc": "A boolean as XML attribute", + "type": { + "$id": "383", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@attribute", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.isActive", + "serializationOptions": { + "xml": { + "name": "isActive", + "attribute": true, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "384", + "kind": "property", + "name": "originalName", + "serializedName": "RenamedProperty", + "doc": "A property with a custom XML element name", + "type": { + "$id": "385", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@name", + "arguments": { + "name": "RenamedProperty" + } + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.originalName", + "serializationOptions": { + "xml": { + "name": "RenamedProperty", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "386", + "kind": "property", + "name": "xmlIdentifier", + "serializedName": "xml-id", + "doc": "An attribute with a custom XML name", + "type": { + "$id": "387", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@name", + "arguments": { + "name": "xml-id" + } + }, + { + "name": "TypeSpec.Xml.@attribute", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.xmlIdentifier", + "serializationOptions": { + "xml": { + "name": "xml-id", + "attribute": true, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "388", + "kind": "property", + "name": "content", + "serializedName": "content", + "doc": "Text content in the element (unwrapped string)", + "type": { + "$id": "389", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@unwrapped", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.content", + "serializationOptions": { + "xml": { + "name": "content", + "attribute": false, + "unwrapped": true + } + }, + "isHttpMetadata": false + }, + { + "$id": "390", + "kind": "property", + "name": "unwrappedStrings", + "serializedName": "unwrappedStrings", + "doc": "An unwrapped array of strings - items appear directly without wrapper", + "type": { + "$ref": "212" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@unwrapped", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.unwrappedStrings", + "serializationOptions": { + "xml": { + "name": "unwrappedStrings", + "attribute": false, + "unwrapped": true, + "itemsName": "unwrappedStrings" + } + }, + "isHttpMetadata": false + }, + { + "$id": "391", + "kind": "property", + "name": "unwrappedCounts", + "serializedName": "unwrappedCounts", + "doc": "An unwrapped array of integers", + "type": { + "$ref": "235" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@unwrapped", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.unwrappedCounts", + "serializationOptions": { + "xml": { + "name": "unwrappedCounts", + "attribute": false, + "unwrapped": true, + "itemsName": "unwrappedCounts" + } + }, + "isHttpMetadata": false + }, + { + "$id": "392", + "kind": "property", + "name": "unwrappedItems", + "serializedName": "unwrappedItems", + "doc": "An unwrapped array of models", + "type": { + "$id": "393", + "kind": "array", + "name": "ArrayXmlItem", + "valueType": { + "$id": "394", + "kind": "model", + "name": "XmlItem", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.XmlItem", + "usage": "Output,Xml", + "doc": "An item model for XML array testing", + "decorators": [ + { + "name": "TypeSpec.Xml.@name", + "arguments": { + "name": "Item" + } + } + ], + "serializationOptions": { + "xml": { + "name": "Item", + "attribute": false, + "unwrapped": false + } + }, + "properties": [ + { + "$id": "395", + "kind": "property", + "name": "itemName", + "serializedName": "itemName", + "doc": "The item name", + "type": { + "$id": "396", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlItem.itemName", + "serializationOptions": { + "xml": { + "name": "itemName", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "397", + "kind": "property", + "name": "itemValue", + "serializedName": "itemValue", + "doc": "The item value", + "type": { + "$id": "398", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlItem.itemValue", + "serializationOptions": { + "xml": { + "name": "itemValue", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "399", + "kind": "property", + "name": "itemId", + "serializedName": "itemId", + "doc": "Item ID as attribute", + "type": { + "$id": "400", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@attribute", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlItem.itemId", + "serializationOptions": { + "xml": { + "name": "itemId", + "attribute": true, + "unwrapped": false + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@unwrapped", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.unwrappedItems", + "serializationOptions": { + "xml": { + "name": "unwrappedItems", + "attribute": false, + "unwrapped": true, + "itemsName": "unwrappedItems" + } + }, + "isHttpMetadata": false + }, + { + "$id": "401", + "kind": "property", + "name": "wrappedColors", + "serializedName": "wrappedColors", + "doc": "A wrapped array of strings (default)", + "type": { + "$ref": "212" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.wrappedColors", + "serializationOptions": { + "xml": { + "name": "wrappedColors", + "attribute": false, + "unwrapped": false, + "itemsName": "string" + } + }, + "isHttpMetadata": false + }, + { + "$id": "402", + "kind": "property", + "name": "items", + "serializedName": "ItemCollection", + "doc": "A wrapped array with custom wrapper name", + "type": { + "$ref": "393" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@name", + "arguments": { + "name": "ItemCollection" + } + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.items", + "serializationOptions": { + "xml": { + "name": "ItemCollection", + "attribute": false, + "unwrapped": false, + "itemsName": "Item" + } + }, + "isHttpMetadata": false + }, + { + "$id": "403", + "kind": "property", + "name": "nestedModel", + "serializedName": "nestedModel", + "doc": "A nested model property", + "type": { + "$id": "404", + "kind": "model", + "name": "XmlNestedModel", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.XmlNestedModel", + "usage": "Output,Xml", + "doc": "A nested model for XML testing", + "decorators": [], + "serializationOptions": { + "xml": { + "name": "XmlNestedModel", + "attribute": false, + "unwrapped": false + } + }, + "properties": [ + { + "$id": "405", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The value of the nested model", + "type": { + "$id": "406", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlNestedModel.value", + "serializationOptions": { + "xml": { + "name": "value", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "407", + "kind": "property", + "name": "nestedId", + "serializedName": "nestedId", + "doc": "An attribute on the nested model", + "type": { + "$id": "408", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@attribute", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlNestedModel.nestedId", + "serializationOptions": { + "xml": { + "name": "nestedId", + "attribute": true, + "unwrapped": false + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.nestedModel", + "serializationOptions": { + "xml": { + "name": "nestedModel", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "409", + "kind": "property", + "name": "optionalNestedModel", + "serializedName": "optionalNestedModel", + "doc": "An optional nested model", + "type": { + "$ref": "404" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.optionalNestedModel", + "serializationOptions": { + "xml": { + "name": "optionalNestedModel", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "410", + "kind": "property", + "name": "metadata", + "serializedName": "metadata", + "doc": "A dictionary property", + "type": { + "$id": "411", + "kind": "dict", + "keyType": { + "$id": "412", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "valueType": { + "$id": "413", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.metadata", + "serializationOptions": { + "xml": { + "name": "metadata", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "414", + "kind": "property", + "name": "createdAt", + "serializedName": "createdAt", + "doc": "A date-time property", + "type": { + "$id": "415", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "416", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.createdAt", + "serializationOptions": { + "xml": { + "name": "createdAt", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "417", + "kind": "property", + "name": "duration", + "serializedName": "duration", + "doc": "A duration property", + "type": { + "$id": "418", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "419", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.duration", + "serializationOptions": { + "xml": { + "name": "duration", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "420", + "kind": "property", + "name": "data", + "serializedName": "data", + "doc": "A bytes property", + "type": { + "$id": "421", + "kind": "bytes", + "name": "bytes", + "encode": "base64", + "crossLanguageDefinitionId": "TypeSpec.bytes", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.data", + "serializationOptions": { + "xml": { + "name": "data", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "422", + "kind": "property", + "name": "optionalRecordUnknown", + "serializedName": "optionalRecordUnknown", + "doc": "optional record of unknown", + "type": { + "$ref": "272" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.optionalRecordUnknown", + "serializationOptions": { + "xml": { + "name": "optionalRecordUnknown", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "423", + "kind": "property", + "name": "fixedEnum", + "serializedName": "fixedEnum", + "doc": "A fixed enum property", + "type": { + "$ref": "17" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.fixedEnum", + "serializationOptions": { + "xml": { + "name": "fixedEnum", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "424", + "kind": "property", + "name": "extensibleEnum", + "serializedName": "extensibleEnum", + "doc": "An extensible enum property", + "type": { + "$ref": "22" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.extensibleEnum", + "serializationOptions": { + "xml": { + "name": "extensibleEnum", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "425", + "kind": "property", + "name": "optionalFixedEnum", + "serializedName": "optionalFixedEnum", + "doc": "An optional fixed enum property", + "type": { + "$ref": "52" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.optionalFixedEnum", + "serializationOptions": { + "xml": { + "name": "optionalFixedEnum", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "426", + "kind": "property", + "name": "optionalExtensibleEnum", + "serializedName": "optionalExtensibleEnum", + "doc": "An optional extensible enum property", + "type": { + "$ref": "27" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.optionalExtensibleEnum", + "serializationOptions": { + "xml": { + "name": "optionalExtensibleEnum", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "394" + }, + { + "$ref": "404" + }, + { + "$id": "427", + "kind": "model", + "name": "Animal", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.Animal", + "usage": "Input,Output,Json", + "doc": "Base animal with discriminator", + "decorators": [], + "serializationOptions": { + "json": { + "name": "Animal" + } + }, + "discriminatorProperty": { + "$id": "428", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "The kind of animal", + "type": { + "$id": "429", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Animal.kind", + "serializationOptions": { + "json": { + "name": "kind" + } + }, + "isHttpMetadata": false + }, + "properties": [ + { + "$ref": "428" + }, + { + "$id": "430", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "Name of the animal", + "type": { + "$id": "431", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Animal.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + } + ], + "discriminatedSubtypes": { + "pet": { + "$id": "432", + "kind": "model", + "name": "Pet", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.Pet", + "usage": "Input,Output,Json", + "doc": "Pet is a discriminated animal", + "discriminatorValue": "pet", + "decorators": [], + "serializationOptions": { + "json": { + "name": "Pet" } }, "discriminatorProperty": { - "$id": "358", + "$id": "433", "kind": "property", "name": "kind", "serializedName": "kind", @@ -4131,20 +5302,20 @@ "isHttpMetadata": false }, "baseModel": { - "$ref": "352" + "$ref": "427" }, "properties": [ { - "$ref": "358" + "$ref": "433" }, { - "$id": "359", + "$id": "434", "kind": "property", "name": "trained", "serializedName": "trained", "doc": "Whether the pet is trained", "type": { - "$id": "360", + "$id": "435", "kind": "boolean", "name": "boolean", "crossLanguageDefinitionId": "TypeSpec.boolean", @@ -4166,7 +5337,7 @@ ], "discriminatedSubtypes": { "dog": { - "$id": "361", + "$id": "436", "kind": "model", "name": "Dog", "namespace": "SampleTypeSpec", @@ -4181,11 +5352,11 @@ } }, "baseModel": { - "$ref": "357" + "$ref": "432" }, "properties": [ { - "$id": "362", + "$id": "437", "kind": "property", "name": "kind", "serializedName": "kind", @@ -4206,13 +5377,13 @@ "isHttpMetadata": false }, { - "$id": "363", + "$id": "438", "kind": "property", "name": "breed", "serializedName": "breed", "doc": "The breed of the dog", "type": { - "$id": "364", + "$id": "439", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4235,19 +5406,204 @@ } } }, - "dog": { - "$ref": "361" + "dog": { + "$ref": "436" + } + } + }, + { + "$ref": "432" + }, + { + "$ref": "436" + }, + { + "$id": "440", + "kind": "model", + "name": "Tree", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.Tree", + "usage": "Output,Xml", + "doc": "Tree is a specific type of plant", + "discriminatorValue": "tree", + "decorators": [], + "serializationOptions": { + "xml": { + "name": "Tree", + "attribute": false, + "unwrapped": false + } + }, + "baseModel": { + "$id": "441", + "kind": "model", + "name": "Plant", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.Plant", + "usage": "Output,Xml", + "doc": "Base plant with discriminator", + "decorators": [], + "serializationOptions": { + "xml": { + "name": "Plant", + "attribute": false, + "unwrapped": false + } + }, + "discriminatorProperty": { + "$id": "442", + "kind": "property", + "name": "species", + "serializedName": "species", + "doc": "The species of plant", + "type": { + "$id": "443", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Plant.species", + "serializationOptions": { + "xml": { + "name": "species", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + "properties": [ + { + "$ref": "442" + }, + { + "$id": "444", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "The unique identifier of the plant", + "type": { + "$id": "445", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Plant.id", + "serializationOptions": { + "xml": { + "name": "id", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "446", + "kind": "property", + "name": "height", + "serializedName": "height", + "doc": "The height of the plant in centimeters", + "type": { + "$id": "447", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Plant.height", + "serializationOptions": { + "xml": { + "name": "height", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + } + ], + "discriminatedSubtypes": { + "tree": { + "$ref": "440" + } + } + }, + "properties": [ + { + "$id": "448", + "kind": "property", + "name": "species", + "serializedName": "species", + "type": { + "$ref": "84" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Tree.species", + "serializationOptions": { + "xml": { + "name": "species", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "449", + "kind": "property", + "name": "age", + "serializedName": "age", + "doc": "The age of the tree in years", + "type": { + "$id": "450", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.Tree.age", + "serializationOptions": { + "xml": { + "name": "age", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false } - } - }, - { - "$ref": "357" + ] }, { - "$ref": "361" + "$ref": "441" }, { - "$id": "365", + "$id": "451", "kind": "model", "name": "GetWidgetMetricsResponse", "namespace": "SampleTypeSpec", @@ -4261,12 +5617,12 @@ }, "properties": [ { - "$id": "366", + "$id": "452", "kind": "property", "name": "numSold", "serializedName": "numSold", "type": { - "$id": "367", + "$id": "453", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -4286,12 +5642,12 @@ "isHttpMetadata": false }, { - "$id": "368", + "$id": "454", "kind": "property", "name": "averagePrice", "serializedName": "averagePrice", "type": { - "$id": "369", + "$id": "455", "kind": "float32", "name": "float32", "crossLanguageDefinitionId": "TypeSpec.float32", @@ -4315,14 +5671,14 @@ ], "clients": [ { - "$id": "370", + "$id": "456", "kind": "client", "name": "SampleTypeSpecClient", "namespace": "SampleTypeSpec", "doc": "This is a sample typespec project.", "methods": [ { - "$id": "371", + "$id": "457", "kind": "basic", "name": "sayHi", "accessibility": "public", @@ -4332,19 +5688,19 @@ ], "doc": "Return hi", "operation": { - "$id": "372", + "$id": "458", "name": "sayHi", "resourceName": "SampleTypeSpec", "doc": "Return hi", "accessibility": "public", "parameters": [ { - "$id": "373", + "$id": "459", "kind": "header", "name": "headParameter", "serializedName": "head-parameter", "type": { - "$id": "374", + "$id": "460", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4359,12 +5715,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.sayHi.headParameter" }, { - "$id": "375", + "$id": "461", "kind": "query", "name": "queryParameter", "serializedName": "queryParameter", "type": { - "$id": "376", + "$id": "462", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4379,12 +5735,12 @@ "readOnly": false }, { - "$id": "377", + "$id": "463", "kind": "query", "name": "optionalQuery", "serializedName": "optionalQuery", "type": { - "$id": "378", + "$id": "464", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4399,12 +5755,12 @@ "readOnly": false }, { - "$id": "379", + "$id": "465", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "84" + "$ref": "86" }, "isApiVersion": false, "optional": false, @@ -4421,7 +5777,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -4442,12 +5798,12 @@ }, "parameters": [ { - "$id": "380", + "$id": "466", "kind": "method", "name": "headParameter", "serializedName": "head-parameter", "type": { - "$id": "381", + "$id": "467", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4463,12 +5819,12 @@ "decorators": [] }, { - "$id": "382", + "$id": "468", "kind": "method", "name": "queryParameter", "serializedName": "queryParameter", "type": { - "$id": "383", + "$id": "469", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4484,12 +5840,12 @@ "decorators": [] }, { - "$id": "384", + "$id": "470", "kind": "method", "name": "optionalQuery", "serializedName": "optionalQuery", "type": { - "$id": "385", + "$id": "471", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4505,12 +5861,12 @@ "decorators": [] }, { - "$id": "386", + "$id": "472", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "84" + "$ref": "86" }, "location": "Header", "isApiVersion": false, @@ -4524,7 +5880,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -4533,7 +5889,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.sayHi" }, { - "$id": "387", + "$id": "473", "kind": "basic", "name": "helloAgain", "accessibility": "public", @@ -4543,19 +5899,19 @@ ], "doc": "Return hi again", "operation": { - "$id": "388", + "$id": "474", "name": "helloAgain", "resourceName": "SampleTypeSpec", "doc": "Return hi again", "accessibility": "public", "parameters": [ { - "$id": "389", + "$id": "475", "kind": "header", "name": "p1", "serializedName": "p1", "type": { - "$id": "390", + "$id": "476", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4570,12 +5926,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.p1" }, { - "$id": "391", + "$id": "477", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "type": { - "$ref": "86" + "$ref": "88" }, "isApiVersion": false, "optional": false, @@ -4586,12 +5942,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.contentType" }, { - "$id": "392", + "$id": "478", "kind": "path", "name": "p2", "serializedName": "p2", "type": { - "$id": "393", + "$id": "479", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4609,12 +5965,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.p2" }, { - "$id": "394", + "$id": "480", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "88" + "$ref": "90" }, "isApiVersion": false, "optional": false, @@ -4625,12 +5981,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.accept" }, { - "$id": "395", + "$id": "481", "kind": "body", "name": "action", "serializedName": "action", "type": { - "$ref": "231" + "$ref": "241" }, "isApiVersion": false, "contentTypes": [ @@ -4650,7 +6006,7 @@ 200 ], "bodyType": { - "$ref": "231" + "$ref": "241" }, "headers": [], "isErrorResponse": false, @@ -4674,12 +6030,12 @@ }, "parameters": [ { - "$id": "396", + "$id": "482", "kind": "method", "name": "p1", "serializedName": "p1", "type": { - "$id": "397", + "$id": "483", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4695,12 +6051,12 @@ "decorators": [] }, { - "$id": "398", + "$id": "484", "kind": "method", "name": "action", "serializedName": "action", "type": { - "$ref": "231" + "$ref": "241" }, "location": "Body", "isApiVersion": false, @@ -4712,12 +6068,12 @@ "decorators": [] }, { - "$id": "399", + "$id": "485", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "type": { - "$ref": "90" + "$ref": "92" }, "location": "Header", "isApiVersion": false, @@ -4729,12 +6085,12 @@ "decorators": [] }, { - "$id": "400", + "$id": "486", "kind": "method", "name": "p2", "serializedName": "p2", "type": { - "$id": "401", + "$id": "487", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4750,12 +6106,12 @@ "decorators": [] }, { - "$id": "402", + "$id": "488", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "88" + "$ref": "90" }, "location": "Header", "isApiVersion": false, @@ -4769,7 +6125,7 @@ ], "response": { "type": { - "$ref": "231" + "$ref": "241" } }, "isOverride": false, @@ -4778,7 +6134,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain" }, { - "$id": "403", + "$id": "489", "kind": "basic", "name": "noContentType", "accessibility": "public", @@ -4788,19 +6144,19 @@ ], "doc": "Return hi again", "operation": { - "$id": "404", + "$id": "490", "name": "noContentType", "resourceName": "SampleTypeSpec", "doc": "Return hi again", "accessibility": "public", "parameters": [ { - "$id": "405", + "$id": "491", "kind": "header", "name": "p1", "serializedName": "p1", "type": { - "$id": "406", + "$id": "492", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4815,12 +6171,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.p1" }, { - "$id": "407", + "$id": "493", "kind": "path", "name": "p2", "serializedName": "p2", "type": { - "$id": "408", + "$id": "494", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4838,13 +6194,13 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.p2" }, { - "$id": "409", + "$id": "495", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "92" + "$ref": "94" }, "isApiVersion": false, "optional": false, @@ -4855,12 +6211,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.contentType" }, { - "$id": "410", + "$id": "496", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "94" + "$ref": "96" }, "isApiVersion": false, "optional": false, @@ -4871,12 +6227,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.accept" }, { - "$id": "411", + "$id": "497", "kind": "body", "name": "action", "serializedName": "action", "type": { - "$ref": "231" + "$ref": "241" }, "isApiVersion": false, "contentTypes": [ @@ -4896,7 +6252,7 @@ 200 ], "bodyType": { - "$ref": "231" + "$ref": "241" }, "headers": [], "isErrorResponse": false, @@ -4920,12 +6276,12 @@ }, "parameters": [ { - "$id": "412", + "$id": "498", "kind": "method", "name": "p1", "serializedName": "p1", "type": { - "$id": "413", + "$id": "499", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4941,12 +6297,12 @@ "decorators": [] }, { - "$id": "414", + "$id": "500", "kind": "method", "name": "action", "serializedName": "action", "type": { - "$ref": "231" + "$ref": "241" }, "location": "Body", "isApiVersion": false, @@ -4958,12 +6314,12 @@ "decorators": [] }, { - "$id": "415", + "$id": "501", "kind": "method", "name": "p2", "serializedName": "p2", "type": { - "$id": "416", + "$id": "502", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4979,13 +6335,13 @@ "decorators": [] }, { - "$id": "417", + "$id": "503", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "92" + "$ref": "94" }, "location": "Header", "isApiVersion": false, @@ -4997,12 +6353,12 @@ "decorators": [] }, { - "$id": "418", + "$id": "504", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "94" + "$ref": "96" }, "location": "Header", "isApiVersion": false, @@ -5016,7 +6372,7 @@ ], "response": { "type": { - "$ref": "231" + "$ref": "241" } }, "isOverride": false, @@ -5025,7 +6381,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType" }, { - "$id": "419", + "$id": "505", "kind": "basic", "name": "helloDemo2", "accessibility": "public", @@ -5035,19 +6391,19 @@ ], "doc": "Return hi in demo2", "operation": { - "$id": "420", + "$id": "506", "name": "helloDemo2", "resourceName": "SampleTypeSpec", "doc": "Return hi in demo2", "accessibility": "public", "parameters": [ { - "$id": "421", + "$id": "507", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "96" + "$ref": "98" }, "isApiVersion": false, "optional": false, @@ -5064,7 +6420,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -5085,12 +6441,12 @@ }, "parameters": [ { - "$id": "422", + "$id": "508", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "96" + "$ref": "98" }, "location": "Header", "isApiVersion": false, @@ -5104,7 +6460,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -5113,7 +6469,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloDemo2" }, { - "$id": "423", + "$id": "509", "kind": "basic", "name": "createLiteral", "accessibility": "public", @@ -5123,20 +6479,20 @@ ], "doc": "Create with literal value", "operation": { - "$id": "424", + "$id": "510", "name": "createLiteral", "resourceName": "SampleTypeSpec", "doc": "Create with literal value", "accessibility": "public", "parameters": [ { - "$id": "425", + "$id": "511", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "98" + "$ref": "100" }, "isApiVersion": false, "optional": false, @@ -5147,12 +6503,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.createLiteral.contentType" }, { - "$id": "426", + "$id": "512", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "100" + "$ref": "102" }, "isApiVersion": false, "optional": false, @@ -5163,12 +6519,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.createLiteral.accept" }, { - "$id": "427", + "$id": "513", "kind": "body", "name": "body", "serializedName": "body", "type": { - "$ref": "196" + "$ref": "206" }, "isApiVersion": false, "contentTypes": [ @@ -5188,7 +6544,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -5212,12 +6568,12 @@ }, "parameters": [ { - "$id": "428", + "$id": "514", "kind": "method", "name": "body", "serializedName": "body", "type": { - "$ref": "196" + "$ref": "206" }, "location": "Body", "isApiVersion": false, @@ -5229,13 +6585,13 @@ "decorators": [] }, { - "$id": "429", + "$id": "515", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "98" + "$ref": "100" }, "location": "Header", "isApiVersion": false, @@ -5247,12 +6603,12 @@ "decorators": [] }, { - "$id": "430", + "$id": "516", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "100" + "$ref": "102" }, "location": "Header", "isApiVersion": false, @@ -5266,7 +6622,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -5275,7 +6631,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.createLiteral" }, { - "$id": "431", + "$id": "517", "kind": "basic", "name": "helloLiteral", "accessibility": "public", @@ -5285,19 +6641,19 @@ ], "doc": "Send literal parameters", "operation": { - "$id": "432", + "$id": "518", "name": "helloLiteral", "resourceName": "SampleTypeSpec", "doc": "Send literal parameters", "accessibility": "public", "parameters": [ { - "$id": "433", + "$id": "519", "kind": "header", "name": "p1", "serializedName": "p1", "type": { - "$ref": "102" + "$ref": "104" }, "isApiVersion": false, "optional": false, @@ -5308,12 +6664,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloLiteral.p1" }, { - "$id": "434", + "$id": "520", "kind": "path", "name": "p2", "serializedName": "p2", "type": { - "$ref": "104" + "$ref": "106" }, "isApiVersion": false, "explode": false, @@ -5327,12 +6683,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloLiteral.p2" }, { - "$id": "435", + "$id": "521", "kind": "query", "name": "p3", "serializedName": "p3", "type": { - "$ref": "106" + "$ref": "108" }, "isApiVersion": false, "explode": false, @@ -5343,12 +6699,12 @@ "readOnly": false }, { - "$id": "436", + "$id": "522", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "108" + "$ref": "110" }, "isApiVersion": false, "optional": false, @@ -5365,7 +6721,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -5386,12 +6742,12 @@ }, "parameters": [ { - "$id": "437", + "$id": "523", "kind": "method", "name": "p1", "serializedName": "p1", "type": { - "$ref": "110" + "$ref": "112" }, "location": "Header", "isApiVersion": false, @@ -5403,12 +6759,12 @@ "decorators": [] }, { - "$id": "438", + "$id": "524", "kind": "method", "name": "p2", "serializedName": "p2", "type": { - "$ref": "112" + "$ref": "114" }, "location": "Path", "isApiVersion": false, @@ -5420,12 +6776,12 @@ "decorators": [] }, { - "$id": "439", + "$id": "525", "kind": "method", "name": "p3", "serializedName": "p3", "type": { - "$ref": "114" + "$ref": "116" }, "location": "Query", "isApiVersion": false, @@ -5437,12 +6793,12 @@ "decorators": [] }, { - "$id": "440", + "$id": "526", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "108" + "$ref": "110" }, "location": "Header", "isApiVersion": false, @@ -5456,7 +6812,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -5465,7 +6821,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloLiteral" }, { - "$id": "441", + "$id": "527", "kind": "basic", "name": "topAction", "accessibility": "public", @@ -5475,24 +6831,24 @@ ], "doc": "top level method", "operation": { - "$id": "442", + "$id": "528", "name": "topAction", "resourceName": "SampleTypeSpec", "doc": "top level method", "accessibility": "public", "parameters": [ { - "$id": "443", + "$id": "529", "kind": "path", "name": "action", "serializedName": "action", "type": { - "$id": "444", + "$id": "530", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc3339", "wireType": { - "$id": "445", + "$id": "531", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5513,12 +6869,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.topAction.action" }, { - "$id": "446", + "$id": "532", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "116" + "$ref": "118" }, "isApiVersion": false, "optional": false, @@ -5535,7 +6891,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -5556,17 +6912,17 @@ }, "parameters": [ { - "$id": "447", + "$id": "533", "kind": "method", "name": "action", "serializedName": "action", "type": { - "$id": "448", + "$id": "534", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc3339", "wireType": { - "$id": "449", + "$id": "535", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5585,12 +6941,12 @@ "decorators": [] }, { - "$id": "450", + "$id": "536", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "116" + "$ref": "118" }, "location": "Header", "isApiVersion": false, @@ -5604,7 +6960,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -5613,7 +6969,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.topAction" }, { - "$id": "451", + "$id": "537", "kind": "basic", "name": "topAction2", "accessibility": "public", @@ -5623,19 +6979,19 @@ ], "doc": "top level method2", "operation": { - "$id": "452", + "$id": "538", "name": "topAction2", "resourceName": "SampleTypeSpec", "doc": "top level method2", "accessibility": "public", "parameters": [ { - "$id": "453", + "$id": "539", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "118" + "$ref": "120" }, "isApiVersion": false, "optional": false, @@ -5652,7 +7008,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -5673,12 +7029,12 @@ }, "parameters": [ { - "$id": "454", + "$id": "540", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "118" + "$ref": "120" }, "location": "Header", "isApiVersion": false, @@ -5692,7 +7048,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -5701,7 +7057,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.topAction2" }, { - "$id": "455", + "$id": "541", "kind": "basic", "name": "patchAction", "accessibility": "public", @@ -5711,20 +7067,20 @@ ], "doc": "top level patch", "operation": { - "$id": "456", + "$id": "542", "name": "patchAction", "resourceName": "SampleTypeSpec", "doc": "top level patch", "accessibility": "public", "parameters": [ { - "$id": "457", + "$id": "543", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "120" + "$ref": "122" }, "isApiVersion": false, "optional": false, @@ -5735,12 +7091,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.patchAction.contentType" }, { - "$id": "458", + "$id": "544", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "122" + "$ref": "124" }, "isApiVersion": false, "optional": false, @@ -5751,12 +7107,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.patchAction.accept" }, { - "$id": "459", + "$id": "545", "kind": "body", "name": "body", "serializedName": "body", "type": { - "$ref": "196" + "$ref": "206" }, "isApiVersion": false, "contentTypes": [ @@ -5776,7 +7132,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -5800,12 +7156,12 @@ }, "parameters": [ { - "$id": "460", + "$id": "546", "kind": "method", "name": "body", "serializedName": "body", "type": { - "$ref": "196" + "$ref": "206" }, "location": "Body", "isApiVersion": false, @@ -5817,13 +7173,13 @@ "decorators": [] }, { - "$id": "461", + "$id": "547", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "120" + "$ref": "122" }, "location": "Header", "isApiVersion": false, @@ -5835,12 +7191,12 @@ "decorators": [] }, { - "$id": "462", + "$id": "548", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "122" + "$ref": "124" }, "location": "Header", "isApiVersion": false, @@ -5854,7 +7210,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -5863,7 +7219,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.patchAction" }, { - "$id": "463", + "$id": "549", "kind": "basic", "name": "anonymousBody", "accessibility": "public", @@ -5873,19 +7229,19 @@ ], "doc": "body parameter without body decorator", "operation": { - "$id": "464", + "$id": "550", "name": "anonymousBody", "resourceName": "SampleTypeSpec", "doc": "body parameter without body decorator", "accessibility": "public", "parameters": [ { - "$id": "465", + "$id": "551", "kind": "query", "name": "requiredQueryParam", "serializedName": "requiredQueryParam", "type": { - "$ref": "124" + "$ref": "126" }, "isApiVersion": false, "explode": false, @@ -5896,12 +7252,12 @@ "readOnly": false }, { - "$id": "466", + "$id": "552", "kind": "header", "name": "requiredHeader", "serializedName": "required-header", "type": { - "$ref": "126" + "$ref": "128" }, "isApiVersion": false, "optional": false, @@ -5912,13 +7268,13 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody.requiredHeader" }, { - "$id": "467", + "$id": "553", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "128" + "$ref": "130" }, "isApiVersion": false, "optional": false, @@ -5929,12 +7285,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody.contentType" }, { - "$id": "468", + "$id": "554", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "130" + "$ref": "132" }, "isApiVersion": false, "optional": false, @@ -5945,12 +7301,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody.accept" }, { - "$id": "469", + "$id": "555", "kind": "body", "name": "thing", "serializedName": "thing", "type": { - "$ref": "196" + "$ref": "206" }, "isApiVersion": false, "contentTypes": [ @@ -5970,7 +7326,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -5994,13 +7350,13 @@ }, "parameters": [ { - "$id": "470", + "$id": "556", "kind": "method", "name": "name", "serializedName": "name", "doc": "name of the Thing", "type": { - "$id": "471", + "$id": "557", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6016,13 +7372,13 @@ "decorators": [] }, { - "$id": "472", + "$id": "558", "kind": "method", "name": "requiredUnion", "serializedName": "requiredUnion", "doc": "required Union", "type": { - "$ref": "200" + "$ref": "210" }, "location": "Body", "isApiVersion": false, @@ -6034,7 +7390,7 @@ "decorators": [] }, { - "$id": "473", + "$id": "559", "kind": "method", "name": "requiredLiteralString", "serializedName": "requiredLiteralString", @@ -6052,13 +7408,13 @@ "decorators": [] }, { - "$id": "474", + "$id": "560", "kind": "method", "name": "requiredNullableString", "serializedName": "requiredNullableString", "doc": "required nullable string", "type": { - "$ref": "207" + "$ref": "217" }, "location": "Body", "isApiVersion": false, @@ -6070,13 +7426,13 @@ "decorators": [] }, { - "$id": "475", + "$id": "561", "kind": "method", "name": "optionalNullableString", "serializedName": "optionalNullableString", "doc": "required optional string", "type": { - "$ref": "210" + "$ref": "220" }, "location": "Body", "isApiVersion": false, @@ -6088,7 +7444,7 @@ "decorators": [] }, { - "$id": "476", + "$id": "562", "kind": "method", "name": "requiredLiteralInt", "serializedName": "requiredLiteralInt", @@ -6106,7 +7462,7 @@ "decorators": [] }, { - "$id": "477", + "$id": "563", "kind": "method", "name": "requiredLiteralFloat", "serializedName": "requiredLiteralFloat", @@ -6124,7 +7480,7 @@ "decorators": [] }, { - "$id": "478", + "$id": "564", "kind": "method", "name": "requiredLiteralBool", "serializedName": "requiredLiteralBool", @@ -6142,18 +7498,18 @@ "decorators": [] }, { - "$id": "479", + "$id": "565", "kind": "method", "name": "optionalLiteralString", "serializedName": "optionalLiteralString", "doc": "optional literal string", "type": { - "$id": "480", + "$id": "566", "kind": "enum", "name": "ThingOptionalLiteralString", "crossLanguageDefinitionId": "", "valueType": { - "$id": "481", + "$id": "567", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6161,12 +7517,12 @@ }, "values": [ { - "$id": "482", + "$id": "568", "kind": "enumvalue", "name": "reject", "value": "reject", "valueType": { - "$id": "483", + "$id": "569", "kind": "string", "decorators": [], "doc": "A sequence of textual characters.", @@ -6174,7 +7530,7 @@ "crossLanguageDefinitionId": "TypeSpec.string" }, "enumType": { - "$ref": "480" + "$ref": "566" }, "decorators": [] } @@ -6195,13 +7551,13 @@ "decorators": [] }, { - "$id": "484", + "$id": "570", "kind": "method", "name": "requiredNullableLiteralString", "serializedName": "requiredNullableLiteralString", "doc": "required nullable literal string", "type": { - "$ref": "217" + "$ref": "227" }, "location": "Body", "isApiVersion": false, @@ -6213,18 +7569,18 @@ "decorators": [] }, { - "$id": "485", + "$id": "571", "kind": "method", "name": "optionalLiteralInt", "serializedName": "optionalLiteralInt", "doc": "optional literal int", "type": { - "$id": "486", + "$id": "572", "kind": "enum", "name": "ThingOptionalLiteralInt", "crossLanguageDefinitionId": "", "valueType": { - "$id": "487", + "$id": "573", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -6232,12 +7588,12 @@ }, "values": [ { - "$id": "488", + "$id": "574", "kind": "enumvalue", "name": "456", "value": 456, "valueType": { - "$id": "489", + "$id": "575", "kind": "int32", "decorators": [], "doc": "A 32-bit integer. (`-2,147,483,648` to `2,147,483,647`)", @@ -6245,7 +7601,7 @@ "crossLanguageDefinitionId": "TypeSpec.int32" }, "enumType": { - "$ref": "486" + "$ref": "572" }, "decorators": [] } @@ -6266,18 +7622,18 @@ "decorators": [] }, { - "$id": "490", + "$id": "576", "kind": "method", "name": "optionalLiteralFloat", "serializedName": "optionalLiteralFloat", "doc": "optional literal float", "type": { - "$id": "491", + "$id": "577", "kind": "enum", "name": "ThingOptionalLiteralFloat", "crossLanguageDefinitionId": "", "valueType": { - "$id": "492", + "$id": "578", "kind": "float32", "name": "float32", "crossLanguageDefinitionId": "TypeSpec.float32", @@ -6285,12 +7641,12 @@ }, "values": [ { - "$id": "493", + "$id": "579", "kind": "enumvalue", "name": "4.56", "value": 4.56, "valueType": { - "$id": "494", + "$id": "580", "kind": "float32", "decorators": [], "doc": "A 32 bit floating point number. (`±1.5 x 10^−45` to `±3.4 x 10^38`)", @@ -6298,7 +7654,7 @@ "crossLanguageDefinitionId": "TypeSpec.float32" }, "enumType": { - "$ref": "491" + "$ref": "577" }, "decorators": [] } @@ -6319,7 +7675,7 @@ "decorators": [] }, { - "$id": "495", + "$id": "581", "kind": "method", "name": "optionalLiteralBool", "serializedName": "optionalLiteralBool", @@ -6337,13 +7693,13 @@ "decorators": [] }, { - "$id": "496", + "$id": "582", "kind": "method", "name": "requiredBadDescription", "serializedName": "requiredBadDescription", "doc": "description with xml <|endoftext|>", "type": { - "$id": "497", + "$id": "583", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6359,13 +7715,13 @@ "decorators": [] }, { - "$id": "498", + "$id": "584", "kind": "method", "name": "optionalNullableList", "serializedName": "optionalNullableList", "doc": "optional nullable collection", "type": { - "$ref": "224" + "$ref": "234" }, "location": "Body", "isApiVersion": false, @@ -6377,13 +7733,13 @@ "decorators": [] }, { - "$id": "499", + "$id": "585", "kind": "method", "name": "requiredNullableList", "serializedName": "requiredNullableList", "doc": "required nullable collection", "type": { - "$ref": "228" + "$ref": "238" }, "location": "Body", "isApiVersion": false, @@ -6395,13 +7751,13 @@ "decorators": [] }, { - "$id": "500", + "$id": "586", "kind": "method", "name": "propertyWithSpecialDocs", "serializedName": "propertyWithSpecialDocs", "doc": "This tests:\n- Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines.\n- Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation.\n- Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output.\n- Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases.\n- **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines.\n- *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines.", "type": { - "$id": "501", + "$id": "587", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6417,12 +7773,12 @@ "decorators": [] }, { - "$id": "502", + "$id": "588", "kind": "method", "name": "requiredQueryParam", "serializedName": "requiredQueryParam", "type": { - "$ref": "142" + "$ref": "144" }, "location": "Query", "isApiVersion": false, @@ -6434,12 +7790,12 @@ "decorators": [] }, { - "$id": "503", + "$id": "589", "kind": "method", "name": "requiredHeader", "serializedName": "required-header", "type": { - "$ref": "144" + "$ref": "146" }, "location": "Header", "isApiVersion": false, @@ -6451,13 +7807,13 @@ "decorators": [] }, { - "$id": "504", + "$id": "590", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "128" + "$ref": "130" }, "location": "Header", "isApiVersion": false, @@ -6469,12 +7825,12 @@ "decorators": [] }, { - "$id": "505", + "$id": "591", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "130" + "$ref": "132" }, "location": "Header", "isApiVersion": false, @@ -6488,7 +7844,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -6497,7 +7853,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody" }, { - "$id": "506", + "$id": "592", "kind": "basic", "name": "friendlyModel", "accessibility": "public", @@ -6507,20 +7863,20 @@ ], "doc": "Model can have its friendly name", "operation": { - "$id": "507", + "$id": "593", "name": "friendlyModel", "resourceName": "SampleTypeSpec", "doc": "Model can have its friendly name", "accessibility": "public", "parameters": [ { - "$id": "508", + "$id": "594", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "146" + "$ref": "148" }, "isApiVersion": false, "optional": false, @@ -6531,12 +7887,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.friendlyModel.contentType" }, { - "$id": "509", + "$id": "595", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "148" + "$ref": "150" }, "isApiVersion": false, "optional": false, @@ -6547,12 +7903,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.friendlyModel.accept" }, { - "$id": "510", + "$id": "596", "kind": "body", "name": "friend", "serializedName": "friend", "type": { - "$ref": "279" + "$ref": "289" }, "isApiVersion": false, "contentTypes": [ @@ -6572,7 +7928,7 @@ 200 ], "bodyType": { - "$ref": "279" + "$ref": "289" }, "headers": [], "isErrorResponse": false, @@ -6596,13 +7952,13 @@ }, "parameters": [ { - "$id": "511", + "$id": "597", "kind": "method", "name": "name", "serializedName": "name", "doc": "name of the NotFriend", "type": { - "$id": "512", + "$id": "598", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6618,13 +7974,13 @@ "decorators": [] }, { - "$id": "513", + "$id": "599", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "146" + "$ref": "148" }, "location": "Header", "isApiVersion": false, @@ -6636,12 +7992,12 @@ "decorators": [] }, { - "$id": "514", + "$id": "600", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "148" + "$ref": "150" }, "location": "Header", "isApiVersion": false, @@ -6655,7 +8011,7 @@ ], "response": { "type": { - "$ref": "279" + "$ref": "289" } }, "isOverride": false, @@ -6664,7 +8020,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.friendlyModel" }, { - "$id": "515", + "$id": "601", "kind": "basic", "name": "addTimeHeader", "accessibility": "public", @@ -6673,23 +8029,23 @@ "2024-08-16-preview" ], "operation": { - "$id": "516", + "$id": "602", "name": "addTimeHeader", "resourceName": "SampleTypeSpec", "accessibility": "public", "parameters": [ { - "$id": "517", + "$id": "603", "kind": "header", "name": "repeatabilityFirstSent", "serializedName": "Repeatability-First-Sent", "type": { - "$id": "518", + "$id": "604", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc7231", "wireType": { - "$id": "519", + "$id": "605", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6728,17 +8084,17 @@ }, "parameters": [ { - "$id": "520", + "$id": "606", "kind": "method", "name": "repeatabilityFirstSent", "serializedName": "Repeatability-First-Sent", "type": { - "$id": "521", + "$id": "607", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc7231", "wireType": { - "$id": "522", + "$id": "608", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6764,7 +8120,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.addTimeHeader" }, { - "$id": "523", + "$id": "609", "kind": "basic", "name": "projectedNameModel", "accessibility": "public", @@ -6774,20 +8130,20 @@ ], "doc": "Model can have its projected name", "operation": { - "$id": "524", + "$id": "610", "name": "projectedNameModel", "resourceName": "SampleTypeSpec", "doc": "Model can have its projected name", "accessibility": "public", "parameters": [ { - "$id": "525", + "$id": "611", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "150" + "$ref": "152" }, "isApiVersion": false, "optional": false, @@ -6798,12 +8154,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.projectedNameModel.contentType" }, { - "$id": "526", + "$id": "612", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "152" + "$ref": "154" }, "isApiVersion": false, "optional": false, @@ -6814,12 +8170,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.projectedNameModel.accept" }, { - "$id": "527", + "$id": "613", "kind": "body", "name": "renamedModel", "serializedName": "renamedModel", "type": { - "$ref": "282" + "$ref": "292" }, "isApiVersion": false, "contentTypes": [ @@ -6839,7 +8195,7 @@ 200 ], "bodyType": { - "$ref": "282" + "$ref": "292" }, "headers": [], "isErrorResponse": false, @@ -6863,13 +8219,13 @@ }, "parameters": [ { - "$id": "528", + "$id": "614", "kind": "method", "name": "otherName", "serializedName": "otherName", "doc": "name of the ModelWithClientName", "type": { - "$id": "529", + "$id": "615", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6885,13 +8241,13 @@ "decorators": [] }, { - "$id": "530", + "$id": "616", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "150" + "$ref": "152" }, "location": "Header", "isApiVersion": false, @@ -6903,12 +8259,12 @@ "decorators": [] }, { - "$id": "531", + "$id": "617", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "152" + "$ref": "154" }, "location": "Header", "isApiVersion": false, @@ -6922,7 +8278,7 @@ ], "response": { "type": { - "$ref": "282" + "$ref": "292" } }, "isOverride": false, @@ -6931,7 +8287,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.projectedNameModel" }, { - "$id": "532", + "$id": "618", "kind": "basic", "name": "returnsAnonymousModel", "accessibility": "public", @@ -6941,19 +8297,19 @@ ], "doc": "return anonymous model", "operation": { - "$id": "533", + "$id": "619", "name": "returnsAnonymousModel", "resourceName": "SampleTypeSpec", "doc": "return anonymous model", "accessibility": "public", "parameters": [ { - "$id": "534", + "$id": "620", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "154" + "$ref": "156" }, "isApiVersion": false, "optional": false, @@ -6970,7 +8326,7 @@ 200 ], "bodyType": { - "$ref": "285" + "$ref": "295" }, "headers": [], "isErrorResponse": false, @@ -6991,12 +8347,12 @@ }, "parameters": [ { - "$id": "535", + "$id": "621", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "154" + "$ref": "156" }, "location": "Header", "isApiVersion": false, @@ -7010,7 +8366,7 @@ ], "response": { "type": { - "$ref": "285" + "$ref": "295" } }, "isOverride": false, @@ -7019,7 +8375,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.returnsAnonymousModel" }, { - "$id": "536", + "$id": "622", "kind": "basic", "name": "getUnknownValue", "accessibility": "public", @@ -7029,19 +8385,19 @@ ], "doc": "get extensible enum", "operation": { - "$id": "537", + "$id": "623", "name": "getUnknownValue", "resourceName": "SampleTypeSpec", "doc": "get extensible enum", "accessibility": "public", "parameters": [ { - "$id": "538", + "$id": "624", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$id": "539", + "$id": "625", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7062,7 +8418,7 @@ 200 ], "bodyType": { - "$id": "540", + "$id": "626", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7094,12 +8450,12 @@ }, "parameters": [ { - "$id": "541", + "$id": "627", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "539" + "$ref": "625" }, "location": "Header", "isApiVersion": false, @@ -7113,7 +8469,7 @@ ], "response": { "type": { - "$ref": "540" + "$ref": "626" } }, "isOverride": false, @@ -7122,7 +8478,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.getUnknownValue" }, { - "$id": "542", + "$id": "628", "kind": "basic", "name": "internalProtocol", "accessibility": "public", @@ -7132,20 +8488,20 @@ ], "doc": "When set protocol false and convenient true, then the protocol method should be internal", "operation": { - "$id": "543", + "$id": "629", "name": "internalProtocol", "resourceName": "SampleTypeSpec", "doc": "When set protocol false and convenient true, then the protocol method should be internal", "accessibility": "public", "parameters": [ { - "$id": "544", + "$id": "630", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "156" + "$ref": "158" }, "isApiVersion": false, "optional": false, @@ -7156,12 +8512,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.internalProtocol.contentType" }, { - "$id": "545", + "$id": "631", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "158" + "$ref": "160" }, "isApiVersion": false, "optional": false, @@ -7172,12 +8528,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.internalProtocol.accept" }, { - "$id": "546", + "$id": "632", "kind": "body", "name": "body", "serializedName": "body", "type": { - "$ref": "196" + "$ref": "206" }, "isApiVersion": false, "contentTypes": [ @@ -7197,7 +8553,7 @@ 200 ], "bodyType": { - "$ref": "196" + "$ref": "206" }, "headers": [], "isErrorResponse": false, @@ -7221,12 +8577,12 @@ }, "parameters": [ { - "$id": "547", + "$id": "633", "kind": "method", "name": "body", "serializedName": "body", "type": { - "$ref": "196" + "$ref": "206" }, "location": "Body", "isApiVersion": false, @@ -7238,13 +8594,13 @@ "decorators": [] }, { - "$id": "548", + "$id": "634", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "156" + "$ref": "158" }, "location": "Header", "isApiVersion": false, @@ -7256,12 +8612,12 @@ "decorators": [] }, { - "$id": "549", + "$id": "635", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "158" + "$ref": "160" }, "location": "Header", "isApiVersion": false, @@ -7275,7 +8631,7 @@ ], "response": { "type": { - "$ref": "196" + "$ref": "206" } }, "isOverride": false, @@ -7284,7 +8640,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.internalProtocol" }, { - "$id": "550", + "$id": "636", "kind": "basic", "name": "stillConvenient", "accessibility": "public", @@ -7294,7 +8650,7 @@ ], "doc": "When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one", "operation": { - "$id": "551", + "$id": "637", "name": "stillConvenient", "resourceName": "SampleTypeSpec", "doc": "When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one", @@ -7327,7 +8683,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.stillConvenient" }, { - "$id": "552", + "$id": "638", "kind": "basic", "name": "headAsBoolean", "accessibility": "public", @@ -7337,19 +8693,19 @@ ], "doc": "head as boolean.", "operation": { - "$id": "553", + "$id": "639", "name": "headAsBoolean", "resourceName": "SampleTypeSpec", "doc": "head as boolean.", "accessibility": "public", "parameters": [ { - "$id": "554", + "$id": "640", "kind": "path", "name": "id", "serializedName": "id", "type": { - "$id": "555", + "$id": "641", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7388,12 +8744,12 @@ }, "parameters": [ { - "$id": "556", + "$id": "642", "kind": "method", "name": "id", "serializedName": "id", "type": { - "$id": "557", + "$id": "643", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7416,7 +8772,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.headAsBoolean" }, { - "$id": "558", + "$id": "644", "kind": "basic", "name": "WithApiVersion", "accessibility": "public", @@ -7426,19 +8782,19 @@ ], "doc": "Return hi again", "operation": { - "$id": "559", + "$id": "645", "name": "WithApiVersion", "resourceName": "SampleTypeSpec", "doc": "Return hi again", "accessibility": "public", "parameters": [ { - "$id": "560", + "$id": "646", "kind": "header", "name": "p1", "serializedName": "p1", "type": { - "$id": "561", + "$id": "647", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7453,12 +8809,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.WithApiVersion.p1" }, { - "$id": "562", + "$id": "648", "kind": "query", "name": "apiVersion", "serializedName": "apiVersion", "type": { - "$id": "563", + "$id": "649", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7468,7 +8824,7 @@ "explode": false, "defaultValue": { "type": { - "$id": "564", + "$id": "650", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" @@ -7503,12 +8859,12 @@ }, "parameters": [ { - "$id": "565", + "$id": "651", "kind": "method", "name": "p1", "serializedName": "p1", "type": { - "$id": "566", + "$id": "652", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7531,7 +8887,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.WithApiVersion" }, { - "$id": "567", + "$id": "653", "kind": "paging", "name": "ListWithNextLink", "accessibility": "public", @@ -7541,19 +8897,19 @@ ], "doc": "List things with nextlink", "operation": { - "$id": "568", + "$id": "654", "name": "ListWithNextLink", "resourceName": "SampleTypeSpec", "doc": "List things with nextlink", "accessibility": "public", "parameters": [ { - "$id": "569", + "$id": "655", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "160" + "$ref": "162" }, "isApiVersion": false, "optional": false, @@ -7570,7 +8926,7 @@ 200 ], "bodyType": { - "$ref": "286" + "$ref": "296" }, "headers": [], "isErrorResponse": false, @@ -7591,12 +8947,12 @@ }, "parameters": [ { - "$id": "570", + "$id": "656", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "160" + "$ref": "162" }, "location": "Header", "isApiVersion": false, @@ -7610,7 +8966,7 @@ ], "response": { "type": { - "$ref": "288" + "$ref": "298" }, "resultSegments": [ "things" @@ -7634,7 +8990,7 @@ } }, { - "$id": "571", + "$id": "657", "kind": "paging", "name": "ListWithStringNextLink", "accessibility": "public", @@ -7644,19 +9000,19 @@ ], "doc": "List things with nextlink", "operation": { - "$id": "572", + "$id": "658", "name": "ListWithStringNextLink", "resourceName": "SampleTypeSpec", "doc": "List things with nextlink", "accessibility": "public", "parameters": [ { - "$id": "573", + "$id": "659", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "162" + "$ref": "164" }, "isApiVersion": false, "optional": false, @@ -7673,7 +9029,7 @@ 200 ], "bodyType": { - "$ref": "291" + "$ref": "301" }, "headers": [], "isErrorResponse": false, @@ -7694,12 +9050,12 @@ }, "parameters": [ { - "$id": "574", + "$id": "660", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "162" + "$ref": "164" }, "location": "Header", "isApiVersion": false, @@ -7713,7 +9069,7 @@ ], "response": { "type": { - "$ref": "288" + "$ref": "298" }, "resultSegments": [ "things" @@ -7737,7 +9093,7 @@ } }, { - "$id": "575", + "$id": "661", "kind": "paging", "name": "ListWithContinuationToken", "accessibility": "public", @@ -7747,19 +9103,19 @@ ], "doc": "List things with continuation token", "operation": { - "$id": "576", + "$id": "662", "name": "ListWithContinuationToken", "resourceName": "SampleTypeSpec", "doc": "List things with continuation token", "accessibility": "public", "parameters": [ { - "$id": "577", + "$id": "663", "kind": "query", "name": "token", "serializedName": "token", "type": { - "$id": "578", + "$id": "664", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7774,12 +9130,12 @@ "readOnly": false }, { - "$id": "579", + "$id": "665", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "164" + "$ref": "166" }, "isApiVersion": false, "optional": false, @@ -7796,7 +9152,7 @@ 200 ], "bodyType": { - "$ref": "295" + "$ref": "305" }, "headers": [], "isErrorResponse": false, @@ -7817,12 +9173,12 @@ }, "parameters": [ { - "$id": "580", + "$id": "666", "kind": "method", "name": "token", "serializedName": "token", "type": { - "$id": "581", + "$id": "667", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7838,12 +9194,12 @@ "decorators": [] }, { - "$id": "582", + "$id": "668", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "164" + "$ref": "166" }, "location": "Header", "isApiVersion": false, @@ -7857,7 +9213,7 @@ ], "response": { "type": { - "$ref": "288" + "$ref": "298" }, "resultSegments": [ "things" @@ -7873,7 +9229,7 @@ ], "continuationToken": { "parameter": { - "$ref": "577" + "$ref": "663" }, "responseSegments": [ "nextToken" @@ -7884,7 +9240,7 @@ } }, { - "$id": "583", + "$id": "669", "kind": "paging", "name": "ListWithContinuationTokenHeaderResponse", "accessibility": "public", @@ -7894,19 +9250,19 @@ ], "doc": "List things with continuation token header response", "operation": { - "$id": "584", + "$id": "670", "name": "ListWithContinuationTokenHeaderResponse", "resourceName": "SampleTypeSpec", "doc": "List things with continuation token header response", "accessibility": "public", "parameters": [ { - "$id": "585", + "$id": "671", "kind": "query", "name": "token", "serializedName": "token", "type": { - "$id": "586", + "$id": "672", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7921,12 +9277,12 @@ "readOnly": false }, { - "$id": "587", + "$id": "673", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "166" + "$ref": "168" }, "isApiVersion": false, "optional": false, @@ -7943,14 +9299,14 @@ 200 ], "bodyType": { - "$ref": "299" + "$ref": "309" }, "headers": [ { "name": "nextToken", "nameInResponse": "next-token", "type": { - "$id": "588", + "$id": "674", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7976,12 +9332,12 @@ }, "parameters": [ { - "$id": "589", + "$id": "675", "kind": "method", "name": "token", "serializedName": "token", "type": { - "$id": "590", + "$id": "676", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7997,12 +9353,12 @@ "decorators": [] }, { - "$id": "591", + "$id": "677", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "166" + "$ref": "168" }, "location": "Header", "isApiVersion": false, @@ -8016,7 +9372,7 @@ ], "response": { "type": { - "$ref": "288" + "$ref": "298" }, "resultSegments": [ "things" @@ -8032,7 +9388,7 @@ ], "continuationToken": { "parameter": { - "$ref": "585" + "$ref": "671" }, "responseSegments": [ "next-token" @@ -8043,7 +9399,7 @@ } }, { - "$id": "592", + "$id": "678", "kind": "paging", "name": "ListWithPaging", "accessibility": "public", @@ -8053,19 +9409,19 @@ ], "doc": "List things with paging", "operation": { - "$id": "593", + "$id": "679", "name": "ListWithPaging", "resourceName": "SampleTypeSpec", "doc": "List things with paging", "accessibility": "public", "parameters": [ { - "$id": "594", + "$id": "680", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "168" + "$ref": "170" }, "isApiVersion": false, "optional": false, @@ -8082,7 +9438,7 @@ 200 ], "bodyType": { - "$ref": "301" + "$ref": "311" }, "headers": [], "isErrorResponse": false, @@ -8103,12 +9459,12 @@ }, "parameters": [ { - "$id": "595", + "$id": "681", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "168" + "$ref": "170" }, "location": "Header", "isApiVersion": false, @@ -8122,7 +9478,7 @@ ], "response": { "type": { - "$ref": "288" + "$ref": "298" }, "resultSegments": [ "items" @@ -8140,7 +9496,7 @@ } }, { - "$id": "596", + "$id": "682", "kind": "basic", "name": "EmbeddedParameters", "accessibility": "public", @@ -8150,20 +9506,20 @@ ], "doc": "An operation with embedded parameters within the body", "operation": { - "$id": "597", + "$id": "683", "name": "EmbeddedParameters", "resourceName": "SampleTypeSpec", "doc": "An operation with embedded parameters within the body", "accessibility": "public", "parameters": [ { - "$id": "598", + "$id": "684", "kind": "header", "name": "requiredHeader", "serializedName": "required-header", "doc": "required header parameter", "type": { - "$id": "599", + "$id": "685", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8178,13 +9534,13 @@ "crossLanguageDefinitionId": "SampleTypeSpec.ModelWithEmbeddedNonBodyParameters.requiredHeader" }, { - "$id": "600", + "$id": "686", "kind": "header", "name": "optionalHeader", "serializedName": "optional-header", "doc": "optional header parameter", "type": { - "$id": "601", + "$id": "687", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8199,13 +9555,13 @@ "crossLanguageDefinitionId": "SampleTypeSpec.ModelWithEmbeddedNonBodyParameters.optionalHeader" }, { - "$id": "602", + "$id": "688", "kind": "query", "name": "requiredQuery", "serializedName": "requiredQuery", "doc": "required query parameter", "type": { - "$id": "603", + "$id": "689", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8220,13 +9576,13 @@ "readOnly": false }, { - "$id": "604", + "$id": "690", "kind": "query", "name": "optionalQuery", "serializedName": "optionalQuery", "doc": "optional query parameter", "type": { - "$id": "605", + "$id": "691", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8241,13 +9597,13 @@ "readOnly": false }, { - "$id": "606", + "$id": "692", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "170" + "$ref": "172" }, "isApiVersion": false, "optional": false, @@ -8258,12 +9614,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.EmbeddedParameters.contentType" }, { - "$id": "607", + "$id": "693", "kind": "body", "name": "body", "serializedName": "body", "type": { - "$ref": "303" + "$ref": "313" }, "isApiVersion": false, "contentTypes": [ @@ -8301,12 +9657,12 @@ }, "parameters": [ { - "$id": "608", + "$id": "694", "kind": "method", "name": "body", "serializedName": "body", "type": { - "$ref": "303" + "$ref": "313" }, "location": "Body", "isApiVersion": false, @@ -8318,13 +9674,13 @@ "decorators": [] }, { - "$id": "609", + "$id": "695", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "170" + "$ref": "172" }, "location": "Header", "isApiVersion": false, @@ -8343,7 +9699,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.EmbeddedParameters" }, { - "$id": "610", + "$id": "696", "kind": "basic", "name": "DynamicModelOperation", "accessibility": "public", @@ -8353,20 +9709,20 @@ ], "doc": "An operation with a dynamic model", "operation": { - "$id": "611", + "$id": "697", "name": "DynamicModelOperation", "resourceName": "SampleTypeSpec", "doc": "An operation with a dynamic model", "accessibility": "public", "parameters": [ { - "$id": "612", + "$id": "698", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "172" + "$ref": "174" }, "isApiVersion": false, "optional": false, @@ -8377,12 +9733,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.DynamicModelOperation.contentType" }, { - "$id": "613", + "$id": "699", "kind": "body", "name": "body", "serializedName": "body", "type": { - "$ref": "314" + "$ref": "324" }, "isApiVersion": false, "contentTypes": [ @@ -8420,12 +9776,12 @@ }, "parameters": [ { - "$id": "614", + "$id": "700", "kind": "method", "name": "body", "serializedName": "body", "type": { - "$ref": "314" + "$ref": "324" }, "location": "Body", "isApiVersion": false, @@ -8437,13 +9793,13 @@ "decorators": [] }, { - "$id": "615", + "$id": "701", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "172" + "$ref": "174" }, "location": "Header", "isApiVersion": false, @@ -8460,16 +9816,112 @@ "generateConvenient": true, "generateProtocol": true, "crossLanguageDefinitionId": "SampleTypeSpec.DynamicModelOperation" + }, + { + "$id": "702", + "kind": "basic", + "name": "GetXmlAdvancedModel", + "accessibility": "public", + "apiVersions": [ + "2024-07-16-preview", + "2024-08-16-preview" + ], + "doc": "Get an advanced XML model with various property types", + "operation": { + "$id": "703", + "name": "GetXmlAdvancedModel", + "resourceName": "SampleTypeSpec", + "doc": "Get an advanced XML model with various property types", + "accessibility": "public", + "parameters": [ + { + "$id": "704", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "176" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.GetXmlAdvancedModel.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "362" + }, + "headers": [ + { + "name": "contentType", + "nameInResponse": "content-type", + "type": { + "$ref": "178" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/xml" + ] + } + ], + "httpMethod": "GET", + "uri": "{sampleTypeSpecUrl}", + "path": "/xmlAdvanced", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "SampleTypeSpec.GetXmlAdvancedModel", + "decorators": [], + "namespace": "SampleTypeSpec" + }, + "parameters": [ + { + "$id": "705", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "176" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "SampleTypeSpec.GetXmlAdvancedModel.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "362" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "SampleTypeSpec.GetXmlAdvancedModel" } ], "parameters": [ { - "$id": "616", + "$id": "706", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "617", + "$id": "707", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -8484,12 +9936,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.sampleTypeSpecUrl" }, { - "$id": "618", + "$id": "708", "kind": "method", "name": "apiVersion", "serializedName": "apiVersion", "type": { - "$id": "619", + "$id": "709", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8499,7 +9951,7 @@ "isApiVersion": true, "defaultValue": { "type": { - "$id": "620", + "$id": "710", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" @@ -8523,13 +9975,13 @@ ], "children": [ { - "$id": "621", + "$id": "711", "kind": "client", "name": "AnimalOperations", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "622", + "$id": "712", "kind": "basic", "name": "updatePetAsAnimal", "accessibility": "public", @@ -8539,20 +9991,20 @@ ], "doc": "Update a pet as an animal", "operation": { - "$id": "623", + "$id": "713", "name": "updatePetAsAnimal", "resourceName": "AnimalOperations", "doc": "Update a pet as an animal", "accessibility": "public", "parameters": [ { - "$id": "624", + "$id": "714", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "174" + "$ref": "180" }, "isApiVersion": false, "optional": false, @@ -8563,12 +10015,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updatePetAsAnimal.contentType" }, { - "$id": "625", + "$id": "715", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "176" + "$ref": "182" }, "isApiVersion": false, "optional": false, @@ -8579,12 +10031,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updatePetAsAnimal.accept" }, { - "$id": "626", + "$id": "716", "kind": "body", "name": "animal", "serializedName": "animal", "type": { - "$ref": "352" + "$ref": "427" }, "isApiVersion": false, "contentTypes": [ @@ -8604,7 +10056,7 @@ 200 ], "bodyType": { - "$ref": "352" + "$ref": "427" }, "headers": [], "isErrorResponse": false, @@ -8628,12 +10080,12 @@ }, "parameters": [ { - "$id": "627", + "$id": "717", "kind": "method", "name": "animal", "serializedName": "animal", "type": { - "$ref": "352" + "$ref": "427" }, "location": "Body", "isApiVersion": false, @@ -8645,13 +10097,13 @@ "decorators": [] }, { - "$id": "628", + "$id": "718", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "174" + "$ref": "180" }, "location": "Header", "isApiVersion": false, @@ -8663,12 +10115,12 @@ "decorators": [] }, { - "$id": "629", + "$id": "719", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "176" + "$ref": "182" }, "location": "Header", "isApiVersion": false, @@ -8682,7 +10134,7 @@ ], "response": { "type": { - "$ref": "352" + "$ref": "427" } }, "isOverride": false, @@ -8691,7 +10143,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updatePetAsAnimal" }, { - "$id": "630", + "$id": "720", "kind": "basic", "name": "updateDogAsAnimal", "accessibility": "public", @@ -8701,20 +10153,20 @@ ], "doc": "Update a dog as an animal", "operation": { - "$id": "631", + "$id": "721", "name": "updateDogAsAnimal", "resourceName": "AnimalOperations", "doc": "Update a dog as an animal", "accessibility": "public", "parameters": [ { - "$id": "632", + "$id": "722", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "178" + "$ref": "184" }, "isApiVersion": false, "optional": false, @@ -8725,12 +10177,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updateDogAsAnimal.contentType" }, { - "$id": "633", + "$id": "723", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "180" + "$ref": "186" }, "isApiVersion": false, "optional": false, @@ -8741,12 +10193,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updateDogAsAnimal.accept" }, { - "$id": "634", + "$id": "724", "kind": "body", "name": "animal", "serializedName": "animal", "type": { - "$ref": "352" + "$ref": "427" }, "isApiVersion": false, "contentTypes": [ @@ -8766,7 +10218,7 @@ 200 ], "bodyType": { - "$ref": "352" + "$ref": "427" }, "headers": [], "isErrorResponse": false, @@ -8790,12 +10242,12 @@ }, "parameters": [ { - "$id": "635", + "$id": "725", "kind": "method", "name": "animal", "serializedName": "animal", "type": { - "$ref": "352" + "$ref": "427" }, "location": "Body", "isApiVersion": false, @@ -8807,13 +10259,13 @@ "decorators": [] }, { - "$id": "636", + "$id": "726", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "178" + "$ref": "184" }, "location": "Header", "isApiVersion": false, @@ -8825,12 +10277,12 @@ "decorators": [] }, { - "$id": "637", + "$id": "727", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "180" + "$ref": "186" }, "location": "Header", "isApiVersion": false, @@ -8844,7 +10296,7 @@ ], "response": { "type": { - "$ref": "352" + "$ref": "427" } }, "isOverride": false, @@ -8855,12 +10307,12 @@ ], "parameters": [ { - "$id": "638", + "$id": "728", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "639", + "$id": "729", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -8883,18 +10335,18 @@ "2024-08-16-preview" ], "parent": { - "$ref": "370" + "$ref": "456" }, "isMultiServiceClient": false }, { - "$id": "640", + "$id": "730", "kind": "client", "name": "PetOperations", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "641", + "$id": "731", "kind": "basic", "name": "updatePetAsPet", "accessibility": "public", @@ -8904,20 +10356,20 @@ ], "doc": "Update a pet as a pet", "operation": { - "$id": "642", + "$id": "732", "name": "updatePetAsPet", "resourceName": "PetOperations", "doc": "Update a pet as a pet", "accessibility": "public", "parameters": [ { - "$id": "643", + "$id": "733", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "182" + "$ref": "188" }, "isApiVersion": false, "optional": false, @@ -8928,12 +10380,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updatePetAsPet.contentType" }, { - "$id": "644", + "$id": "734", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "184" + "$ref": "190" }, "isApiVersion": false, "optional": false, @@ -8944,12 +10396,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updatePetAsPet.accept" }, { - "$id": "645", + "$id": "735", "kind": "body", "name": "pet", "serializedName": "pet", "type": { - "$ref": "357" + "$ref": "432" }, "isApiVersion": false, "contentTypes": [ @@ -8969,7 +10421,7 @@ 200 ], "bodyType": { - "$ref": "357" + "$ref": "432" }, "headers": [], "isErrorResponse": false, @@ -8993,12 +10445,12 @@ }, "parameters": [ { - "$id": "646", + "$id": "736", "kind": "method", "name": "pet", "serializedName": "pet", "type": { - "$ref": "357" + "$ref": "432" }, "location": "Body", "isApiVersion": false, @@ -9010,13 +10462,13 @@ "decorators": [] }, { - "$id": "647", + "$id": "737", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "182" + "$ref": "188" }, "location": "Header", "isApiVersion": false, @@ -9028,12 +10480,12 @@ "decorators": [] }, { - "$id": "648", + "$id": "738", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "184" + "$ref": "190" }, "location": "Header", "isApiVersion": false, @@ -9047,7 +10499,7 @@ ], "response": { "type": { - "$ref": "357" + "$ref": "432" } }, "isOverride": false, @@ -9056,7 +10508,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updatePetAsPet" }, { - "$id": "649", + "$id": "739", "kind": "basic", "name": "updateDogAsPet", "accessibility": "public", @@ -9066,20 +10518,20 @@ ], "doc": "Update a dog as a pet", "operation": { - "$id": "650", + "$id": "740", "name": "updateDogAsPet", "resourceName": "PetOperations", "doc": "Update a dog as a pet", "accessibility": "public", "parameters": [ { - "$id": "651", + "$id": "741", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "186" + "$ref": "192" }, "isApiVersion": false, "optional": false, @@ -9090,12 +10542,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updateDogAsPet.contentType" }, { - "$id": "652", + "$id": "742", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "188" + "$ref": "194" }, "isApiVersion": false, "optional": false, @@ -9106,12 +10558,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updateDogAsPet.accept" }, { - "$id": "653", + "$id": "743", "kind": "body", "name": "pet", "serializedName": "pet", "type": { - "$ref": "357" + "$ref": "432" }, "isApiVersion": false, "contentTypes": [ @@ -9131,7 +10583,7 @@ 200 ], "bodyType": { - "$ref": "357" + "$ref": "432" }, "headers": [], "isErrorResponse": false, @@ -9155,12 +10607,12 @@ }, "parameters": [ { - "$id": "654", + "$id": "744", "kind": "method", "name": "pet", "serializedName": "pet", "type": { - "$ref": "357" + "$ref": "432" }, "location": "Body", "isApiVersion": false, @@ -9172,13 +10624,13 @@ "decorators": [] }, { - "$id": "655", + "$id": "745", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "186" + "$ref": "192" }, "location": "Header", "isApiVersion": false, @@ -9190,12 +10642,12 @@ "decorators": [] }, { - "$id": "656", + "$id": "746", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "188" + "$ref": "194" }, "location": "Header", "isApiVersion": false, @@ -9209,7 +10661,7 @@ ], "response": { "type": { - "$ref": "357" + "$ref": "432" } }, "isOverride": false, @@ -9220,12 +10672,12 @@ ], "parameters": [ { - "$id": "657", + "$id": "747", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "658", + "$id": "748", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -9248,18 +10700,18 @@ "2024-08-16-preview" ], "parent": { - "$ref": "370" + "$ref": "456" }, "isMultiServiceClient": false }, { - "$id": "659", + "$id": "749", "kind": "client", "name": "DogOperations", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "660", + "$id": "750", "kind": "basic", "name": "updateDogAsDog", "accessibility": "public", @@ -9269,20 +10721,20 @@ ], "doc": "Update a dog as a dog", "operation": { - "$id": "661", + "$id": "751", "name": "updateDogAsDog", "resourceName": "DogOperations", "doc": "Update a dog as a dog", "accessibility": "public", "parameters": [ { - "$id": "662", + "$id": "752", "kind": "header", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "190" + "$ref": "196" }, "isApiVersion": false, "optional": false, @@ -9293,12 +10745,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.DogOperations.updateDogAsDog.contentType" }, { - "$id": "663", + "$id": "753", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "192" + "$ref": "198" }, "isApiVersion": false, "optional": false, @@ -9309,12 +10761,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.DogOperations.updateDogAsDog.accept" }, { - "$id": "664", + "$id": "754", "kind": "body", "name": "dog", "serializedName": "dog", "type": { - "$ref": "361" + "$ref": "436" }, "isApiVersion": false, "contentTypes": [ @@ -9334,7 +10786,7 @@ 200 ], "bodyType": { - "$ref": "361" + "$ref": "436" }, "headers": [], "isErrorResponse": false, @@ -9358,12 +10810,12 @@ }, "parameters": [ { - "$id": "665", + "$id": "755", "kind": "method", "name": "dog", "serializedName": "dog", "type": { - "$ref": "361" + "$ref": "436" }, "location": "Body", "isApiVersion": false, @@ -9375,13 +10827,13 @@ "decorators": [] }, { - "$id": "666", + "$id": "756", "kind": "method", "name": "contentType", "serializedName": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "190" + "$ref": "196" }, "location": "Header", "isApiVersion": false, @@ -9393,12 +10845,12 @@ "decorators": [] }, { - "$id": "667", + "$id": "757", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "192" + "$ref": "198" }, "location": "Header", "isApiVersion": false, @@ -9412,7 +10864,7 @@ ], "response": { "type": { - "$ref": "361" + "$ref": "436" } }, "isOverride": false, @@ -9423,12 +10875,12 @@ ], "parameters": [ { - "$id": "668", + "$id": "758", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "669", + "$id": "759", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -9451,18 +10903,155 @@ "2024-08-16-preview" ], "parent": { - "$ref": "370" + "$ref": "456" + }, + "isMultiServiceClient": false + }, + { + "$id": "760", + "kind": "client", + "name": "PlantOperations", + "namespace": "SampleTypeSpec", + "methods": [ + { + "$id": "761", + "kind": "basic", + "name": "getTree", + "accessibility": "public", + "apiVersions": [ + "2024-07-16-preview", + "2024-08-16-preview" + ], + "doc": "Get a tree as a plant", + "operation": { + "$id": "762", + "name": "getTree", + "resourceName": "PlantOperations", + "doc": "Get a tree as a plant", + "accessibility": "public", + "parameters": [ + { + "$id": "763", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "200" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.PlantOperations.getTree.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "440" + }, + "headers": [ + { + "name": "contentType", + "nameInResponse": "content-type", + "type": { + "$ref": "202" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/xml" + ] + } + ], + "httpMethod": "GET", + "uri": "{sampleTypeSpecUrl}", + "path": "/plants/tree/as-plant", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "SampleTypeSpec.PlantOperations.getTree", + "decorators": [], + "namespace": "SampleTypeSpec" + }, + "parameters": [ + { + "$id": "764", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "200" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "SampleTypeSpec.PlantOperations.getTree.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "440" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "SampleTypeSpec.PlantOperations.getTree" + } + ], + "parameters": [ + { + "$id": "765", + "kind": "endpoint", + "name": "sampleTypeSpecUrl", + "serializedName": "sampleTypeSpecUrl", + "type": { + "$id": "766", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "serverUrlTemplate": "{sampleTypeSpecUrl}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "SampleTypeSpec.PlantOperations.sampleTypeSpecUrl" + } + ], + "initializedBy": 0, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.PlantOperations", + "apiVersions": [ + "2024-07-16-preview", + "2024-08-16-preview" + ], + "parent": { + "$ref": "456" }, "isMultiServiceClient": false }, { - "$id": "670", + "$id": "767", "kind": "client", "name": "Metrics", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "671", + "$id": "768", "kind": "basic", "name": "getWidgetMetrics", "accessibility": "public", @@ -9472,14 +11061,14 @@ ], "doc": "Get Widget metrics for given day of week", "operation": { - "$id": "672", + "$id": "769", "name": "getWidgetMetrics", "resourceName": "Metrics", "doc": "Get Widget metrics for given day of week", "accessibility": "public", "parameters": [ { - "$id": "673", + "$id": "770", "kind": "path", "name": "day", "serializedName": "day", @@ -9498,12 +11087,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.Metrics.getWidgetMetrics.day" }, { - "$id": "674", + "$id": "771", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "194" + "$ref": "204" }, "isApiVersion": false, "optional": false, @@ -9520,7 +11109,7 @@ 200 ], "bodyType": { - "$ref": "365" + "$ref": "451" }, "headers": [], "isErrorResponse": false, @@ -9541,7 +11130,7 @@ }, "parameters": [ { - "$id": "675", + "$id": "772", "kind": "method", "name": "day", "serializedName": "day", @@ -9558,12 +11147,12 @@ "decorators": [] }, { - "$id": "676", + "$id": "773", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "194" + "$ref": "204" }, "location": "Header", "isApiVersion": false, @@ -9577,7 +11166,7 @@ ], "response": { "type": { - "$ref": "365" + "$ref": "451" } }, "isOverride": false, @@ -9588,12 +11177,12 @@ ], "parameters": [ { - "$id": "677", + "$id": "774", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "678", + "$id": "775", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -9616,7 +11205,7 @@ "2024-08-16-preview" ], "parent": { - "$ref": "370" + "$ref": "456" }, "isMultiServiceClient": false } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Models/BulletPointsModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Models/BulletPointsModel.Serialization.cs index 0648f46131f..4d2c4917332 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Models/BulletPointsModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Models/BulletPointsModel.Serialization.cs @@ -12,6 +12,8 @@ public partial class BulletPointsModel : IJsonModel { internal BulletPointsModel() => throw null; + protected virtual BulletPointsModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class BulletPointsModel : IJsonModel BulletPointsModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BulletPointsModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/CommaDelimitedArrayProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/CommaDelimitedArrayProperty.Serialization.cs index c0c7fbd4732..66023514a9a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/CommaDelimitedArrayProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/CommaDelimitedArrayProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class CommaDelimitedArrayProperty : IJsonModel throw null; + protected virtual CommaDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CommaDelimitedArrayProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class CommaDelimitedArrayProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CommaDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(CommaDelimitedArrayProperty commaDelimitedArrayProperty) => throw null; - - public static explicit operator CommaDelimitedArrayProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/NewlineDelimitedArrayProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/NewlineDelimitedArrayProperty.Serialization.cs index cd31ef81498..e29f9236268 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/NewlineDelimitedArrayProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/NewlineDelimitedArrayProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class NewlineDelimitedArrayProperty : IJsonModel throw null; + protected virtual NewlineDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator NewlineDelimitedArrayProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class NewlineDelimitedArrayProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual NewlineDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(NewlineDelimitedArrayProperty newlineDelimitedArrayProperty) => throw null; - - public static explicit operator NewlineDelimitedArrayProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/PipeDelimitedArrayProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/PipeDelimitedArrayProperty.Serialization.cs index 77fb59cc6da..a338684595a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/PipeDelimitedArrayProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/PipeDelimitedArrayProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class PipeDelimitedArrayProperty : IJsonModel throw null; + protected virtual PipeDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator PipeDelimitedArrayProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class PipeDelimitedArrayProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual PipeDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(PipeDelimitedArrayProperty pipeDelimitedArrayProperty) => throw null; - - public static explicit operator PipeDelimitedArrayProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/SpaceDelimitedArrayProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/SpaceDelimitedArrayProperty.Serialization.cs index d37d4f47a96..c47721b515b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/SpaceDelimitedArrayProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Models/SpaceDelimitedArrayProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpaceDelimitedArrayProperty : IJsonModel throw null; + protected virtual SpaceDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpaceDelimitedArrayProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpaceDelimitedArrayProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpaceDelimitedArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpaceDelimitedArrayProperty spaceDelimitedArrayProperty) => throw null; - - public static explicit operator SpaceDelimitedArrayProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64BytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64BytesProperty.Serialization.cs index 91223205d1c..352ac62ca6c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64BytesProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64BytesProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Base64BytesProperty : IJsonModel { internal Base64BytesProperty() => throw null; + protected virtual Base64BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Base64BytesProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Base64BytesProperty : IJsonModel Base64BytesProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Base64BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Base64BytesProperty base64BytesProperty) => throw null; - - public static explicit operator Base64BytesProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlArrayBytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlArrayBytesProperty.Serialization.cs index 1787e536dbf..e6f43e54ad3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlArrayBytesProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlArrayBytesProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Base64urlArrayBytesProperty : IJsonModel throw null; + protected virtual Base64urlArrayBytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Base64urlArrayBytesProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Base64urlArrayBytesProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Base64urlArrayBytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Base64urlArrayBytesProperty base64urlArrayBytesProperty) => throw null; - - public static explicit operator Base64urlArrayBytesProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlBytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlBytesProperty.Serialization.cs index 39544a8f73c..c95ab020b01 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlBytesProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/Base64urlBytesProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Base64urlBytesProperty : IJsonModel { internal Base64urlBytesProperty() => throw null; + protected virtual Base64urlBytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Base64urlBytesProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Base64urlBytesProperty : IJsonModel Base64urlBytesProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Base64urlBytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Base64urlBytesProperty base64urlBytesProperty) => throw null; - - public static explicit operator Base64urlBytesProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/DefaultBytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/DefaultBytesProperty.Serialization.cs index 692412e09fa..4dbccfef55d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/DefaultBytesProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Models/DefaultBytesProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DefaultBytesProperty : IJsonModel { internal DefaultBytesProperty() => throw null; + protected virtual DefaultBytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DefaultBytesProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DefaultBytesProperty : IJsonModel DefaultBytesProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DefaultBytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DefaultBytesProperty defaultBytesProperty) => throw null; - - public static explicit operator DefaultBytesProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/DefaultDatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/DefaultDatetimeProperty.Serialization.cs index 38fc4ed08d1..8ed360e5149 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/DefaultDatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/DefaultDatetimeProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DefaultDatetimeProperty : IJsonModel throw null; + protected virtual DefaultDatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DefaultDatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DefaultDatetimeProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DefaultDatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DefaultDatetimeProperty defaultDatetimeProperty) => throw null; - - public static explicit operator DefaultDatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc3339DatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc3339DatetimeProperty.Serialization.cs index e192c6fe9e2..b5cfdcbe405 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc3339DatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc3339DatetimeProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Rfc3339DatetimeProperty : IJsonModel throw null; + protected virtual Rfc3339DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Rfc3339DatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Rfc3339DatetimeProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Rfc3339DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Rfc3339DatetimeProperty rfc3339DatetimeProperty) => throw null; - - public static explicit operator Rfc3339DatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc7231DatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc7231DatetimeProperty.Serialization.cs index e7d1a8be715..137f76a8791 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc7231DatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/Rfc7231DatetimeProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Rfc7231DatetimeProperty : IJsonModel throw null; + protected virtual Rfc7231DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Rfc7231DatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Rfc7231DatetimeProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Rfc7231DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Rfc7231DatetimeProperty rfc7231DatetimeProperty) => throw null; - - public static explicit operator Rfc7231DatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampArrayDatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampArrayDatetimeProperty.Serialization.cs index c04c8a5d8bf..0b4ceb4594d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampArrayDatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampArrayDatetimeProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnixTimestampArrayDatetimeProperty : IJsonModel throw null; + protected virtual UnixTimestampArrayDatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnixTimestampArrayDatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnixTimestampArrayDatetimeProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnixTimestampArrayDatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnixTimestampArrayDatetimeProperty unixTimestampArrayDatetimeProperty) => throw null; - - public static explicit operator UnixTimestampArrayDatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampDatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampDatetimeProperty.Serialization.cs index 69bf04eac0e..1189581ef3b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampDatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Models/UnixTimestampDatetimeProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnixTimestampDatetimeProperty : IJsonModel throw null; + protected virtual UnixTimestampDatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnixTimestampDatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnixTimestampDatetimeProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnixTimestampDatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnixTimestampDatetimeProperty unixTimestampDatetimeProperty) => throw null; - - public static explicit operator UnixTimestampDatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/DefaultDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/DefaultDurationProperty.Serialization.cs index 2fa89291594..94f7df548ba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/DefaultDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/DefaultDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DefaultDurationProperty : IJsonModel throw null; + protected virtual DefaultDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DefaultDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DefaultDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DefaultDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DefaultDurationProperty defaultDurationProperty) => throw null; - - public static explicit operator DefaultDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.Serialization.cs index 176242ed975..f7a14810a62 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Float64MillisecondsDurationProperty : IJsonModel throw null; + protected virtual Float64MillisecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Float64MillisecondsDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Float64MillisecondsDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Float64MillisecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Float64MillisecondsDurationProperty float64MillisecondsDurationProperty) => throw null; - - public static explicit operator Float64MillisecondsDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64SecondsDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64SecondsDurationProperty.Serialization.cs index 19d5e04fa04..25e92a1732e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64SecondsDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Float64SecondsDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Float64SecondsDurationProperty : IJsonModel throw null; + protected virtual Float64SecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Float64SecondsDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Float64SecondsDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Float64SecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Float64SecondsDurationProperty float64SecondsDurationProperty) => throw null; - - public static explicit operator Float64SecondsDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.Serialization.cs index 4a654d731ee..5991498c680 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class FloatMillisecondsDurationArrayProperty : IJsonModel throw null; + protected virtual FloatMillisecondsDurationArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatMillisecondsDurationArrayProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class FloatMillisecondsDurationArrayProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatMillisecondsDurationArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatMillisecondsDurationArrayProperty floatMillisecondsDurationArrayProperty) => throw null; - - public static explicit operator FloatMillisecondsDurationArrayProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.Serialization.cs index 6272d9a5545..ea402aff2c2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class FloatMillisecondsDurationProperty : IJsonModel throw null; + protected virtual FloatMillisecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatMillisecondsDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class FloatMillisecondsDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatMillisecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatMillisecondsDurationProperty floatMillisecondsDurationProperty) => throw null; - - public static explicit operator FloatMillisecondsDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsLargerUnitDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsLargerUnitDurationProperty.Serialization.cs index 1e114e45b49..858d274e975 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsLargerUnitDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatMillisecondsLargerUnitDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class FloatMillisecondsLargerUnitDurationProperty : IJsonModel throw null; + protected virtual FloatMillisecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatMillisecondsLargerUnitDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class FloatMillisecondsLargerUnitDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatMillisecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatMillisecondsLargerUnitDurationProperty floatMillisecondsLargerUnitDurationProperty) => throw null; - - public static explicit operator FloatMillisecondsLargerUnitDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationArrayProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationArrayProperty.Serialization.cs index 41c55fb41c5..c9c5ccfcfbc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationArrayProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationArrayProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class FloatSecondsDurationArrayProperty : IJsonModel throw null; + protected virtual FloatSecondsDurationArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatSecondsDurationArrayProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class FloatSecondsDurationArrayProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatSecondsDurationArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatSecondsDurationArrayProperty floatSecondsDurationArrayProperty) => throw null; - - public static explicit operator FloatSecondsDurationArrayProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationProperty.Serialization.cs index 83556e042c6..fccdb2a56ff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class FloatSecondsDurationProperty : IJsonModel throw null; + protected virtual FloatSecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatSecondsDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class FloatSecondsDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatSecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatSecondsDurationProperty floatSecondsDurationProperty) => throw null; - - public static explicit operator FloatSecondsDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsLargerUnitDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsLargerUnitDurationProperty.Serialization.cs index bc5b740cd40..a3403690cb0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsLargerUnitDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/FloatSecondsLargerUnitDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class FloatSecondsLargerUnitDurationProperty : IJsonModel throw null; + protected virtual FloatSecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatSecondsLargerUnitDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class FloatSecondsLargerUnitDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatSecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatSecondsLargerUnitDurationProperty floatSecondsLargerUnitDurationProperty) => throw null; - - public static explicit operator FloatSecondsLargerUnitDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/ISO8601DurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/ISO8601DurationProperty.Serialization.cs index 71a515fe079..e0ef55ae858 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/ISO8601DurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/ISO8601DurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class ISO8601DurationProperty : IJsonModel throw null; + protected virtual ISO8601DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ISO8601DurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ISO8601DurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ISO8601DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ISO8601DurationProperty isO8601DurationProperty) => throw null; - - public static explicit operator ISO8601DurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.Serialization.cs index 565190c9f67..815b1bc7d48 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Int32MillisecondsDurationProperty : IJsonModel throw null; + protected virtual Int32MillisecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Int32MillisecondsDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Int32MillisecondsDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Int32MillisecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Int32MillisecondsDurationProperty int32MillisecondsDurationProperty) => throw null; - - public static explicit operator Int32MillisecondsDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsLargerUnitDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsLargerUnitDurationProperty.Serialization.cs index 883e10bde6e..8df268e8feb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsLargerUnitDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32MillisecondsLargerUnitDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Int32MillisecondsLargerUnitDurationProperty : IJsonModel throw null; + protected virtual Int32MillisecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Int32MillisecondsLargerUnitDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Int32MillisecondsLargerUnitDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Int32MillisecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Int32MillisecondsLargerUnitDurationProperty int32MillisecondsLargerUnitDurationProperty) => throw null; - - public static explicit operator Int32MillisecondsLargerUnitDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsDurationProperty.Serialization.cs index 2e7fbffe5cc..aa0e1e18a0f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Int32SecondsDurationProperty : IJsonModel throw null; + protected virtual Int32SecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Int32SecondsDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Int32SecondsDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Int32SecondsDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Int32SecondsDurationProperty int32SecondsDurationProperty) => throw null; - - public static explicit operator Int32SecondsDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsLargerUnitDurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsLargerUnitDurationProperty.Serialization.cs index d2ce36089c8..e581819221a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsLargerUnitDurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Models/Int32SecondsLargerUnitDurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Int32SecondsLargerUnitDurationProperty : IJsonModel throw null; + protected virtual Int32SecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Int32SecondsLargerUnitDurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Int32SecondsLargerUnitDurationProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Int32SecondsLargerUnitDurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Int32SecondsLargerUnitDurationProperty int32SecondsLargerUnitDurationProperty) => throw null; - - public static explicit operator Int32SecondsLargerUnitDurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/SafeintAsStringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/SafeintAsStringProperty.Serialization.cs index ee7e5a2837c..a00b01ed4ce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/SafeintAsStringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/SafeintAsStringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class SafeintAsStringProperty : IJsonModel throw null; + protected virtual SafeintAsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SafeintAsStringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SafeintAsStringProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SafeintAsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SafeintAsStringProperty safeintAsStringProperty) => throw null; - - public static explicit operator SafeintAsStringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint32AsStringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint32AsStringProperty.Serialization.cs index 1a5dccee8f2..f30e23cd22a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint32AsStringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint32AsStringProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace Encode.Numeric._Property { public partial class Uint32AsStringProperty : IJsonModel { + protected virtual Uint32AsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Uint32AsStringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class Uint32AsStringProperty : IJsonModel Uint32AsStringProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Uint32AsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Uint32AsStringProperty uint32AsStringProperty) => throw null; - - public static explicit operator Uint32AsStringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint8AsStringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint8AsStringProperty.Serialization.cs index c49f541a169..624ccdeb3f4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint8AsStringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint8AsStringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class Uint8AsStringProperty : IJsonModel { internal Uint8AsStringProperty() => throw null; + protected virtual Uint8AsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Uint8AsStringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Uint8AsStringProperty : IJsonModel Uint8AsStringProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Uint8AsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Uint8AsStringProperty uint8AsStringProperty) => throw null; - - public static explicit operator Uint8AsStringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/Models/User.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/Models/User.Serialization.cs index 4a4cdc3bac1..eb87be89cdc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/Models/User.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/Models/User.Serialization.cs @@ -13,6 +13,8 @@ public partial class User : IJsonModel { internal User() => throw null; + protected virtual User PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class User : IJsonModel User IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual User PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(User user) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs index 1deb6a7b587..949e2df723f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs @@ -13,6 +13,8 @@ public partial class BodyModel : IJsonModel { internal BodyModel() => throw null; + protected virtual BodyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class BodyModel : IJsonModel BodyModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BodyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(BodyModel bodyModel) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Models/BodyParameter.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Models/BodyParameter.Serialization.cs index ca7f6d81e03..76a425b6ed3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Models/BodyParameter.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Models/BodyParameter.Serialization.cs @@ -13,6 +13,8 @@ public partial class BodyParameter : IJsonModel { internal BodyParameter() => throw null; + protected virtual BodyParameter PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class BodyParameter : IJsonModel BodyParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BodyParameter PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(BodyParameter bodyParameter) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/Models/PngImageAsJson.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/Models/PngImageAsJson.Serialization.cs index f5484c1a88c..e6757040acd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/Models/PngImageAsJson.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/Models/PngImageAsJson.Serialization.cs @@ -13,6 +13,10 @@ public partial class PngImageAsJson : IJsonModel { internal PngImageAsJson() => throw null; + protected virtual PngImageAsJson PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator PngImageAsJson(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class PngImageAsJson : IJsonModel PngImageAsJson IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual PngImageAsJson PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator PngImageAsJson(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/InnerModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/InnerModel.Serialization.cs index 9a8d4578a0e..f8a5c184ad8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/InnerModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/InnerModel.Serialization.cs @@ -10,6 +10,8 @@ namespace Payload.JsonMergePatch { public partial class InnerModel : IJsonModel { + protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -24,8 +26,6 @@ public partial class InnerModel : IJsonModel InnerModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/Resource.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/Resource.Serialization.cs index d27998488f7..6519f84f62c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/Resource.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/Models/Resource.Serialization.cs @@ -13,6 +13,10 @@ public partial class Resource : IJsonModel { internal Resource() => throw null; + protected virtual Resource PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Resource(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Resource : IJsonModel Resource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Resource PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Resource resource) => throw null; - - public static explicit operator Resource(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/Models/Pet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/Models/Pet.Serialization.cs index 7f26f9a9876..d7a3010ecca 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/Models/Pet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/Models/Pet.Serialization.cs @@ -12,6 +12,8 @@ public partial class Pet : IJsonModel { internal Pet() => throw null; + protected virtual Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Pet : IJsonModel Pet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/ErrorInRange.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/ErrorInRange.Serialization.cs index fe4c49694dd..c117a1d9f76 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/ErrorInRange.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/ErrorInRange.Serialization.cs @@ -12,6 +12,8 @@ public partial class ErrorInRange : IJsonModel { internal ErrorInRange() => throw null; + protected virtual ErrorInRange PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class ErrorInRange : IJsonModel ErrorInRange IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ErrorInRange PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/NotFoundError.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/NotFoundError.Serialization.cs index 5b3f8a1e790..a13e6a7b888 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/NotFoundError.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/Models/NotFoundError.Serialization.cs @@ -12,6 +12,8 @@ public partial class NotFoundError : IJsonModel { internal NotFoundError() => throw null; + protected virtual NotFoundError PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class NotFoundError : IJsonModel NotFoundError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual NotFoundError PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Models/JsonEncodedNameModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Models/JsonEncodedNameModel.Serialization.cs index b6d7b8705c5..bc0e9161c2e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Models/JsonEncodedNameModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Models/JsonEncodedNameModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class JsonEncodedNameModel : IJsonModel { internal JsonEncodedNameModel() => throw null; + protected virtual JsonEncodedNameModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator JsonEncodedNameModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class JsonEncodedNameModel : IJsonModel JsonEncodedNameModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual JsonEncodedNameModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(JsonEncodedNameModel jsonEncodedNameModel) => throw null; - - public static explicit operator JsonEncodedNameModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/And.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/And.Serialization.cs index 741c5848e44..085f9010f02 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/And.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/And.Serialization.cs @@ -13,6 +13,8 @@ public partial class And : IJsonModel { internal And() => throw null; + protected virtual And PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class And : IJsonModel And IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual And PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(And @and) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/As.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/As.Serialization.cs index 5ce79b3d4bc..2fca907e2f7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/As.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/As.Serialization.cs @@ -13,6 +13,8 @@ public partial class As : IJsonModel { internal As() => throw null; + protected virtual As PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class As : IJsonModel As IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual As PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(As @as) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Assert.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Assert.Serialization.cs index c0af74f30f4..b16b5c078b0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Assert.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Assert.Serialization.cs @@ -13,6 +13,8 @@ public partial class Assert : IJsonModel { internal Assert() => throw null; + protected virtual Assert PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Assert : IJsonModel Assert IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Assert PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Assert assert) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Async.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Async.Serialization.cs index 884fc81c002..f33470b9d66 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Async.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Async.Serialization.cs @@ -13,6 +13,8 @@ public partial class Async : IJsonModel { internal Async() => throw null; + protected virtual Async PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Async : IJsonModel Async IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Async PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Async @async) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Await.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Await.Serialization.cs index fbdf54adc95..03299fcddad 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Await.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Await.Serialization.cs @@ -13,6 +13,8 @@ public partial class Await : IJsonModel { internal Await() => throw null; + protected virtual Await PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Await : IJsonModel Await IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Await PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Await @await) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Break.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Break.Serialization.cs index 4db3379c011..eb496dee39a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Break.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Break.Serialization.cs @@ -13,6 +13,8 @@ public partial class Break : IJsonModel { internal Break() => throw null; + protected virtual Break PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Break : IJsonModel Break IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Break PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Break @break) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Class.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Class.Serialization.cs index f535a3bf85c..cec236b7ff7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Class.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Class.Serialization.cs @@ -13,6 +13,8 @@ public partial class Class : IJsonModel { internal Class() => throw null; + protected virtual Class PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Class : IJsonModel Class IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Class PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Class @class) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Constructor.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Constructor.Serialization.cs index 3be1d4e130f..8d08aaef8ea 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Constructor.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Constructor.Serialization.cs @@ -13,6 +13,8 @@ public partial class Constructor : IJsonModel { internal Constructor() => throw null; + protected virtual Constructor PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Constructor : IJsonModel Constructor IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Constructor PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Constructor constructor) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Continue.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Continue.Serialization.cs index f0907af0548..885f50df6bf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Continue.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Continue.Serialization.cs @@ -13,6 +13,8 @@ public partial class Continue : IJsonModel { internal Continue() => throw null; + protected virtual Continue PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Continue : IJsonModel Continue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Continue PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Continue @continue) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Def.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Def.Serialization.cs index 8feca0df8ef..0c527922350 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Def.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Def.Serialization.cs @@ -13,6 +13,8 @@ public partial class Def : IJsonModel { internal Def() => throw null; + protected virtual Def PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Def : IJsonModel Def IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Def PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Def def) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Del.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Del.Serialization.cs index 05ac79eda47..99072e018e7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Del.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Del.Serialization.cs @@ -13,6 +13,8 @@ public partial class Del : IJsonModel { internal Del() => throw null; + protected virtual Del PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Del : IJsonModel Del IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Del PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Del del) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/DictMethods.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/DictMethods.Serialization.cs index f445a94dfb9..1d081b74925 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/DictMethods.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/DictMethods.Serialization.cs @@ -13,6 +13,8 @@ public partial class DictMethods : IJsonModel { internal DictMethods() => throw null; + protected virtual DictMethods PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class DictMethods : IJsonModel DictMethods IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DictMethods PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DictMethods dictMethods) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Elif.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Elif.Serialization.cs index 40637b6c94f..025ca5c97d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Elif.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Elif.Serialization.cs @@ -13,6 +13,8 @@ public partial class Elif : IJsonModel { internal Elif() => throw null; + protected virtual Elif PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Elif : IJsonModel Elif IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Elif PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Elif elif) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Else.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Else.Serialization.cs index 2e621f4975d..7248101db61 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Else.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Else.Serialization.cs @@ -13,6 +13,8 @@ public partial class Else : IJsonModel { internal Else() => throw null; + protected virtual Else PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Else : IJsonModel Else IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Else PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Else @else) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Except.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Except.Serialization.cs index 3ab2a790c2d..379eadd36a0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Except.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Except.Serialization.cs @@ -13,6 +13,8 @@ public partial class Except : IJsonModel { internal Except() => throw null; + protected virtual Except PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Except : IJsonModel Except IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Except PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Except except) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Exec.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Exec.Serialization.cs index 1f252a9d1f7..0983ff2c3cb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Exec.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Exec.Serialization.cs @@ -13,6 +13,8 @@ public partial class Exec : IJsonModel { internal Exec() => throw null; + protected virtual Exec PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Exec : IJsonModel Exec IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Exec PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Exec exec) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Finally.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Finally.Serialization.cs index a7fd189d52c..c6839cf20fe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Finally.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Finally.Serialization.cs @@ -13,6 +13,8 @@ public partial class Finally : IJsonModel { internal Finally() => throw null; + protected virtual Finally PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Finally : IJsonModel Finally IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Finally PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Finally @finally) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/For.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/For.Serialization.cs index e1f658aac40..b4d7b09ba89 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/For.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/For.Serialization.cs @@ -13,6 +13,8 @@ public partial class For : IJsonModel { internal For() => throw null; + protected virtual For PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class For : IJsonModel For IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual For PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(For @for) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/From.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/From.Serialization.cs index 359c3927d70..66d3c5a4636 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/From.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/From.Serialization.cs @@ -13,6 +13,8 @@ public partial class From : IJsonModel { internal From() => throw null; + protected virtual From PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class From : IJsonModel From IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual From PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(From @from) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Global.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Global.Serialization.cs index c4b82c5aede..7a865c17366 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Global.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Global.Serialization.cs @@ -13,6 +13,8 @@ public partial class Global : IJsonModel { internal Global() => throw null; + protected virtual Global PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Global : IJsonModel Global IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Global PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Global @global) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/If.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/If.Serialization.cs index efa84058b15..4616d91cea5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/If.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/If.Serialization.cs @@ -13,6 +13,8 @@ public partial class If : IJsonModel { internal If() => throw null; + protected virtual If PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class If : IJsonModel If IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual If PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(If @if) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Import.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Import.Serialization.cs index fd7f89d4e4c..f593228d43f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Import.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Import.Serialization.cs @@ -13,6 +13,8 @@ public partial class Import : IJsonModel { internal Import() => throw null; + protected virtual Import PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Import : IJsonModel Import IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Import PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Import import) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/In.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/In.Serialization.cs index 69fee54fbc2..20f42e2fbe7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/In.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/In.Serialization.cs @@ -13,6 +13,8 @@ public partial class In : IJsonModel { internal In() => throw null; + protected virtual In PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class In : IJsonModel In IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual In PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(In @in) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Is.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Is.Serialization.cs index 4cf792af6b3..caaf351451c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Is.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Is.Serialization.cs @@ -13,6 +13,8 @@ public partial class Is : IJsonModel { internal Is() => throw null; + protected virtual Is PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Is : IJsonModel Is IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Is PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Is @is) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Lambda.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Lambda.Serialization.cs index 981100fa908..cd7324d2c0e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Lambda.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Lambda.Serialization.cs @@ -13,6 +13,8 @@ public partial class Lambda : IJsonModel { internal Lambda() => throw null; + protected virtual Lambda PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Lambda : IJsonModel Lambda IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Lambda PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Lambda lambda) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Not.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Not.Serialization.cs index 4481d173ce5..b66eb359249 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Not.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Not.Serialization.cs @@ -13,6 +13,8 @@ public partial class Not : IJsonModel { internal Not() => throw null; + protected virtual Not PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Not : IJsonModel Not IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Not PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Not @not) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Or.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Or.Serialization.cs index c03ff0a6527..0df2daec7fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Or.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Or.Serialization.cs @@ -13,6 +13,8 @@ public partial class Or : IJsonModel { internal Or() => throw null; + protected virtual Or PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Or : IJsonModel Or IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Or PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Or @or) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Pass.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Pass.Serialization.cs index e95aada1289..70cd0da32a3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Pass.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Pass.Serialization.cs @@ -13,6 +13,8 @@ public partial class Pass : IJsonModel { internal Pass() => throw null; + protected virtual Pass PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Pass : IJsonModel Pass IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Pass PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Pass pass) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Raise.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Raise.Serialization.cs index 7553ae84aaf..22bbf3905cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Raise.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Raise.Serialization.cs @@ -13,6 +13,8 @@ public partial class Raise : IJsonModel { internal Raise() => throw null; + protected virtual Raise PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Raise : IJsonModel Raise IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Raise PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Raise raise) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Return.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Return.Serialization.cs index 79db2322860..e6d1f67d353 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Return.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Return.Serialization.cs @@ -13,6 +13,8 @@ public partial class Return : IJsonModel { internal Return() => throw null; + protected virtual Return PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Return : IJsonModel Return IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Return PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Return @return) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/SameAsModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/SameAsModel.Serialization.cs index 3c217e03e2a..b7465a28c39 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/SameAsModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/SameAsModel.Serialization.cs @@ -13,6 +13,8 @@ public partial class SameAsModel : IJsonModel { internal SameAsModel() => throw null; + protected virtual SameAsModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class SameAsModel : IJsonModel SameAsModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SameAsModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SameAsModel sameAsModel) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Try.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Try.Serialization.cs index b71c136483d..805aec941e2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Try.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Try.Serialization.cs @@ -13,6 +13,8 @@ public partial class Try : IJsonModel { internal Try() => throw null; + protected virtual Try PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Try : IJsonModel Try IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Try PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Try @try) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/While.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/While.Serialization.cs index 2251f7817ef..5372239d5d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/While.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/While.Serialization.cs @@ -13,6 +13,8 @@ public partial class While : IJsonModel { internal While() => throw null; + protected virtual While PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class While : IJsonModel While IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual While PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(While @while) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/With.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/With.Serialization.cs index a47c801e5b3..966a7b080fe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/With.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/With.Serialization.cs @@ -13,6 +13,8 @@ public partial class With : IJsonModel { internal With() => throw null; + protected virtual With PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class With : IJsonModel With IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual With PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(With @with) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Yield.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Yield.Serialization.cs index ab9d32f240d..d5066942b77 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Yield.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models/Yield.Serialization.cs @@ -13,6 +13,8 @@ public partial class Yield : IJsonModel { internal Yield() => throw null; + protected virtual Yield PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class Yield : IJsonModel Yield IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Yield PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Yield @yield) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Models/InnerModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Models/InnerModel.Serialization.cs index 98c068f1ebc..a6bd9f8cd49 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Models/InnerModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Models/InnerModel.Serialization.cs @@ -12,6 +12,8 @@ public partial class InnerModel : IJsonModel { internal InnerModel() => throw null; + protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class InnerModel : IJsonModel InnerModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs index 29ebdeedd57..72c5f67ff8a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Models/InnerModel.Serialization.cs @@ -12,6 +12,8 @@ public partial class InnerModel : IJsonModel { internal InnerModel() => throw null; + protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class InnerModel : IJsonModel InnerModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInput.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInput.Serialization.cs index d707c02e6fa..8d9d30df028 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInput.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInput.Serialization.cs @@ -11,6 +11,8 @@ namespace _Type.Model.Empty { public partial class EmptyInput : IJsonModel { + protected virtual EmptyInput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,8 +27,6 @@ public partial class EmptyInput : IJsonModel EmptyInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual EmptyInput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(EmptyInput emptyInput) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInputOutput.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInputOutput.Serialization.cs index c42f9caf13c..4a81f4a2fcb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInputOutput.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyInputOutput.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Model.Empty { public partial class EmptyInputOutput : IJsonModel { + protected virtual EmptyInputOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator EmptyInputOutput(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class EmptyInputOutput : IJsonModel EmptyInputOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual EmptyInputOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(EmptyInputOutput emptyInputOutput) => throw null; - - public static explicit operator EmptyInputOutput(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyOutput.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyOutput.Serialization.cs index b5d563f24ab..d8a36b8f94d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyOutput.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/Models/EmptyOutput.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Model.Empty { public partial class EmptyOutput : IJsonModel { + protected virtual EmptyOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator EmptyOutput(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,10 +29,6 @@ public partial class EmptyOutput : IJsonModel EmptyOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual EmptyOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator EmptyOutput(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Cobra.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Cobra.Serialization.cs index 72cdf200a6c..9915bb2636f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Cobra.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Cobra.Serialization.cs @@ -12,6 +12,8 @@ public partial class Cobra : Snake, IJsonModel { internal Cobra() => throw null; + protected override Snake PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Cobra : Snake, IJsonModel Cobra IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Snake PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Dog.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Dog.Serialization.cs index f56d5d5949f..4f6e0edd53a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Dog.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Dog.Serialization.cs @@ -14,6 +14,10 @@ public abstract partial class Dog : IJsonModel { internal Dog() => throw null; + protected virtual Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Dog(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -28,12 +32,8 @@ public abstract partial class Dog : IJsonModel Dog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Dog dog) => throw null; - - public static explicit operator Dog(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Golden.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Golden.Serialization.cs index 408bb5e23ec..b3fbb76b117 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Golden.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Golden.Serialization.cs @@ -12,6 +12,8 @@ public partial class Golden : Dog, IJsonModel { internal Golden() => throw null; + protected override Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Golden : Dog, IJsonModel Golden IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Snake.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Snake.Serialization.cs index b94feb2a34e..27fbcbef098 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Snake.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/Snake.Serialization.cs @@ -14,6 +14,10 @@ public abstract partial class Snake : IJsonModel { internal Snake() => throw null; + protected virtual Snake PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Snake(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -28,12 +32,8 @@ public abstract partial class Snake : IJsonModel Snake IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Snake PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Snake snake) => throw null; - - public static explicit operator Snake(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownDog.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownDog.Serialization.cs index 6317cc18417..b29a2553aa2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownDog.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownDog.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownDog : Dog, IJsonModel { internal UnknownDog() => throw null; + protected override Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownDog : Dog, IJsonModel Dog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownSnake.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownSnake.Serialization.cs index 147154bfc5a..1c4c26ae4d7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownSnake.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/Models/UnknownSnake.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownSnake : Snake, IJsonModel { internal UnknownSnake() => throw null; + protected override Snake PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownSnake : Snake, IJsonModel Snake IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Snake PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Fish.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Fish.Serialization.cs index 815c2485173..3c525ba2367 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Fish.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Fish.Serialization.cs @@ -14,6 +14,10 @@ public abstract partial class Fish : IJsonModel { internal Fish() => throw null; + protected virtual Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Fish(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -28,12 +32,8 @@ public abstract partial class Fish : IJsonModel Fish IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Fish fish) => throw null; - - public static explicit operator Fish(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/GoblinShark.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/GoblinShark.Serialization.cs index 5e5e28ed5b7..a93291a2200 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/GoblinShark.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/GoblinShark.Serialization.cs @@ -12,6 +12,8 @@ public partial class GoblinShark : Shark, IJsonModel { internal GoblinShark() => throw null; + protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class GoblinShark : Shark, IJsonModel GoblinShark IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Salmon.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Salmon.Serialization.cs index 3187f9521d6..55185aad9cf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Salmon.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Salmon.Serialization.cs @@ -12,6 +12,8 @@ public partial class Salmon : Fish, IJsonModel { internal Salmon() => throw null; + protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Salmon : Fish, IJsonModel Salmon IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/SawShark.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/SawShark.Serialization.cs index 4ea7c0a2a22..be887ccbb0c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/SawShark.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/SawShark.Serialization.cs @@ -12,6 +12,8 @@ public partial class SawShark : Shark, IJsonModel { internal SawShark() => throw null; + protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class SawShark : Shark, IJsonModel SawShark IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Shark.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Shark.Serialization.cs index a5c15c1f547..fd892847187 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Shark.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/Shark.Serialization.cs @@ -12,6 +12,8 @@ public partial class Shark : Fish, IJsonModel { internal Shark() => throw null; + protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Shark : Fish, IJsonModel Shark IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownFish.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownFish.Serialization.cs index bbe6b10278b..1b5be551ee9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownFish.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownFish.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownFish : Fish, IJsonModel { internal UnknownFish() => throw null; + protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownFish : Fish, IJsonModel Fish IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownShark.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownShark.Serialization.cs index 1ea2523d905..025fb05f6a6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownShark.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/Models/UnknownShark.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownShark : Shark, IJsonModel { internal UnknownShark() => throw null; + protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownShark : Shark, IJsonModel Shark IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Fish PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Cat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Cat.Serialization.cs index 0131663d009..8758d767d4e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Cat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Cat.Serialization.cs @@ -12,6 +12,8 @@ public partial class Cat : Pet, IJsonModel { internal Cat() => throw null; + protected override Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Cat : Pet, IJsonModel Cat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Pet.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Pet.Serialization.cs index 2b3fd8a3d40..3c1b95a9f2c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Pet.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Pet.Serialization.cs @@ -12,6 +12,8 @@ public partial class Pet : IJsonModel { internal Pet() => throw null; + protected virtual Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Pet : IJsonModel Pet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Siamese.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Siamese.Serialization.cs index 5171f3e688c..6dcdc591ecb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Siamese.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/Models/Siamese.Serialization.cs @@ -13,6 +13,10 @@ public partial class Siamese : Cat, IJsonModel { internal Siamese() => throw null; + protected override Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Siamese(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Siamese : Cat, IJsonModel Siamese IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Pet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Siamese siamese) => throw null; - - public static explicit operator Siamese(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Element.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Element.Serialization.cs index 8b2489ead1f..624e5dab64a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Element.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Element.Serialization.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Inheritance.Recursive { public partial class Element : IJsonModel { + protected virtual Element PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -24,8 +26,6 @@ public partial class Element : IJsonModel Element IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Element PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Extension.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Extension.Serialization.cs index 73a0668535d..904c8cc5bc1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Extension.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/Models/Extension.Serialization.cs @@ -13,6 +13,10 @@ public partial class Extension : Element, IJsonModel { internal Extension() => throw null; + protected override Element PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Extension(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Extension : Element, IJsonModel Extension IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Element PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Extension extension) => throw null; - - public static explicit operator Extension(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Bird.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Bird.Serialization.cs index 46c4f020cb3..3d514d91970 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Bird.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Bird.Serialization.cs @@ -14,6 +14,10 @@ public abstract partial class Bird : IJsonModel { internal Bird() => throw null; + protected virtual Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Bird(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -28,12 +32,8 @@ public abstract partial class Bird : IJsonModel Bird IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Bird bird) => throw null; - - public static explicit operator Bird(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Dinosaur.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Dinosaur.Serialization.cs index 8b16e7d19e6..28c88559542 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Dinosaur.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Dinosaur.Serialization.cs @@ -14,6 +14,10 @@ public abstract partial class Dinosaur : IJsonModel { internal Dinosaur() => throw null; + protected virtual Dinosaur PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Dinosaur(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -28,10 +32,6 @@ public abstract partial class Dinosaur : IJsonModel Dinosaur IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Dinosaur PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator Dinosaur(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Eagle.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Eagle.Serialization.cs index f219ec4189c..3b4ca29e543 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Eagle.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Eagle.Serialization.cs @@ -12,6 +12,8 @@ public partial class Eagle : Bird, IJsonModel { internal Eagle() => throw null; + protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Eagle : Bird, IJsonModel Eagle IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Goose.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Goose.Serialization.cs index c97b3fde61a..281fd09adb0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Goose.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Goose.Serialization.cs @@ -12,6 +12,8 @@ public partial class Goose : Bird, IJsonModel { internal Goose() => throw null; + protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Goose : Bird, IJsonModel Goose IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/SeaGull.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/SeaGull.Serialization.cs index eee0eb736d5..ad075e6cb9f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/SeaGull.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/SeaGull.Serialization.cs @@ -12,6 +12,8 @@ public partial class SeaGull : Bird, IJsonModel { internal SeaGull() => throw null; + protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class SeaGull : Bird, IJsonModel SeaGull IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Sparrow.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Sparrow.Serialization.cs index bfaa7af613d..3508c3d82af 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Sparrow.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/Sparrow.Serialization.cs @@ -12,6 +12,8 @@ public partial class Sparrow : Bird, IJsonModel { internal Sparrow() => throw null; + protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Sparrow : Bird, IJsonModel Sparrow IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/TRex.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/TRex.Serialization.cs index b366efaa923..7ed15cdbc0b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/TRex.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/TRex.Serialization.cs @@ -12,6 +12,8 @@ public partial class TRex : Dinosaur, IJsonModel { internal TRex() => throw null; + protected override Dinosaur PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class TRex : Dinosaur, IJsonModel TRex IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Dinosaur PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownBird.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownBird.Serialization.cs index 6a604894ed0..27e8b40ce78 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownBird.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownBird.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownBird : Bird, IJsonModel { internal UnknownBird() => throw null; + protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownBird : Bird, IJsonModel Bird IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Bird PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownDinosaur.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownDinosaur.Serialization.cs index bff5bbdca5d..a2b80bb573b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownDinosaur.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/Models/UnknownDinosaur.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownDinosaur : Dinosaur, IJsonModel { internal UnknownDinosaur() => throw null; + protected override Dinosaur PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownDinosaur : Dinosaur, IJsonModel Dinosaur IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override Dinosaur PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs index a766864620e..871ef1f306f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class InputOutputRecord : IJsonModel { internal InputOutputRecord() => throw null; + protected virtual InputOutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator InputOutputRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class InputOutputRecord : IJsonModel InputOutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual InputOutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(InputOutputRecord inputOutputRecord) => throw null; - - public static explicit operator InputOutputRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs index 4e9c680b601..87cf8afa56f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs @@ -13,6 +13,8 @@ public partial class InputRecord : IJsonModel { internal InputRecord() => throw null; + protected virtual InputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,8 +29,6 @@ public partial class InputRecord : IJsonModel InputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual InputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(InputRecord inputRecord) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs index e3baec6e180..b44f0b23cef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class OutputRecord : IJsonModel { internal OutputRecord() => throw null; + protected virtual OutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator OutputRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class OutputRecord : IJsonModel OutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual OutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator OutputRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/ReadOnlyModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/ReadOnlyModel.Serialization.cs index 1abf3f920fb..b5f8766e5e0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/ReadOnlyModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/ReadOnlyModel.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Model.Visibility { public partial class ReadOnlyModel : IJsonModel { + protected virtual ReadOnlyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ReadOnlyModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class ReadOnlyModel : IJsonModel ReadOnlyModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ReadOnlyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ReadOnlyModel readOnlyModel) => throw null; - - public static explicit operator ReadOnlyModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/VisibilityModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/VisibilityModel.Serialization.cs index 54cac8d0aed..c977be6c091 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/VisibilityModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/Models/VisibilityModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class VisibilityModel : IJsonModel { internal VisibilityModel() => throw null; + protected virtual VisibilityModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator VisibilityModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class VisibilityModel : IJsonModel VisibilityModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual VisibilityModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(VisibilityModel visibilityModel) => throw null; - - public static explicit operator VisibilityModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatDerived.Serialization.cs index eaef1b45572..531a14ec7ce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatDerived.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadFloatDerived : DifferentSpreadFloatRecord, I { internal DifferentSpreadFloatDerived() => throw null; + protected override DifferentSpreadFloatRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadFloatDerived(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadFloatDerived : DifferentSpreadFloatRecord, I DifferentSpreadFloatDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override DifferentSpreadFloatRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadFloatDerived differentSpreadFloatDerived) => throw null; - - public static explicit operator DifferentSpreadFloatDerived(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatRecord.Serialization.cs index eaf93aaba7a..59a967bbcdc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadFloatRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadFloatRecord : IJsonModel throw null; + protected virtual DifferentSpreadFloatRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadFloatRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadFloatRecord : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DifferentSpreadFloatRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadFloatRecord differentSpreadFloatRecord) => throw null; - - public static explicit operator DifferentSpreadFloatRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayDerived.Serialization.cs index 0b86fcaea14..63950453769 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayDerived.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadModelArrayDerived : DifferentSpreadModelArra { internal DifferentSpreadModelArrayDerived() => throw null; + protected override DifferentSpreadModelArrayRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadModelArrayDerived(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadModelArrayDerived : DifferentSpreadModelArra DifferentSpreadModelArrayDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override DifferentSpreadModelArrayRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadModelArrayDerived differentSpreadModelArrayDerived) => throw null; - - public static explicit operator DifferentSpreadModelArrayDerived(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayRecord.Serialization.cs index 91174ac15ea..f9c5704f8e4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelArrayRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadModelArrayRecord : IJsonModel throw null; + protected virtual DifferentSpreadModelArrayRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadModelArrayRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadModelArrayRecord : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DifferentSpreadModelArrayRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadModelArrayRecord differentSpreadModelArrayRecord) => throw null; - - public static explicit operator DifferentSpreadModelArrayRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelDerived.Serialization.cs index 280d9aba49f..2985a3b4a04 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelDerived.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadModelDerived : DifferentSpreadModelRecord, I { internal DifferentSpreadModelDerived() => throw null; + protected override DifferentSpreadModelRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadModelDerived(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadModelDerived : DifferentSpreadModelRecord, I DifferentSpreadModelDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override DifferentSpreadModelRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadModelDerived differentSpreadModelDerived) => throw null; - - public static explicit operator DifferentSpreadModelDerived(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelRecord.Serialization.cs index 391e66a36d4..ac8fc6b240d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadModelRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadModelRecord : IJsonModel throw null; + protected virtual DifferentSpreadModelRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadModelRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadModelRecord : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DifferentSpreadModelRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadModelRecord differentSpreadModelRecord) => throw null; - - public static explicit operator DifferentSpreadModelRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringDerived.Serialization.cs index 0c2c993a5c8..0a0aea91e1e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringDerived.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadStringDerived : DifferentSpreadStringRecord, { internal DifferentSpreadStringDerived() => throw null; + protected override DifferentSpreadStringRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadStringDerived(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadStringDerived : DifferentSpreadStringRecord, DifferentSpreadStringDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override DifferentSpreadStringRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadStringDerived differentSpreadStringDerived) => throw null; - - public static explicit operator DifferentSpreadStringDerived(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringRecord.Serialization.cs index d0ac52ded6a..92105c31b7c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/DifferentSpreadStringRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class DifferentSpreadStringRecord : IJsonModel throw null; + protected virtual DifferentSpreadStringRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DifferentSpreadStringRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DifferentSpreadStringRecord : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DifferentSpreadStringRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DifferentSpreadStringRecord differentSpreadStringRecord) => throw null; - - public static explicit operator DifferentSpreadStringRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsFloatAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsFloatAdditionalProperties.Serialization.cs index 4614973d480..56183ac702c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsFloatAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsFloatAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class ExtendsFloatAdditionalProperties : IJsonModel throw null; + protected virtual ExtendsFloatAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtendsFloatAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ExtendsFloatAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ExtendsFloatAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtendsFloatAdditionalProperties extendsFloatAdditionalProperties) => throw null; - - public static explicit operator ExtendsFloatAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelAdditionalProperties.Serialization.cs index 36a69105e96..c5bbce59c5c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class ExtendsModelAdditionalProperties : IJsonModel throw null; + protected virtual ExtendsModelAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtendsModelAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ExtendsModelAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ExtendsModelAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtendsModelAdditionalProperties extendsModelAdditionalProperties) => throw null; - - public static explicit operator ExtendsModelAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelArrayAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelArrayAdditionalProperties.Serialization.cs index 9070a0fd91d..a3ba2b4b68e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelArrayAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsModelArrayAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class ExtendsModelArrayAdditionalProperties : IJsonModel throw null; + protected virtual ExtendsModelArrayAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtendsModelArrayAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ExtendsModelArrayAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ExtendsModelArrayAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtendsModelArrayAdditionalProperties extendsModelArrayAdditionalProperties) => throw null; - - public static explicit operator ExtendsModelArrayAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsStringAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsStringAdditionalProperties.Serialization.cs index 7f0ec403a5a..8bef25064dd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsStringAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsStringAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class ExtendsStringAdditionalProperties : IJsonModel throw null; + protected virtual ExtendsStringAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtendsStringAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ExtendsStringAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ExtendsStringAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtendsStringAdditionalProperties extendsStringAdditionalProperties) => throw null; - - public static explicit operator ExtendsStringAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalProperties.Serialization.cs index 1a148d686b5..27b43844b45 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class ExtendsUnknownAdditionalProperties : IJsonModel throw null; + protected virtual ExtendsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtendsUnknownAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ExtendsUnknownAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ExtendsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtendsUnknownAdditionalProperties extendsUnknownAdditionalProperties) => throw null; - - public static explicit operator ExtendsUnknownAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDerived.Serialization.cs index 6e2c9167757..272006d70f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDerived.Serialization.cs @@ -13,6 +13,10 @@ public partial class ExtendsUnknownAdditionalPropertiesDerived : ExtendsUnknownA { internal ExtendsUnknownAdditionalPropertiesDerived() => throw null; + protected override ExtendsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtendsUnknownAdditionalPropertiesDerived(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ExtendsUnknownAdditionalPropertiesDerived : ExtendsUnknownA ExtendsUnknownAdditionalPropertiesDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override ExtendsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtendsUnknownAdditionalPropertiesDerived extendsUnknownAdditionalPropertiesDerived) => throw null; - - public static explicit operator ExtendsUnknownAdditionalPropertiesDerived(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs index f7e9f72a561..42b4483eba4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs @@ -14,6 +14,10 @@ public abstract partial class ExtendsUnknownAdditionalPropertiesDiscriminated : { internal ExtendsUnknownAdditionalPropertiesDiscriminated() => throw null; + protected virtual ExtendsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtendsUnknownAdditionalPropertiesDiscriminated(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -28,12 +32,8 @@ public abstract partial class ExtendsUnknownAdditionalPropertiesDiscriminated : ExtendsUnknownAdditionalPropertiesDiscriminated IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ExtendsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtendsUnknownAdditionalPropertiesDiscriminated extendsUnknownAdditionalPropertiesDiscriminated) => throw null; - - public static explicit operator ExtendsUnknownAdditionalPropertiesDiscriminated(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs index 1f1701606d7..79d38fefea1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs @@ -12,6 +12,8 @@ public partial class ExtendsUnknownAdditionalPropertiesDiscriminatedDerived : Ex { internal ExtendsUnknownAdditionalPropertiesDiscriminatedDerived() => throw null; + protected override ExtendsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class ExtendsUnknownAdditionalPropertiesDiscriminatedDerived : Ex ExtendsUnknownAdditionalPropertiesDiscriminatedDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override ExtendsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsFloatAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsFloatAdditionalProperties.Serialization.cs index decb02492c4..8e5c4c7df18 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsFloatAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsFloatAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class IsFloatAdditionalProperties : IJsonModel throw null; + protected virtual IsFloatAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IsFloatAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class IsFloatAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IsFloatAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IsFloatAdditionalProperties isFloatAdditionalProperties) => throw null; - - public static explicit operator IsFloatAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelAdditionalProperties.Serialization.cs index 98a7f03e5fb..e162bf8b350 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class IsModelAdditionalProperties : IJsonModel throw null; + protected virtual IsModelAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IsModelAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class IsModelAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IsModelAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IsModelAdditionalProperties isModelAdditionalProperties) => throw null; - - public static explicit operator IsModelAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelArrayAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelArrayAdditionalProperties.Serialization.cs index dc3813f7179..62397a59a0b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelArrayAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsModelArrayAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class IsModelArrayAdditionalProperties : IJsonModel throw null; + protected virtual IsModelArrayAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IsModelArrayAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class IsModelArrayAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IsModelArrayAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IsModelArrayAdditionalProperties isModelArrayAdditionalProperties) => throw null; - - public static explicit operator IsModelArrayAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsStringAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsStringAdditionalProperties.Serialization.cs index 25edcd1fdcb..a6eeacd7d23 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsStringAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsStringAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class IsStringAdditionalProperties : IJsonModel throw null; + protected virtual IsStringAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IsStringAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class IsStringAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IsStringAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IsStringAdditionalProperties isStringAdditionalProperties) => throw null; - - public static explicit operator IsStringAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalProperties.Serialization.cs index 5ecce4649dc..627bf21a0cd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalProperties.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalProperties.Serialization.cs @@ -13,6 +13,10 @@ public partial class IsUnknownAdditionalProperties : IJsonModel throw null; + protected virtual IsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IsUnknownAdditionalProperties(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class IsUnknownAdditionalProperties : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IsUnknownAdditionalProperties isUnknownAdditionalProperties) => throw null; - - public static explicit operator IsUnknownAdditionalProperties(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDerived.Serialization.cs index 1d7eba1e220..dc2ac72d236 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDerived.Serialization.cs @@ -13,6 +13,10 @@ public partial class IsUnknownAdditionalPropertiesDerived : IsUnknownAdditionalP { internal IsUnknownAdditionalPropertiesDerived() => throw null; + protected override IsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IsUnknownAdditionalPropertiesDerived(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class IsUnknownAdditionalPropertiesDerived : IsUnknownAdditionalP IsUnknownAdditionalPropertiesDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override IsUnknownAdditionalProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IsUnknownAdditionalPropertiesDerived isUnknownAdditionalPropertiesDerived) => throw null; - - public static explicit operator IsUnknownAdditionalPropertiesDerived(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminated.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminated.Serialization.cs index 3a7409587b3..532577fcb3a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminated.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminated.Serialization.cs @@ -14,6 +14,10 @@ public abstract partial class IsUnknownAdditionalPropertiesDiscriminated : IJson { internal IsUnknownAdditionalPropertiesDiscriminated() => throw null; + protected virtual IsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IsUnknownAdditionalPropertiesDiscriminated(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -28,12 +32,8 @@ public abstract partial class IsUnknownAdditionalPropertiesDiscriminated : IJson IsUnknownAdditionalPropertiesDiscriminated IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IsUnknownAdditionalPropertiesDiscriminated isUnknownAdditionalPropertiesDiscriminated) => throw null; - - public static explicit operator IsUnknownAdditionalPropertiesDiscriminated(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs index 502a4de22d3..6a593cc384b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/IsUnknownAdditionalPropertiesDiscriminatedDerived.Serialization.cs @@ -12,6 +12,8 @@ public partial class IsUnknownAdditionalPropertiesDiscriminatedDerived : IsUnkno { internal IsUnknownAdditionalPropertiesDiscriminatedDerived() => throw null; + protected override IsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class IsUnknownAdditionalPropertiesDiscriminatedDerived : IsUnkno IsUnknownAdditionalPropertiesDiscriminatedDerived IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override IsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ModelForRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ModelForRecord.Serialization.cs index 76e0713aeca..24aec84b2bd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ModelForRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/ModelForRecord.Serialization.cs @@ -12,6 +12,8 @@ public partial class ModelForRecord : IJsonModel { internal ModelForRecord() => throw null; + protected virtual ModelForRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class ModelForRecord : IJsonModel ModelForRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelForRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/MultipleSpreadRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/MultipleSpreadRecord.Serialization.cs index 30bdb8666e2..d8682acd822 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/MultipleSpreadRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/MultipleSpreadRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class MultipleSpreadRecord : IJsonModel { internal MultipleSpreadRecord() => throw null; + protected virtual MultipleSpreadRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator MultipleSpreadRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class MultipleSpreadRecord : IJsonModel MultipleSpreadRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual MultipleSpreadRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(MultipleSpreadRecord multipleSpreadRecord) => throw null; - - public static explicit operator MultipleSpreadRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadFloatRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadFloatRecord.Serialization.cs index 83c04f36743..aeb17095760 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadFloatRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadFloatRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadFloatRecord : IJsonModel { internal SpreadFloatRecord() => throw null; + protected virtual SpreadFloatRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadFloatRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadFloatRecord : IJsonModel SpreadFloatRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadFloatRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadFloatRecord spreadFloatRecord) => throw null; - - public static explicit operator SpreadFloatRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelArrayRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelArrayRecord.Serialization.cs index 336af688961..9cb1396eee3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelArrayRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelArrayRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadModelArrayRecord : IJsonModel { internal SpreadModelArrayRecord() => throw null; + protected virtual SpreadModelArrayRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadModelArrayRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadModelArrayRecord : IJsonModel SpreadModelArrayRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadModelArrayRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadModelArrayRecord spreadModelArrayRecord) => throw null; - - public static explicit operator SpreadModelArrayRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelRecord.Serialization.cs index ca4e8b35b0c..58080ce3b05 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadModelRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadModelRecord : IJsonModel { internal SpreadModelRecord() => throw null; + protected virtual SpreadModelRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadModelRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadModelRecord : IJsonModel SpreadModelRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadModelRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadModelRecord spreadModelRecord) => throw null; - - public static explicit operator SpreadModelRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion.Serialization.cs index efc7aaf9e5c..7dbf0f7b804 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadRecordForNonDiscriminatedUnion : IJsonModel throw null; + protected virtual SpreadRecordForNonDiscriminatedUnion PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadRecordForNonDiscriminatedUnion(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadRecordForNonDiscriminatedUnion : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadRecordForNonDiscriminatedUnion PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadRecordForNonDiscriminatedUnion spreadRecordForNonDiscriminatedUnion) => throw null; - - public static explicit operator SpreadRecordForNonDiscriminatedUnion(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion2.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion2.Serialization.cs index 2269f0dce71..942f07cfc94 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion2.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion2.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadRecordForNonDiscriminatedUnion2 : IJsonModel throw null; + protected virtual SpreadRecordForNonDiscriminatedUnion2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadRecordForNonDiscriminatedUnion2(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadRecordForNonDiscriminatedUnion2 : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadRecordForNonDiscriminatedUnion2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadRecordForNonDiscriminatedUnion2 spreadRecordForNonDiscriminatedUnion2) => throw null; - - public static explicit operator SpreadRecordForNonDiscriminatedUnion2(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion3.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion3.Serialization.cs index f6a6cf51b52..5096a4f023d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion3.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForNonDiscriminatedUnion3.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadRecordForNonDiscriminatedUnion3 : IJsonModel throw null; + protected virtual SpreadRecordForNonDiscriminatedUnion3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadRecordForNonDiscriminatedUnion3(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadRecordForNonDiscriminatedUnion3 : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadRecordForNonDiscriminatedUnion3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadRecordForNonDiscriminatedUnion3 spreadRecordForNonDiscriminatedUnion3) => throw null; - - public static explicit operator SpreadRecordForNonDiscriminatedUnion3(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForUnion.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForUnion.Serialization.cs index 766c0366879..95a2261305a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForUnion.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadRecordForUnion.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadRecordForUnion : IJsonModel { internal SpreadRecordForUnion() => throw null; + protected virtual SpreadRecordForUnion PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadRecordForUnion(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadRecordForUnion : IJsonModel SpreadRecordForUnion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadRecordForUnion PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadRecordForUnion spreadRecordForUnion) => throw null; - - public static explicit operator SpreadRecordForUnion(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadStringRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadStringRecord.Serialization.cs index aca21bb09ca..2e2f5b52fb8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadStringRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/SpreadStringRecord.Serialization.cs @@ -13,6 +13,10 @@ public partial class SpreadStringRecord : IJsonModel { internal SpreadStringRecord() => throw null; + protected virtual SpreadStringRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator SpreadStringRecord(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class SpreadStringRecord : IJsonModel SpreadStringRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual SpreadStringRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(SpreadStringRecord spreadStringRecord) => throw null; - - public static explicit operator SpreadStringRecord(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs index 0e68f160635..12ae16cf938 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownExtendsUnknownAdditionalPropertiesDiscriminated.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownExtendsUnknownAdditionalPropertiesDiscriminated : { internal UnknownExtendsUnknownAdditionalPropertiesDiscriminated() => throw null; + protected override ExtendsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownExtendsUnknownAdditionalPropertiesDiscriminated : ExtendsUnknownAdditionalPropertiesDiscriminated IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override ExtendsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownIsUnknownAdditionalPropertiesDiscriminated.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownIsUnknownAdditionalPropertiesDiscriminated.Serialization.cs index 1ed061fff68..70903b3c147 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownIsUnknownAdditionalPropertiesDiscriminated.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/UnknownIsUnknownAdditionalPropertiesDiscriminated.Serialization.cs @@ -12,6 +12,8 @@ internal partial class UnknownIsUnknownAdditionalPropertiesDiscriminated : IsUnk { internal UnknownIsUnknownAdditionalPropertiesDiscriminated() => throw null; + protected override IsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ internal partial class UnknownIsUnknownAdditionalPropertiesDiscriminated : IsUnk IsUnknownAdditionalPropertiesDiscriminated IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected override IsUnknownAdditionalPropertiesDiscriminated PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData0.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData0.Serialization.cs index 8297f076137..8dee1942534 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData0.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData0.Serialization.cs @@ -12,6 +12,8 @@ public partial class WidgetData0 : IJsonModel { internal WidgetData0() => throw null; + protected virtual WidgetData0 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class WidgetData0 : IJsonModel WidgetData0 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual WidgetData0 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData1.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData1.Serialization.cs index cbee0dac8d6..ff4ca24cf42 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData1.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData1.Serialization.cs @@ -12,6 +12,8 @@ public partial class WidgetData1 : IJsonModel { internal WidgetData1() => throw null; + protected virtual WidgetData1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class WidgetData1 : IJsonModel WidgetData1 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual WidgetData1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData2.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData2.Serialization.cs index 1c7a2bb2e5b..737f16cfca0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData2.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/Models/WidgetData2.Serialization.cs @@ -12,6 +12,8 @@ public partial class WidgetData2 : IJsonModel { internal WidgetData2() => throw null; + protected virtual WidgetData2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class WidgetData2 : IJsonModel WidgetData2 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual WidgetData2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/BytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/BytesProperty.Serialization.cs index 33b2b5d6498..d17fd1afbd8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/BytesProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/BytesProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class BytesProperty : IJsonModel { internal BytesProperty() => throw null; + protected virtual BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator BytesProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class BytesProperty : IJsonModel BytesProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator BytesProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsByteProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsByteProperty.Serialization.cs index 74b7dba809c..35bcf83fedd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsByteProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsByteProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class CollectionsByteProperty : IJsonModel throw null; + protected virtual CollectionsByteProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsByteProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class CollectionsByteProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsByteProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator CollectionsByteProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsModelProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsModelProperty.Serialization.cs index 74c829203ec..e5ba94e23a6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsModelProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsModelProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class CollectionsModelProperty : IJsonModel throw null; + protected virtual CollectionsModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsModelProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class CollectionsModelProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator CollectionsModelProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsStringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsStringProperty.Serialization.cs index 9856a6c9dfc..0adcb6e8f1b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsStringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/CollectionsStringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class CollectionsStringProperty : IJsonModel throw null; + protected virtual CollectionsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsStringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class CollectionsStringProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator CollectionsStringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DatetimeProperty.Serialization.cs index 442c22e9a35..f9cf85bfdfb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DatetimeProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DatetimeProperty : IJsonModel { internal DatetimeProperty() => throw null; + protected virtual DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class DatetimeProperty : IJsonModel DatetimeProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator DatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DurationProperty.Serialization.cs index c370acb1538..3aad406073e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/DurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DurationProperty : IJsonModel { internal DurationProperty() => throw null; + protected virtual DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class DurationProperty : IJsonModel DurationProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator DurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/InnerModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/InnerModel.Serialization.cs index d588f68c894..9435b23e93d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/InnerModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/InnerModel.Serialization.cs @@ -12,6 +12,8 @@ public partial class InnerModel : IJsonModel { internal InnerModel() => throw null; + protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class InnerModel : IJsonModel InnerModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/StringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/StringProperty.Serialization.cs index 4f732194abd..8cac21f8638 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/StringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Models/StringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class StringProperty : IJsonModel { internal StringProperty() => throw null; + protected virtual StringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator StringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class StringProperty : IJsonModel StringProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual StringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator StringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.Serialization.cs index bcd8ec31f08..f5fe180db47 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class BooleanLiteralProperty : IJsonModel { + protected virtual BooleanLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator BooleanLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class BooleanLiteralProperty : IJsonModel BooleanLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BooleanLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(BooleanLiteralProperty booleanLiteralProperty) => throw null; - - public static explicit operator BooleanLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BytesProperty.Serialization.cs index 6dfdd868d21..4bd942f2d19 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BytesProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/BytesProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class BytesProperty : IJsonModel { + protected virtual BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator BytesProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class BytesProperty : IJsonModel BytesProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(BytesProperty bytesProperty) => throw null; - - public static explicit operator BytesProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.Serialization.cs index 2219cf836bd..5c86be6ca6e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class CollectionsByteProperty : IJsonModel { + protected virtual CollectionsByteProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsByteProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class CollectionsByteProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsByteProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(CollectionsByteProperty collectionsByteProperty) => throw null; - - public static explicit operator CollectionsByteProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.Serialization.cs index 00b37679c73..29b1e37a1e6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class CollectionsModelProperty : IJsonModel { + protected virtual CollectionsModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsModelProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class CollectionsModelProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(CollectionsModelProperty collectionsModelProperty) => throw null; - - public static explicit operator CollectionsModelProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DatetimeProperty.Serialization.cs index 1fa31738297..64131c3a983 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DatetimeProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class DatetimeProperty : IJsonModel { + protected virtual DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class DatetimeProperty : IJsonModel DatetimeProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DatetimeProperty datetimeProperty) => throw null; - - public static explicit operator DatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DurationProperty.Serialization.cs index af3d3d06fde..0833822484f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/DurationProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class DurationProperty : IJsonModel { + protected virtual DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class DurationProperty : IJsonModel DurationProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DurationProperty durationProperty) => throw null; - - public static explicit operator DurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.Serialization.cs index 33387e66beb..565da2adb17 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class FloatLiteralProperty : IJsonModel { + protected virtual FloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class FloatLiteralProperty : IJsonModel FloatLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatLiteralProperty floatLiteralProperty) => throw null; - - public static explicit operator FloatLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.Serialization.cs index 2fd347b7cb3..a6fe1bb5b81 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class IntLiteralProperty : IJsonModel { + protected virtual IntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IntLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class IntLiteralProperty : IJsonModel IntLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IntLiteralProperty intLiteralProperty) => throw null; - - public static explicit operator IntLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainDateProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainDateProperty.Serialization.cs index cc7f6a5cddc..a78693384ed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainDateProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainDateProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class PlainDateProperty : IJsonModel { + protected virtual PlainDateProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator PlainDateProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class PlainDateProperty : IJsonModel PlainDateProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual PlainDateProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(PlainDateProperty plainDateProperty) => throw null; - - public static explicit operator PlainDateProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.Serialization.cs index 87390794833..efe4cf752d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class PlainTimeProperty : IJsonModel { + protected virtual PlainTimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator PlainTimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class PlainTimeProperty : IJsonModel PlainTimeProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual PlainTimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(PlainTimeProperty plainTimeProperty) => throw null; - - public static explicit operator PlainTimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.Serialization.cs index 722ded5b66f..04c28bfadab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class RequiredAndOptionalProperty : IJsonModel throw null; + protected virtual RequiredAndOptionalProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator RequiredAndOptionalProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class RequiredAndOptionalProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual RequiredAndOptionalProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(RequiredAndOptionalProperty requiredAndOptionalProperty) => throw null; - - public static explicit operator RequiredAndOptionalProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.Serialization.cs index 510e4a37e28..abaa0e9d788 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class StringLiteralProperty : IJsonModel { + protected virtual StringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator StringLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class StringLiteralProperty : IJsonModel StringLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual StringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(StringLiteralProperty stringLiteralProperty) => throw null; - - public static explicit operator StringLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringProperty.Serialization.cs index ef570da8929..4110d988172 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/StringProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class StringProperty : IJsonModel { + protected virtual StringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator StringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class StringProperty : IJsonModel StringProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual StringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(StringProperty stringProperty) => throw null; - - public static explicit operator StringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs index c5916501982..a807b7042a7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class UnionFloatLiteralProperty : IJsonModel { + protected virtual UnionFloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnionFloatLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class UnionFloatLiteralProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnionFloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnionFloatLiteralProperty unionFloatLiteralProperty) => throw null; - - public static explicit operator UnionFloatLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs index c19e8f23b6c..71b83e7eb47 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class UnionIntLiteralProperty : IJsonModel { + protected virtual UnionIntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnionIntLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class UnionIntLiteralProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnionIntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnionIntLiteralProperty unionIntLiteralProperty) => throw null; - - public static explicit operator UnionIntLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs index 92528bcb933..0c2f00381d1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.Optional { public partial class UnionStringLiteralProperty : IJsonModel { + protected virtual UnionStringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnionStringLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class UnionStringLiteralProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnionStringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnionStringLiteralProperty unionStringLiteralProperty) => throw null; - - public static explicit operator UnionStringLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanLiteralProperty.Serialization.cs index 4f3a5e7c639..f61c36faf4a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.ValueTypes { public partial class BooleanLiteralProperty : IJsonModel { + protected virtual BooleanLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator BooleanLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class BooleanLiteralProperty : IJsonModel BooleanLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BooleanLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(BooleanLiteralProperty booleanLiteralProperty) => throw null; - - public static explicit operator BooleanLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanProperty.Serialization.cs index 1c6c7152eae..8ec10ade24e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BooleanProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class BooleanProperty : IJsonModel { internal BooleanProperty() => throw null; + protected virtual BooleanProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator BooleanProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class BooleanProperty : IJsonModel BooleanProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BooleanProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(BooleanProperty booleanProperty) => throw null; - - public static explicit operator BooleanProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BytesProperty.Serialization.cs index bf47b824ac1..2df1a9bd9fe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BytesProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/BytesProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class BytesProperty : IJsonModel { internal BytesProperty() => throw null; + protected virtual BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator BytesProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class BytesProperty : IJsonModel BytesProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual BytesProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(BytesProperty bytesProperty) => throw null; - - public static explicit operator BytesProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsIntProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsIntProperty.Serialization.cs index fdd2cbb61cc..c642dcd947d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsIntProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsIntProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class CollectionsIntProperty : IJsonModel { internal CollectionsIntProperty() => throw null; + protected virtual CollectionsIntProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsIntProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class CollectionsIntProperty : IJsonModel CollectionsIntProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsIntProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(CollectionsIntProperty collectionsIntProperty) => throw null; - - public static explicit operator CollectionsIntProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsModelProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsModelProperty.Serialization.cs index 02fe1ce5969..6d309f5a4ac 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsModelProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsModelProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class CollectionsModelProperty : IJsonModel throw null; + protected virtual CollectionsModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsModelProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class CollectionsModelProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(CollectionsModelProperty collectionsModelProperty) => throw null; - - public static explicit operator CollectionsModelProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsStringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsStringProperty.Serialization.cs index 7ca64592fc4..cdc07ed4728 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsStringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/CollectionsStringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class CollectionsStringProperty : IJsonModel throw null; + protected virtual CollectionsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator CollectionsStringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class CollectionsStringProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual CollectionsStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(CollectionsStringProperty collectionsStringProperty) => throw null; - - public static explicit operator CollectionsStringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DatetimeProperty.Serialization.cs index d8f4aff7899..d9713c89842 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DatetimeProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DatetimeProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DatetimeProperty : IJsonModel { internal DatetimeProperty() => throw null; + protected virtual DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DatetimeProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DatetimeProperty : IJsonModel DatetimeProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DatetimeProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DatetimeProperty datetimeProperty) => throw null; - - public static explicit operator DatetimeProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/Decimal128Property.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/Decimal128Property.Serialization.cs index d8c2c19cddb..f4202270674 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/Decimal128Property.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/Decimal128Property.Serialization.cs @@ -13,6 +13,10 @@ public partial class Decimal128Property : IJsonModel { internal Decimal128Property() => throw null; + protected virtual Decimal128Property PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Decimal128Property(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class Decimal128Property : IJsonModel Decimal128Property IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Decimal128Property PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(Decimal128Property decimal128Property) => throw null; - - public static explicit operator Decimal128Property(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DecimalProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DecimalProperty.Serialization.cs index 40671b3eb79..e02c1c4241b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DecimalProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DecimalProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DecimalProperty : IJsonModel { internal DecimalProperty() => throw null; + protected virtual DecimalProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DecimalProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DecimalProperty : IJsonModel DecimalProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DecimalProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DecimalProperty decimalProperty) => throw null; - - public static explicit operator DecimalProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DictionaryStringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DictionaryStringProperty.Serialization.cs index abfcd0244ae..f6d2c32f996 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DictionaryStringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DictionaryStringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DictionaryStringProperty : IJsonModel throw null; + protected virtual DictionaryStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DictionaryStringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DictionaryStringProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DictionaryStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DictionaryStringProperty dictionaryStringProperty) => throw null; - - public static explicit operator DictionaryStringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DurationProperty.Serialization.cs index eabf5d87702..60f1e6047db 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DurationProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/DurationProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class DurationProperty : IJsonModel { internal DurationProperty() => throw null; + protected virtual DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator DurationProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class DurationProperty : IJsonModel DurationProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual DurationProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(DurationProperty durationProperty) => throw null; - - public static explicit operator DurationProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/EnumProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/EnumProperty.Serialization.cs index ef4e7869af9..77760e8394d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/EnumProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/EnumProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class EnumProperty : IJsonModel { internal EnumProperty() => throw null; + protected virtual EnumProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator EnumProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class EnumProperty : IJsonModel EnumProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual EnumProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(EnumProperty enumProperty) => throw null; - - public static explicit operator EnumProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ExtensibleEnumProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ExtensibleEnumProperty.Serialization.cs index 6baf23e4d46..6f40fcd3c9a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ExtensibleEnumProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ExtensibleEnumProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class ExtensibleEnumProperty : IJsonModel { internal ExtensibleEnumProperty() => throw null; + protected virtual ExtensibleEnumProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ExtensibleEnumProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ExtensibleEnumProperty : IJsonModel ExtensibleEnumProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ExtensibleEnumProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ExtensibleEnumProperty extensibleEnumProperty) => throw null; - - public static explicit operator ExtensibleEnumProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatLiteralProperty.Serialization.cs index e0b386903a8..58523b9ade8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.ValueTypes { public partial class FloatLiteralProperty : IJsonModel { + protected virtual FloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class FloatLiteralProperty : IJsonModel FloatLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatLiteralProperty floatLiteralProperty) => throw null; - - public static explicit operator FloatLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatProperty.Serialization.cs index 0ac97ba2203..2221f7d00f2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/FloatProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class FloatProperty : IJsonModel { internal FloatProperty() => throw null; + protected virtual FloatProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator FloatProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class FloatProperty : IJsonModel FloatProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual FloatProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(FloatProperty floatProperty) => throw null; - - public static explicit operator FloatProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/InnerModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/InnerModel.Serialization.cs index 3aa3579541f..b77a192e93e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/InnerModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/InnerModel.Serialization.cs @@ -12,6 +12,8 @@ public partial class InnerModel : IJsonModel { internal InnerModel() => throw null; + protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class InnerModel : IJsonModel InnerModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual InnerModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntLiteralProperty.Serialization.cs index d43ff85edbb..28605f0861f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.ValueTypes { public partial class IntLiteralProperty : IJsonModel { + protected virtual IntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IntLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class IntLiteralProperty : IJsonModel IntLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IntLiteralProperty intLiteralProperty) => throw null; - - public static explicit operator IntLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntProperty.Serialization.cs index 70d609a4efb..799d7f6276e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/IntProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class IntProperty : IJsonModel { internal IntProperty() => throw null; + protected virtual IntProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator IntProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class IntProperty : IJsonModel IntProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual IntProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(IntProperty intProperty) => throw null; - - public static explicit operator IntProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ModelProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ModelProperty.Serialization.cs index c82c471f710..f0ea0ddbd9c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ModelProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/ModelProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelProperty : IJsonModel { internal ModelProperty() => throw null; + protected virtual ModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelProperty : IJsonModel ModelProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelProperty modelProperty) => throw null; - - public static explicit operator ModelProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/NeverProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/NeverProperty.Serialization.cs index 652ae9a8eec..1d20ffd7db5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/NeverProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/NeverProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.ValueTypes { public partial class NeverProperty : IJsonModel { + protected virtual NeverProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator NeverProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class NeverProperty : IJsonModel NeverProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual NeverProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(NeverProperty neverProperty) => throw null; - - public static explicit operator NeverProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringLiteralProperty.Serialization.cs index cf7e5b50bc7..799bf99a8f7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringLiteralProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.ValueTypes { public partial class StringLiteralProperty : IJsonModel { + protected virtual StringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator StringLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class StringLiteralProperty : IJsonModel StringLiteralProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual StringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(StringLiteralProperty stringLiteralProperty) => throw null; - - public static explicit operator StringLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringProperty.Serialization.cs index 71cc339fef3..6ad0ddbb70c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/StringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class StringProperty : IJsonModel { internal StringProperty() => throw null; + protected virtual StringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator StringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class StringProperty : IJsonModel StringProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual StringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(StringProperty stringProperty) => throw null; - - public static explicit operator StringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionEnumValueProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionEnumValueProperty.Serialization.cs index 74328d17d32..71fc2ebba9a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionEnumValueProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionEnumValueProperty.Serialization.cs @@ -11,6 +11,10 @@ namespace _Type.Property.ValueTypes { public partial class UnionEnumValueProperty : IJsonModel { + protected virtual UnionEnumValueProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnionEnumValueProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -25,12 +29,8 @@ public partial class UnionEnumValueProperty : IJsonModel UnionEnumValueProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnionEnumValueProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnionEnumValueProperty unionEnumValueProperty) => throw null; - - public static explicit operator UnionEnumValueProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs index 55374ac6d0b..a914b17afd7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnionFloatLiteralProperty : IJsonModel throw null; + protected virtual UnionFloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnionFloatLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnionFloatLiteralProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnionFloatLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnionFloatLiteralProperty unionFloatLiteralProperty) => throw null; - - public static explicit operator UnionFloatLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs index 0f7fcede169..f050902a8f1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnionIntLiteralProperty : IJsonModel throw null; + protected virtual UnionIntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnionIntLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnionIntLiteralProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnionIntLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnionIntLiteralProperty unionIntLiteralProperty) => throw null; - - public static explicit operator UnionIntLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs index d59653b84e9..4463341e2e2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnionStringLiteralProperty : IJsonModel throw null; + protected virtual UnionStringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnionStringLiteralProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnionStringLiteralProperty : IJsonModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnionStringLiteralProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnionStringLiteralProperty unionStringLiteralProperty) => throw null; - - public static explicit operator UnionStringLiteralProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownArrayProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownArrayProperty.Serialization.cs index 1656b612297..a94ce26f61b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownArrayProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownArrayProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnknownArrayProperty : IJsonModel { internal UnknownArrayProperty() => throw null; + protected virtual UnknownArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnknownArrayProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnknownArrayProperty : IJsonModel UnknownArrayProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnknownArrayProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnknownArrayProperty unknownArrayProperty) => throw null; - - public static explicit operator UnknownArrayProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownDictProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownDictProperty.Serialization.cs index 79c238dc366..03d984928ae 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownDictProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownDictProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnknownDictProperty : IJsonModel { internal UnknownDictProperty() => throw null; + protected virtual UnknownDictProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnknownDictProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnknownDictProperty : IJsonModel UnknownDictProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnknownDictProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnknownDictProperty unknownDictProperty) => throw null; - - public static explicit operator UnknownDictProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownIntProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownIntProperty.Serialization.cs index 68efa52c0c3..1a498a3e477 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownIntProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownIntProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnknownIntProperty : IJsonModel { internal UnknownIntProperty() => throw null; + protected virtual UnknownIntProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnknownIntProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnknownIntProperty : IJsonModel UnknownIntProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnknownIntProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnknownIntProperty unknownIntProperty) => throw null; - - public static explicit operator UnknownIntProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownStringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownStringProperty.Serialization.cs index 65f6e34af2f..aa230dacbd3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownStringProperty.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Models/UnknownStringProperty.Serialization.cs @@ -13,6 +13,10 @@ public partial class UnknownStringProperty : IJsonModel { internal UnknownStringProperty() => throw null; + protected virtual UnknownStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator UnknownStringProperty(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class UnknownStringProperty : IJsonModel UnknownStringProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual UnknownStringProperty PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(UnknownStringProperty unknownStringProperty) => throw null; - - public static explicit operator UnknownStringProperty(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Cat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Cat.Serialization.cs index 0838b576ce8..6b177fe4670 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Cat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Cat.Serialization.cs @@ -13,6 +13,10 @@ public partial class Cat : IJsonModel { internal Cat() => throw null; + protected virtual Cat PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Cat(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class Cat : IJsonModel Cat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Cat PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator Cat(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Dog.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Dog.Serialization.cs index b3e6e5b6d22..9d1b8176899 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Dog.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/discriminated/src/Generated/Models/Dog.Serialization.cs @@ -13,6 +13,10 @@ public partial class Dog : IJsonModel { internal Dog() => throw null; + protected virtual Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator Dog(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class Dog : IJsonModel Dog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator Dog(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Cat.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Cat.Serialization.cs index 70aebc2b7ba..2ac4f0ada79 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Cat.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Cat.Serialization.cs @@ -12,6 +12,8 @@ public partial class Cat : IJsonModel { internal Cat() => throw null; + protected virtual Cat PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Cat : IJsonModel Cat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Cat PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Dog.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Dog.Serialization.cs index 3d697fb32e3..68274e3f6bc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Dog.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/Dog.Serialization.cs @@ -12,6 +12,8 @@ public partial class Dog : IJsonModel { internal Dog() => throw null; + protected virtual Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class Dog : IJsonModel Dog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual Dog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/EnumsOnlyCases.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/EnumsOnlyCases.Serialization.cs index 95f7bd4f26d..25054f2273c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/EnumsOnlyCases.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/EnumsOnlyCases.Serialization.cs @@ -12,6 +12,8 @@ public partial class EnumsOnlyCases : IJsonModel { internal EnumsOnlyCases() => throw null; + protected virtual EnumsOnlyCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class EnumsOnlyCases : IJsonModel EnumsOnlyCases IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual EnumsOnlyCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse.Serialization.cs index 47a7a8b6ad8..4811f3d837d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse : IJsonModel { internal GetResponse() => throw null; + protected virtual GetResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse : IJsonModel GetResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse1.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse1.Serialization.cs index 29e918815f4..b0092ad951e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse1.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse1.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse1 : IJsonModel { internal GetResponse1() => throw null; + protected virtual GetResponse1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse1(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse1 : IJsonModel GetResponse1 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse1(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse2.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse2.Serialization.cs index 658737ebefd..afa7a516351 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse2.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse2.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse2 : IJsonModel { internal GetResponse2() => throw null; + protected virtual GetResponse2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse2(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse2 : IJsonModel GetResponse2 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse2(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse3.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse3.Serialization.cs index 8752f54d663..f364c6f3cca 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse3.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse3.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse3 : IJsonModel { internal GetResponse3() => throw null; + protected virtual GetResponse3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse3(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse3 : IJsonModel GetResponse3 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse3(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse4.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse4.Serialization.cs index 148f20583fe..dbfcc5ff506 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse4.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse4.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse4 : IJsonModel { internal GetResponse4() => throw null; + protected virtual GetResponse4 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse4(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse4 : IJsonModel GetResponse4 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse4 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse4(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse5.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse5.Serialization.cs index 31328738dbf..bdc66c980a3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse5.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse5.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse5 : IJsonModel { internal GetResponse5() => throw null; + protected virtual GetResponse5 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse5(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse5 : IJsonModel GetResponse5 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse5 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse5(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse6.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse6.Serialization.cs index 64acb026c18..e70e08cda62 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse6.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse6.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse6 : IJsonModel { internal GetResponse6() => throw null; + protected virtual GetResponse6 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse6(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse6 : IJsonModel GetResponse6 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse6 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse6(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse7.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse7.Serialization.cs index 4ac51ee1a1e..3b515b04054 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse7.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse7.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse7 : IJsonModel { internal GetResponse7() => throw null; + protected virtual GetResponse7 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse7(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse7 : IJsonModel GetResponse7 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse7 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse7(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse8.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse8.Serialization.cs index 0cacdba0f72..269860167d7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse8.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse8.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse8 : IJsonModel { internal GetResponse8() => throw null; + protected virtual GetResponse8 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse8(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse8 : IJsonModel GetResponse8 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse8 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse8(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse9.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse9.Serialization.cs index bf542bba52f..d2826c86bcb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse9.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/GetResponse9.Serialization.cs @@ -13,6 +13,10 @@ public partial class GetResponse9 : IJsonModel { internal GetResponse9() => throw null; + protected virtual GetResponse9 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator GetResponse9(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,10 +31,6 @@ public partial class GetResponse9 : IJsonModel GetResponse9 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual GetResponse9 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static explicit operator GetResponse9(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedLiteralsCases.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedLiteralsCases.Serialization.cs index 155b5c328ad..5153adda5a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedLiteralsCases.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedLiteralsCases.Serialization.cs @@ -12,6 +12,8 @@ public partial class MixedLiteralsCases : IJsonModel { internal MixedLiteralsCases() => throw null; + protected virtual MixedLiteralsCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class MixedLiteralsCases : IJsonModel MixedLiteralsCases IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual MixedLiteralsCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedTypesCases.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedTypesCases.Serialization.cs index f97a36e196d..e8c6ea3f7f1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedTypesCases.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/MixedTypesCases.Serialization.cs @@ -12,6 +12,8 @@ public partial class MixedTypesCases : IJsonModel { internal MixedTypesCases() => throw null; + protected virtual MixedTypesCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class MixedTypesCases : IJsonModel MixedTypesCases IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual MixedTypesCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/StringAndArrayCases.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/StringAndArrayCases.Serialization.cs index 0069a78020c..f939b182a93 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/StringAndArrayCases.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/Models/StringAndArrayCases.Serialization.cs @@ -12,6 +12,8 @@ public partial class StringAndArrayCases : IJsonModel { internal StringAndArrayCases() => throw null; + protected virtual StringAndArrayCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -26,8 +28,6 @@ public partial class StringAndArrayCases : IJsonModel StringAndArrayCases IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual StringAndArrayCases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/Models/ModelV1.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/Models/ModelV1.Serialization.cs index f994dc369db..9c442653c83 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/Models/ModelV1.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/Models/ModelV1.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV1 : IJsonModel { internal ModelV1() => throw null; + protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV1(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV1 : IJsonModel ModelV1 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV1 modelV1) => throw null; - - public static explicit operator ModelV1(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV1.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV1.Serialization.cs index f994dc369db..9c442653c83 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV1.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV1.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV1 : IJsonModel { internal ModelV1() => throw null; + protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV1(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV1 : IJsonModel ModelV1 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV1 modelV1) => throw null; - - public static explicit operator ModelV1(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV2.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV2.Serialization.cs index 9cb4c48477d..2199267e33f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV2.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/Models/ModelV2.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV2 : IJsonModel { internal ModelV2() => throw null; + protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV2(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV2 : IJsonModel ModelV2 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV2 modelV2) => throw null; - - public static explicit operator ModelV2(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs index 520d9fd8a20..3370cdd5a33 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class TestModel : IJsonModel { internal TestModel() => throw null; + protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator TestModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class TestModel : IJsonModel TestModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(TestModel testModel) => throw null; - - public static explicit operator TestModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/Models/TestModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/Models/TestModel.Serialization.cs index 520d9fd8a20..3370cdd5a33 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/Models/TestModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/Models/TestModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class TestModel : IJsonModel { internal TestModel() => throw null; + protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator TestModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class TestModel : IJsonModel TestModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(TestModel testModel) => throw null; - - public static explicit operator TestModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV1.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV1.Serialization.cs index 275ab0651ab..0c9fcccd5f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV1.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV1.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV1 : IJsonModel { internal ModelV1() => throw null; + protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV1(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV1 : IJsonModel ModelV1 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV1 modelV1) => throw null; - - public static explicit operator ModelV1(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV2.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV2.Serialization.cs index 2150cb75bfb..933b8a02042 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV2.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV2.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV2 : IJsonModel { internal ModelV2() => throw null; + protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV2(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV2 : IJsonModel ModelV2 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV2 modelV2) => throw null; - - public static explicit operator ModelV2(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV3.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV3.Serialization.cs index 3a8f4557100..11ead1e3bbe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV3.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/Models/ModelV3.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV3 : IJsonModel { internal ModelV3() => throw null; + protected virtual ModelV3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV3(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV3 : IJsonModel ModelV3 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV3 modelV3) => throw null; - - public static explicit operator ModelV3(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV2.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV2.Serialization.cs index 2150cb75bfb..933b8a02042 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV2.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV2.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV2 : IJsonModel { internal ModelV2() => throw null; + protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV2(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV2 : IJsonModel ModelV2 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV2 modelV2) => throw null; - - public static explicit operator ModelV2(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV3.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV3.Serialization.cs index 3a8f4557100..11ead1e3bbe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV3.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/Models/ModelV3.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV3 : IJsonModel { internal ModelV3() => throw null; + protected virtual ModelV3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV3(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV3 : IJsonModel ModelV3 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV3 modelV3) => throw null; - - public static explicit operator ModelV3(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV1.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV1.Serialization.cs index 275ab0651ab..0c9fcccd5f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV1.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV1.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV1 : IJsonModel { internal ModelV1() => throw null; + protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV1(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV1 : IJsonModel ModelV1 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV1 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV1 modelV1) => throw null; - - public static explicit operator ModelV1(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV2.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV2.Serialization.cs index 2150cb75bfb..933b8a02042 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV2.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV2.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV2 : IJsonModel { internal ModelV2() => throw null; + protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV2(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV2 : IJsonModel ModelV2 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV2 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV2 modelV2) => throw null; - - public static explicit operator ModelV2(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV3.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV3.Serialization.cs index 3a8f4557100..11ead1e3bbe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV3.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/Models/ModelV3.Serialization.cs @@ -13,6 +13,10 @@ public partial class ModelV3 : IJsonModel { internal ModelV3() => throw null; + protected virtual ModelV3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator ModelV3(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class ModelV3 : IJsonModel ModelV3 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual ModelV3 PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(ModelV3 modelV3) => throw null; - - public static explicit operator ModelV3(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/Models/OldModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/Models/OldModel.Serialization.cs index bc3a20837a8..a71adbd4b55 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/Models/OldModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/Models/OldModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class OldModel : IJsonModel { internal OldModel() => throw null; + protected virtual OldModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator OldModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class OldModel : IJsonModel OldModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual OldModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(OldModel oldModel) => throw null; - - public static explicit operator OldModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/Models/NewModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/Models/NewModel.Serialization.cs index 9ceff58e94d..28734b3ef44 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/Models/NewModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/Models/NewModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class NewModel : IJsonModel { internal NewModel() => throw null; + protected virtual NewModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator NewModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class NewModel : IJsonModel NewModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual NewModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(NewModel newModel) => throw null; - - public static explicit operator NewModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/Models/TestModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/Models/TestModel.Serialization.cs index 8e35ea12a0b..cc1f7987018 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/Models/TestModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/Models/TestModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class TestModel : IJsonModel { internal TestModel() => throw null; + protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator TestModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class TestModel : IJsonModel TestModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(TestModel testModel) => throw null; - - public static explicit operator TestModel(ClientResult result) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/Models/TestModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/Models/TestModel.Serialization.cs index 8e35ea12a0b..cc1f7987018 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/Models/TestModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/Models/TestModel.Serialization.cs @@ -13,6 +13,10 @@ public partial class TestModel : IJsonModel { internal TestModel() => throw null; + protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + public static explicit operator TestModel(ClientResult result) => throw null; + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; @@ -27,12 +31,8 @@ public partial class TestModel : IJsonModel TestModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; public static implicit operator BinaryContent(TestModel testModel) => throw null; - - public static explicit operator TestModel(ClientResult result) => throw null; } } From 709787696d86f531230b722e97e3bc4e1e24cb18 Mon Sep 17 00:00:00 2001 From: Jorge Rangel Date: Wed, 4 Feb 2026 17:33:05 -0600 Subject: [PATCH 2/5] add support for ns --- .../Generated/Models/SampleTypeSpecContext.cs | 1 + .../Models/XmlAdvancedModel.Serialization.cs | 96 ++ .../src/Generated/Models/XmlAdvancedModel.cs | 46 +- .../XmlModelWithNamespace.Serialization.cs | 139 ++ .../Generated/Models/XmlModelWithNamespace.cs | 35 + .../Generated/SampleTypeSpecModelFactory.cs | 25 +- .../client/csharp/SampleService/main.tsp | 30 + .../MrwSerializationTypeDefinition.Xml.cs | 186 ++- .../MrwSerializationTypeDefinition.cs | 9 +- .../src/Snippets/XElementSnippets.cs | 8 +- .../ExplicitOperatorForJsonAndXmlModel.cs | 36 + .../ExplicitOperatorForXmlOnlyModel.cs | 27 + ...ializationHandlesAttributeWithNamespace.cs | 60 + ...erializationHandlesElementWithNamespace.cs | 47 + .../XmlDeserializationTests.cs | 99 ++ .../src/Snippets/StringSnippets.cs | 3 + .../Generated/Models/Plant.Serialization.cs | 108 +- .../Generated/Models/SampleTypeSpecContext.cs | 1 + .../Generated/Models/Tree.Serialization.cs | 121 +- .../Models/UnknownPlant.Serialization.cs | 106 +- .../Models/XmlAdvancedModel.Serialization.cs | 66 + .../src/Generated/Models/XmlAdvancedModel.cs | 46 +- .../XmlModelWithNamespace.Serialization.cs | 65 + .../Generated/Models/XmlModelWithNamespace.cs | 38 + .../Generated/PlantOperations.RestClient.cs | 2 +- .../Generated/SampleTypeSpecModelFactory.cs | 25 +- .../Local/Sample-TypeSpec/tspCodeModel.json | 1170 +++++++++++------ 27 files changed, 2164 insertions(+), 431 deletions(-) create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.Serialization.cs create mode 100644 docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForJsonAndXmlModel.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForXmlOnlyModel.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeWithNamespace.cs create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesElementWithNamespace.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.cs diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs index dcb0097bb9d..d24dba74895 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/SampleTypeSpecContext.cs @@ -35,6 +35,7 @@ namespace SampleTypeSpec [ModelReaderWriterBuildable(typeof(UnknownPlant))] [ModelReaderWriterBuildable(typeof(XmlAdvancedModel))] [ModelReaderWriterBuildable(typeof(XmlItem))] + [ModelReaderWriterBuildable(typeof(XmlModelWithNamespace))] [ModelReaderWriterBuildable(typeof(XmlNestedModel))] public partial class SampleTypeSpecContext : ModelReaderWriterContext { diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs index 358eeb1aa4c..b96b5cc7205 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.Serialization.cs @@ -183,6 +183,38 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("optionalExtensibleEnum"u8); writer.WriteNumberValue(OptionalExtensibleEnum.Value.ToSerialInt32()); } + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + writer.WritePropertyName("daysUsed"u8); + writer.WriteNumberValue(DaysUsed); + writer.WritePropertyName("fooItems"u8); + writer.WriteStartArray(); + foreach (string item in FooItems) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("anotherModel"u8); + writer.WriteObjectValue(AnotherModel, options); + writer.WritePropertyName("modelsWithNamespaces"u8); + writer.WriteStartArray(); + foreach (XmlModelWithNamespace item in ModelsWithNamespaces) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("unwrappedModelsWithNamespaces"u8); + writer.WriteStartArray(); + foreach (XmlModelWithNamespace item in UnwrappedModelsWithNamespaces) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); if (options.Format != "W" && _additionalBinaryDataProperties != null) { foreach (var item in _additionalBinaryDataProperties) @@ -254,6 +286,12 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(JsonElement element StringExtensibleEnum extensibleEnum = default; IntFixedEnum? optionalFixedEnum = default; IntExtensibleEnum? optionalExtensibleEnum = default; + string label = default; + int daysUsed = default; + IList fooItems = default; + XmlNestedModel anotherModel = default; + IList modelsWithNamespaces = default; + IList unwrappedModelsWithNamespaces = default; IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); foreach (var prop in element.EnumerateObject()) { @@ -490,6 +528,58 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(JsonElement element optionalExtensibleEnum = new IntExtensibleEnum(prop.Value.GetInt32()); continue; } + if (prop.NameEquals("label"u8)) + { + label = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("daysUsed"u8)) + { + daysUsed = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("fooItems"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + fooItems = array; + continue; + } + if (prop.NameEquals("anotherModel"u8)) + { + anotherModel = XmlNestedModel.DeserializeXmlNestedModel(prop.Value, options); + continue; + } + if (prop.NameEquals("modelsWithNamespaces"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(XmlModelWithNamespace.DeserializeXmlModelWithNamespace(item, options)); + } + modelsWithNamespaces = array; + continue; + } + if (prop.NameEquals("unwrappedModelsWithNamespaces"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(XmlModelWithNamespace.DeserializeXmlModelWithNamespace(item, options)); + } + unwrappedModelsWithNamespaces = array; + continue; + } if (options.Format != "W") { additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); @@ -525,6 +615,12 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(JsonElement element extensibleEnum, optionalFixedEnum, optionalExtensibleEnum, + label, + daysUsed, + fooItems, + anotherModel, + modelsWithNamespaces, + unwrappedModelsWithNamespaces, additionalBinaryDataProperties); } diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs index 070965b492c..e927de1c51d 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlAdvancedModel.cs @@ -39,7 +39,13 @@ public partial class XmlAdvancedModel /// A bytes property. /// A fixed enum property. /// An extensible enum property. - internal XmlAdvancedModel(string name, int age, bool enabled, float score, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IEnumerable unwrappedStrings, IEnumerable unwrappedCounts, IEnumerable unwrappedItems, IEnumerable wrappedColors, IEnumerable items, XmlNestedModel nestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum) + /// + /// + /// + /// + /// + /// + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IEnumerable unwrappedStrings, IEnumerable unwrappedCounts, IEnumerable unwrappedItems, IEnumerable wrappedColors, IEnumerable items, XmlNestedModel nestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, string label, int daysUsed, IEnumerable fooItems, XmlNestedModel anotherModel, IEnumerable modelsWithNamespaces, IEnumerable unwrappedModelsWithNamespaces) { Name = name; Age = age; @@ -65,6 +71,12 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin OptionalRecordUnknown = new ChangeTrackingDictionary(); FixedEnum = fixedEnum; ExtensibleEnum = extensibleEnum; + Label = label; + DaysUsed = daysUsed; + FooItems = fooItems.ToList(); + AnotherModel = anotherModel; + ModelsWithNamespaces = modelsWithNamespaces.ToList(); + UnwrappedModelsWithNamespaces = unwrappedModelsWithNamespaces.ToList(); } /// Initializes a new instance of . @@ -97,8 +109,14 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin /// An extensible enum property. /// An optional fixed enum property. /// An optional extensible enum property. + /// + /// + /// + /// + /// + /// /// Keeps track of any properties unknown to the library. - internal XmlAdvancedModel(string name, int age, bool enabled, float score, string optionalString, int? optionalInt, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IList unwrappedStrings, IList unwrappedCounts, IList unwrappedItems, IList wrappedColors, IList items, XmlNestedModel nestedModel, XmlNestedModel optionalNestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, IDictionary optionalRecordUnknown, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, IntFixedEnum? optionalFixedEnum, IntExtensibleEnum? optionalExtensibleEnum, IDictionary additionalBinaryDataProperties) + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string optionalString, int? optionalInt, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IList unwrappedStrings, IList unwrappedCounts, IList unwrappedItems, IList wrappedColors, IList items, XmlNestedModel nestedModel, XmlNestedModel optionalNestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, IDictionary optionalRecordUnknown, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, IntFixedEnum? optionalFixedEnum, IntExtensibleEnum? optionalExtensibleEnum, string label, int daysUsed, IList fooItems, XmlNestedModel anotherModel, IList modelsWithNamespaces, IList unwrappedModelsWithNamespaces, IDictionary additionalBinaryDataProperties) { Name = name; Age = age; @@ -129,6 +147,12 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin ExtensibleEnum = extensibleEnum; OptionalFixedEnum = optionalFixedEnum; OptionalExtensibleEnum = optionalExtensibleEnum; + Label = label; + DaysUsed = daysUsed; + FooItems = fooItems; + AnotherModel = anotherModel; + ModelsWithNamespaces = modelsWithNamespaces; + UnwrappedModelsWithNamespaces = unwrappedModelsWithNamespaces; _additionalBinaryDataProperties = additionalBinaryDataProperties; } @@ -258,5 +282,23 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin /// An optional extensible enum property. public IntExtensibleEnum? OptionalExtensibleEnum { get; } + + /// Gets the Label. + public string Label { get; } + + /// Gets the DaysUsed. + public int DaysUsed { get; } + + /// Gets the FooItems. + public IList FooItems { get; } + + /// Gets the AnotherModel. + public XmlNestedModel AnotherModel { get; } + + /// Gets the ModelsWithNamespaces. + public IList ModelsWithNamespaces { get; } + + /// Gets the UnwrappedModelsWithNamespaces. + public IList UnwrappedModelsWithNamespaces { get; } } } diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.Serialization.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.Serialization.cs new file mode 100644 index 00000000000..35865a54fae --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.Serialization.cs @@ -0,0 +1,139 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace SampleTypeSpec +{ + /// The XmlModelWithNamespace. + public partial class XmlModelWithNamespace : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal XmlModelWithNamespace() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlModelWithNamespace)} does not support writing '{format}' format."); + } + writer.WritePropertyName("foo"u8); + writer.WriteStringValue(Foo); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + XmlModelWithNamespace IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual XmlModelWithNamespace JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(XmlModelWithNamespace)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeXmlModelWithNamespace(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static XmlModelWithNamespace DeserializeXmlModelWithNamespace(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string foo = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("foo"u8)) + { + foo = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new XmlModelWithNamespace(foo, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(XmlModelWithNamespace)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + XmlModelWithNamespace IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlModelWithNamespace PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeXmlModelWithNamespace(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(XmlModelWithNamespace)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.cs new file mode 100644 index 00000000000..c3b9a6294ec --- /dev/null +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/Models/XmlModelWithNamespace.cs @@ -0,0 +1,35 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// The XmlModelWithNamespace. + public partial class XmlModelWithNamespace + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// + internal XmlModelWithNamespace(string foo) + { + Foo = foo; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal XmlModelWithNamespace(string foo, IDictionary additionalBinaryDataProperties) + { + Foo = foo; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Gets the Foo. + public string Foo { get; } + } +} diff --git a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs index 9ca34c32df1..8e41d4923f4 100644 --- a/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs +++ b/docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecModelFactory.cs @@ -270,8 +270,14 @@ public static AnotherDynamicModel AnotherDynamicModel(string bar = default) /// An extensible enum property. /// An optional fixed enum property. /// An optional extensible enum property. + /// + /// + /// + /// + /// + /// /// A new instance for mocking. - public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = default, bool enabled = default, float score = default, string optionalString = default, int? optionalInt = default, string nullableString = default, string id = default, int version = default, bool isActive = default, string originalName = default, string xmlIdentifier = default, string content = default, IEnumerable unwrappedStrings = default, IEnumerable unwrappedCounts = default, IEnumerable unwrappedItems = default, IEnumerable wrappedColors = default, IEnumerable items = default, XmlNestedModel nestedModel = default, XmlNestedModel optionalNestedModel = default, IDictionary metadata = default, DateTimeOffset createdAt = default, TimeSpan duration = default, BinaryData data = default, IDictionary optionalRecordUnknown = default, StringFixedEnum fixedEnum = default, StringExtensibleEnum extensibleEnum = default, IntFixedEnum? optionalFixedEnum = default, IntExtensibleEnum? optionalExtensibleEnum = default) + public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = default, bool enabled = default, float score = default, string optionalString = default, int? optionalInt = default, string nullableString = default, string id = default, int version = default, bool isActive = default, string originalName = default, string xmlIdentifier = default, string content = default, IEnumerable unwrappedStrings = default, IEnumerable unwrappedCounts = default, IEnumerable unwrappedItems = default, IEnumerable wrappedColors = default, IEnumerable items = default, XmlNestedModel nestedModel = default, XmlNestedModel optionalNestedModel = default, IDictionary metadata = default, DateTimeOffset createdAt = default, TimeSpan duration = default, BinaryData data = default, IDictionary optionalRecordUnknown = default, StringFixedEnum fixedEnum = default, StringExtensibleEnum extensibleEnum = default, IntFixedEnum? optionalFixedEnum = default, IntExtensibleEnum? optionalExtensibleEnum = default, string label = default, int daysUsed = default, IEnumerable fooItems = default, XmlNestedModel anotherModel = default, IEnumerable modelsWithNamespaces = default, IEnumerable unwrappedModelsWithNamespaces = default) { unwrappedStrings ??= new ChangeTrackingList(); unwrappedCounts ??= new ChangeTrackingList(); @@ -280,6 +286,9 @@ public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = items ??= new ChangeTrackingList(); metadata ??= new ChangeTrackingDictionary(); optionalRecordUnknown ??= new ChangeTrackingDictionary(); + fooItems ??= new ChangeTrackingList(); + modelsWithNamespaces ??= new ChangeTrackingList(); + unwrappedModelsWithNamespaces ??= new ChangeTrackingList(); return new XmlAdvancedModel( name, @@ -311,6 +320,12 @@ public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = extensibleEnum, optionalFixedEnum, optionalExtensibleEnum, + label, + daysUsed, + fooItems.ToList(), + anotherModel, + modelsWithNamespaces.ToList(), + unwrappedModelsWithNamespaces.ToList(), additionalBinaryDataProperties: null); } @@ -333,6 +348,14 @@ public static XmlNestedModel XmlNestedModel(string value = default, int nestedId return new XmlNestedModel(value, nestedId, additionalBinaryDataProperties: null); } + /// The XmlModelWithNamespace. + /// + /// A new instance for mocking. + public static XmlModelWithNamespace XmlModelWithNamespace(string foo = default) + { + return new XmlModelWithNamespace(foo, additionalBinaryDataProperties: null); + } + /// /// Base animal with discriminator /// Please note this is the abstract base class. The derived classes available for instantiation are: and . diff --git a/docs/samples/client/csharp/SampleService/main.tsp b/docs/samples/client/csharp/SampleService/main.tsp index 776307135b9..8005008cb63 100644 --- a/docs/samples/client/csharp/SampleService/main.tsp +++ b/docs/samples/client/csharp/SampleService/main.tsp @@ -311,6 +311,12 @@ model AnotherDynamicModel { bar: string; } +@nsDeclarations +enum XmlNamespaces { + ns1: "https://example.com/ns1", + ns2: "https://example.com/ns2", +} + @doc("An advanced XML model for testing various property types and XML features.") @Xml.name("AdvancedXmlModel") model XmlAdvancedModel { @@ -411,6 +417,24 @@ model XmlAdvancedModel { @doc("An optional extensible enum property") optionalExtensibleEnum?: IntExtensibleEnum; + + @attribute + @ns(XmlNamespaces.ns1) + label: string; + + @ns(XmlNamespaces.ns2) + daysUsed: int32; + + @ns("http://www.contoso.com/anotherbook.dtd", "foo") + fooItems: string[]; + + @ns("http://www.contoso.com/anothermodel.dtd", "bar") + anotherModel: XmlNestedModel; + + modelsWithNamespaces: XmlModelWithNamespace[]; + + @unwrapped + unwrappedModelsWithNamespaces: XmlModelWithNamespace[]; } @doc("A nested model for XML testing") @@ -437,6 +461,11 @@ model XmlItem { itemId: string; } +@ns("http://www.example.com/namespace", "ns1") +model XmlModelWithNamespace { + foo: string; +} + union DaysOfWeekExtensibleEnum { string, Monday: "Monday", @@ -731,6 +760,7 @@ model Plant { } @doc("Tree is a specific type of plant") +@usage(Usage.xml | Usage.output | Usage.json ) model Tree extends Plant { species: "tree"; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs index 52a770e8a6a..9237c316b1f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs @@ -6,10 +6,12 @@ using System.IO; using System.Linq; using System.Net; +using System.Text.Json; using System.Xml.Linq; using Microsoft.TypeSpec.Generator.ClientModel.Snippets; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Input.Extensions; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Providers; using Microsoft.TypeSpec.Generator.Snippets; @@ -23,10 +25,8 @@ public partial class MrwSerializationTypeDefinition { private readonly ParameterProvider _xElementDeserializationParam = new("element", $"The xml element to deserialize.", typeof(XElement)); private readonly ScopedApi _xmlElementParameterSnippet; + private const string ContentTypeHeader = "Content-Type"; - /// - /// Represents a property that can be deserialized from XML, categorized by its serialization type. - /// private record XmlPropertyInfo( string PropertyName, CSharpType PropertyType, @@ -35,13 +35,13 @@ private record XmlPropertyInfo( SerializationFormat SerializationFormat, IEnumerable SerializationAttributes); - /// - /// Categorized XML properties for deserialization. - /// + private record XmlNamespaceInfo(string Namespace, string VariableName, VariableExpression VariableExpression); + private record XmlPropertyCategories( List? AttributeProperties, List? ElementProperties, - XmlPropertyInfo? TextContentProperty); + XmlPropertyInfo? TextContentProperty, + Dictionary? Namespaces); internal MethodProvider BuildXmlDeserializationMethod() { @@ -142,6 +142,7 @@ private MethodBodyStatement[] BuildXmlDeserializationMethodBody() { new IfStatement(_xmlElementParameterSnippet.Equal(Null)) { valueKindEqualsNullReturn }, MethodBodyStatement.EmptyLine, + GetXmlNamespaceDeclarations(categorizedProperties.Namespaces), GetPropertyVariableDeclarations(), MethodBodyStatement.EmptyLine }; @@ -151,6 +152,7 @@ private MethodBodyStatement[] BuildXmlDeserializationMethodBody() statements.Add(CreateXmlDeserializeForEachStatement( _xmlElementParameterSnippet, categorizedProperties.AttributeProperties, + categorizedProperties.Namespaces, isAttributes: true)); statements.Add(MethodBodyStatement.EmptyLine); } @@ -160,6 +162,7 @@ private MethodBodyStatement[] BuildXmlDeserializationMethodBody() statements.Add(CreateXmlDeserializeForEachStatement( _xmlElementParameterSnippet, categorizedProperties.ElementProperties, + categorizedProperties.Namespaces, isAttributes: false)); } @@ -179,6 +182,7 @@ private XmlPropertyCategories CategorizeXmlProperties() List? attributeProperties = null; List? elementProperties = null; XmlPropertyInfo? textContentProperty = null; + Dictionary? namespaces = null; var parameters = SerializationConstructor.Signature.Parameters; @@ -208,6 +212,18 @@ private XmlPropertyCategories CategorizeXmlProperties() continue; } + // Collect unique namespaces + if (xmlWireInfo.Namespace != null) + { + namespaces ??= []; + CollectNamespace(propertyName, xmlWireInfo.Namespace, namespaces); + } + if (xmlWireInfo.ItemsNamespace != null) + { + namespaces ??= []; + CollectNamespace(propertyName, xmlWireInfo.ItemsNamespace, namespaces); + } + var serializationFormat = wireInfo?.SerializationFormat ?? SerializationFormat.Default; var propertyInfo = new XmlPropertyInfo(propertyName, propertyType, propertyExpression, xmlWireInfo, serializationFormat, serializationAttributes); @@ -226,35 +242,44 @@ private XmlPropertyCategories CategorizeXmlProperties() (elementProperties ??= []).Add(propertyInfo); } - return new XmlPropertyCategories(attributeProperties, elementProperties, textContentProperty); + return new XmlPropertyCategories(attributeProperties, elementProperties, textContentProperty, namespaces); } private ForEachStatement CreateXmlDeserializeForEachStatement( ScopedApi elementParameter, List properties, + Dictionary? namespaces, bool isAttributes) { return isAttributes switch { true => new ForEachStatement("attr", elementParameter.Attributes(), out var attr) { - CreateXmlDeserializeAttributeStatements(attr.As(), properties) + CreateXmlDeserializeAttributeStatements(attr.As(), properties, namespaces) }, false => new ForEachStatement("child", elementParameter.Elements(), out var child) { - CreateXmlDeserializeElementStatements(child.As(), properties) + CreateXmlDeserializeElementStatements(child.As(), properties, namespaces) } }; } private MethodBodyStatement CreateXmlDeserializeElementStatements( ScopedApi childElement, - List elementProperties) + List elementProperties, + Dictionary? namespaces) { var statements = new List(); var localNameVariable = new VariableExpression(typeof(string), "localName"); + var nsVariable = new VariableExpression(typeof(XNamespace), "ns"); statements.Add(Declare(localNameVariable, childElement.GetLocalName())); + if (namespaces?.Count > 0) + { + statements.AddRange( + Declare(nsVariable, childElement.Property("Name").Property("Namespace").As()), + MethodBodyStatement.EmptyLine); + } foreach (var prop in elementProperties) { @@ -272,10 +297,18 @@ private MethodBodyStatement CreateXmlDeserializeElementStatements( prop.PropertyType, prop.PropertyExpression, prop.XmlWireInfo, - prop.SerializationFormat); + prop.SerializationFormat, + namespaces); + } + + // Build condition: check localName and optionally namespace + ScopedApi condition = localNameVariable.Equal(Literal(prop.XmlWireInfo.Name)); + if (prop.XmlWireInfo.Namespace != null && namespaces != null && namespaces.TryGetValue(prop.XmlWireInfo.Namespace.Namespace, out var nsInfo)) + { + condition = condition.And(nsVariable.Equal(nsInfo.VariableExpression)); } - var checkIfLocalNameEquals = new IfStatement(localNameVariable.Equal(Literal(prop.XmlWireInfo.Name))) + var checkIfLocalNameEquals = new IfStatement(condition) { deserializationStatement, Continue @@ -318,11 +351,12 @@ private MethodBodyStatement CreateXmlDeserializePropertyAssignment( CSharpType propertyType, VariableExpression propertyExpression, XmlWireInformation xmlWireInfo, - SerializationFormat serializationFormat) + SerializationFormat serializationFormat, + Dictionary? namespaces = null) { if (propertyType.IsList || propertyType.IsArray) { - return CreateXmlDeserializeListAssignment(childElement, propertyType, propertyExpression, xmlWireInfo, serializationFormat); + return CreateXmlDeserializeListAssignment(childElement, propertyType, propertyExpression, xmlWireInfo, serializationFormat, namespaces); } if (propertyType.IsDictionary) @@ -339,7 +373,8 @@ private MethodBodyStatement CreateXmlDeserializeListAssignment( CSharpType listType, VariableExpression listExpression, XmlWireInformation xmlWireInfo, - SerializationFormat serializationFormat) + SerializationFormat serializationFormat, + Dictionary? namespaces = null) { var elementType = listType.ElementType; if (xmlWireInfo.Unwrapped == true) @@ -358,7 +393,19 @@ private MethodBodyStatement CreateXmlDeserializeListAssignment( { var itemsName = xmlWireInfo.ItemsName; var arrayDeclaration = Declare("array", New.List(elementType), out var listVariable); - var foreachStatement = ForEachStatement.Create("e", childElement.Elements(Literal(itemsName)), out ScopedApi item) + + // Build element name expression - with namespace if available + ValueExpression elementNameExpression; + if (xmlWireInfo.ItemsNamespace != null && namespaces != null && namespaces.TryGetValue(xmlWireInfo.ItemsNamespace.Namespace, out var nsInfo)) + { + elementNameExpression = new BinaryOperatorExpression("+", nsInfo.VariableExpression, Literal(itemsName)).As(); + } + else + { + elementNameExpression = Literal(itemsName); + } + + var foreachStatement = ForEachStatement.Create("e", childElement.Elements(elementNameExpression), out ScopedApi item) .Add(new MethodBodyStatement[] { DeserializeXmlValue(item, elementType, serializationFormat, out var deserializedItem), @@ -506,13 +553,23 @@ private static ValueExpression CreateXmlDeserializePrimitiveExpression( private MethodBodyStatement CreateXmlDeserializeAttributeStatements( ScopedApi attrVariable, - List attributeProperties) + List attributeProperties, + Dictionary? namespaces) { + var hasNamespacedAttributes = attributeProperties.Any(p => p.XmlWireInfo.Namespace != null); var statements = new List { Declare("localName", typeof(string), attrVariable.GetLocalName(), out var localNameVar) }; + VariableExpression? nsVar = null; + if (hasNamespacedAttributes) + { + statements.AddRange( + Declare("ns", typeof(XNamespace), attrVariable.Name().Namespace(), out nsVar), + MethodBodyStatement.EmptyLine); + } + foreach (var prop in attributeProperties) { MethodBodyStatement deserializationStatement = GetXmlDeserializationHookStatement( @@ -528,7 +585,14 @@ private MethodBodyStatement CreateXmlDeserializeAttributeStatements( deserializationStatement = prop.PropertyExpression.Assign(deserializedValue).Terminate(); } - var checkIfLocalNameEquals = new IfStatement(localNameVar.Equal(Literal(prop.XmlWireInfo.Name))) + ScopedApi condition = localNameVar.Equal(Literal(prop.XmlWireInfo.Name)); + if (prop.XmlWireInfo.Namespace != null && namespaces != null && nsVar != null) + { + var nsInfo = namespaces[prop.XmlWireInfo.Namespace.Namespace]; + condition = condition.And(nsVar.Equal(nsInfo.VariableExpression)); + } + + var checkIfLocalNameEquals = new IfStatement(condition) { deserializationStatement, Continue @@ -595,5 +659,89 @@ private MethodProvider BuildXmlExplicitFromClientResult() methodBody, this); } + + private MethodProvider BuildJsonAndXmlExplicitFromClientResult() + { + var result = new ParameterProvider( + ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi.ResponseParameterName, + $"The {ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi.ClientResponseType:C} to deserialize the {Type:C} from.", + ScmCodeModelGenerator.Instance.TypeFactory.ClientResponseApi.ClientResponseType); + var modifiers = MethodSignatureModifiers.Public | MethodSignatureModifiers.Static | + MethodSignatureModifiers.Explicit | MethodSignatureModifiers.Operator; + + var response = result.ToApi(); + MethodBodyStatement responseDeclaration; + ScopedApi tryGetContentType; + ScopedApi? contentTypeVar; + + if (response.Original == response.GetRawResponse().Original) + { + responseDeclaration = MethodBodyStatement.Empty; + tryGetContentType = result.ToApi().TryGetHeader(ContentTypeHeader, out contentTypeVar); + } + else + { + responseDeclaration = UsingDeclare("response", ScmCodeModelGenerator.Instance.TypeFactory.HttpResponseApi.HttpResponseType, response.GetRawResponse(), out var responseVar); + response = responseVar.ToApi(); + tryGetContentType = responseVar.ToApi().TryGetHeader(ContentTypeHeader, out contentTypeVar); + } + + var startsWithJson = contentTypeVar!.StartsWith(Literal("application/json"), StringComparison.OrdinalIgnoreCase); + var isJsonCondition = tryGetContentType.And(startsWithJson); + var jsonDeserializationBlock = new MethodBodyStatement[] + { + UsingDeclare("document", typeof(JsonDocument), response.Property(nameof(HttpResponseApi.Content)).As().Parse(ModelSerializationExtensionsSnippets.JsonDocumentOptions), out var docVariable), + Return(GetDeserializationMethodInvocationForType(_model, docVariable.As().RootElement())) + }; + + var xmlDeserialization = new MethodBodyStatement[] + { + UsingDeclare("stream", typeof(Stream), response.Property(nameof(HttpResponseApi.ContentStream)), out var streamVar), + new IfStatement(streamVar.Equal(Null)) { Return(Default) }, + MethodBodyStatement.EmptyLine, + Return(GetDeserializationMethodInvocationForType(_model, XElementSnippets.Load(streamVar.As(), XmlLinqSnippets.PreserveWhitespace))) + }; + + MethodBodyStatement[] methodBody = + [ + responseDeclaration, + MethodBodyStatement.EmptyLine, + new IfStatement(isJsonCondition) { jsonDeserializationBlock }, + MethodBodyStatement.EmptyLine, + xmlDeserialization + ]; + + return new MethodProvider( + new MethodSignature(Type.Name, null, modifiers, Type, null, [result]), + methodBody, + this); + } + + private static void CollectNamespace(string propertyName, XmlWireNamespaceOptions nsOptions, Dictionary namespaces) + { + if (!namespaces.ContainsKey(nsOptions.Namespace)) + { + var variableName = $"{propertyName}Ns".ToVariableName(); + var variableExpression = new VariableExpression(typeof(XNamespace), variableName); + namespaces[nsOptions.Namespace] = new XmlNamespaceInfo(nsOptions.Namespace, variableName, variableExpression); + } + } + + private static MethodBodyStatement GetXmlNamespaceDeclarations(Dictionary? namespaces) + { + if (namespaces == null || namespaces.Count == 0) + { + return MethodBodyStatement.Empty; + } + + var statements = new List(); + foreach (var ns in namespaces.Values) + { + statements.Add(Declare(ns.VariableExpression, Literal(ns.Namespace))); + } + + statements.Add(MethodBodyStatement.EmptyLine); + return statements; + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs index e1231ebfa19..7c1f55bb3b5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs @@ -182,7 +182,7 @@ protected override MethodProvider[] BuildMethods() { if (ScmCodeModelGenerator.Instance.TypeFactory.RootOutputModels.Contains(_inputModel)) { - methods.Add(GetExplicitFromClientResultMethod(_supportsXml)); + methods.Add(GetExplicitFromClientResultMethod(_supportsJson, _supportsXml)); } } } @@ -239,8 +239,13 @@ protected override MethodProvider[] BuildMethods() return [.. methods]; } - private MethodProvider GetExplicitFromClientResultMethod(bool supportsXml) + private MethodProvider GetExplicitFromClientResultMethod(bool supportsJson, bool supportsXml) { + if (supportsJson && supportsXml) + { + return BuildJsonAndXmlExplicitFromClientResult(); + } + if (supportsXml) { return BuildXmlExplicitFromClientResult(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs index cb4a0565191..137a2d82401 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/XElementSnippets.cs @@ -34,8 +34,9 @@ public static ScopedApi Value(this ScopedApi element) public static ScopedApi> Attributes(this ScopedApi element) => element.Invoke(nameof(XElement.Attributes)).As>(); - public static ScopedApi Name(this ScopedApi attribute) - => attribute.Property(nameof(XAttribute.Name)).As(); + + public static ScopedApi Name(this ScopedApi attribute) + => attribute.Property(nameof(XAttribute.Name)).As(); public static ScopedApi GetLocalName(this ScopedApi attribute) => Name(attribute).Property(nameof(XName.LocalName)).As(); @@ -51,5 +52,8 @@ public static ScopedApi GetTimeSpan(this ScopedApi element, public static ScopedApi GetBytesFromBase64(this ScopedApi element, string? format) => ModelSerializationExtensionsSnippets.GetBytesFromBase64(element, format).As(); + + public static ScopedApi Namespace(this ScopedApi name) + => name.Property(nameof(XName.Namespace)).As(); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForJsonAndXmlModel.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForJsonAndXmlModel.cs new file mode 100644 index 00000000000..e623033da8b --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForJsonAndXmlModel.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.IO; +using System.Text.Json; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class TestModel + { + public static explicit operator TestModel(global::System.ClientModel.ClientResult result) + { + using global::System.ClientModel.Primitives.PipelineResponse response = result.GetRawResponse(); + + if ((response.Headers.TryGetValue("Content-Type", out string value) && value.StartsWith("application/json", global::System.StringComparison.OrdinalIgnoreCase))) + { + using global::System.Text.Json.JsonDocument document = global::System.Text.Json.JsonDocument.Parse(response.Content, global::Sample.ModelSerializationExtensions.JsonDocumentOptions); + return global::Sample.Models.TestModel.DeserializeTestModel(document.RootElement, global::Sample.ModelSerializationExtensions.WireOptions); + } + + using global::System.IO.Stream stream = response.ContentStream; + if ((stream == null)) + { + return default; + } + + return global::Sample.Models.TestModel.DeserializeTestModel(global::System.Xml.Linq.XElement.Load(stream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), global::Sample.ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForXmlOnlyModel.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForXmlOnlyModel.cs new file mode 100644 index 00000000000..a16bbfeea64 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/ExplicitOperatorForXmlOnlyModel.cs @@ -0,0 +1,27 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.IO; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class TestXmlModel + { + public static explicit operator TestXmlModel(global::System.ClientModel.ClientResult result) + { + using global::System.ClientModel.Primitives.PipelineResponse response = result.GetRawResponse(); + using global::System.IO.Stream stream = response.ContentStream; + if ((stream == null)) + { + return default; + } + + return global::Sample.Models.TestXmlModel.DeserializeTestXmlModel(global::System.Xml.Linq.XElement.Load(stream, global::System.Xml.Linq.LoadOptions.PreserveWhitespace), global::Sample.ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeWithNamespace.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeWithNamespace.cs new file mode 100644 index 00000000000..4f6df6e0015 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesAttributeWithNamespace.cs @@ -0,0 +1,60 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class TestXmlModel + { + internal static global::Sample.Models.TestXmlModel DeserializeTestXmlModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + global::System.Xml.Linq.XNamespace labelNs = "https://example.com/ns1"; + + string id = default; + string label = default; + string name = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var attr in element.Attributes()) + { + string localName = attr.Name.LocalName; + global::System.Xml.Linq.XNamespace ns = attr.Name.Namespace; + + if ((localName == "id")) + { + id = ((string)attr); + continue; + } + if (((localName == "label") && (ns == labelNs))) + { + label = ((string)attr); + continue; + } + } + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + global::System.Xml.Linq.XNamespace ns = child.Name.Namespace; + + if ((localName == "name")) + { + name = ((string)child); + continue; + } + } + return new global::Sample.Models.TestXmlModel(id, label, name, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesElementWithNamespace.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesElementWithNamespace.cs new file mode 100644 index 00000000000..2b1beef65fa --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/TestData/XmlDeserializationTests/XmlDeserializationHandlesElementWithNamespace.cs @@ -0,0 +1,47 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Xml.Linq; +using Sample.Models; + +namespace Sample +{ + public partial class TestXmlModel + { + internal static global::Sample.Models.TestXmlModel DeserializeTestXmlModel(global::System.Xml.Linq.XElement element, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) + { + if ((element == null)) + { + return null; + } + + global::System.Xml.Linq.XNamespace categoryNs = "https://example.com/ns1"; + + string id = default; + string category = default; + global::System.Collections.Generic.IDictionary additionalBinaryDataProperties = new global::Sample.ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + global::System.Xml.Linq.XNamespace ns = child.Name.Namespace; + + if ((localName == "id")) + { + id = ((string)child); + continue; + } + if (((localName == "category") && (ns == categoryNs))) + { + category = ((string)child); + continue; + } + } + return new global::Sample.Models.TestXmlModel(id, category, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs index 1026d88a497..cc8204bd3d2 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlDeserializationTests.cs @@ -418,5 +418,104 @@ public async Task XmlDeserializationHandlesAttributeProperties() var file = writer.Write(); Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); } + + [Test] + public async Task XmlDeserializationHandlesAttributeWithNamespace() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("id", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("id", attribute: true)), + InputFactory.Property("label", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("label", attribute: true, @namespace: new("https://example.com/ns1", "ns1"))), + InputFactory.Property("name", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("name")) + ]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "TestXmlModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serializationProvider, + name => name == "DeserializeTestXmlModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public async Task XmlDeserializationHandlesElementWithNamespace() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("id", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("id")), + InputFactory.Property("category", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("category", @namespace: new("https://example.com/ns1", "ns1"))) + ]); + var mockGenerator = await MockHelpers.LoadMockGeneratorAsync( + inputModels: () => [inputModel]); + + var modelProvider = mockGenerator.Object.OutputLibrary.TypeProviders.Single(t => t is ModelProvider && t.Name == "TestXmlModel"); + var serializationProvider = modelProvider.SerializationProviders.Single(t => t is MrwSerializationTypeDefinition); + Assert.IsNotNull(serializationProvider); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serializationProvider, + name => name == "DeserializeTestXmlModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public void ExplicitOperatorForXmlOnlyModel() + { + var inputModel = InputFactory.Model( + "TestXmlModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Output | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("name", InputPrimitiveType.String, isRequired: true, xmlSerializationOptions: new("name")) + ]); + + var (_, serialization) = MrwSerializationTypeDefinitionTests.CreateModelAndSerialization(inputModel); + var method = serialization.Methods.FirstOrDefault(m => m.Signature.Name == "TestXmlModel"); + Assert.IsNotNull(method); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serialization, + name => name == "TestXmlModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } + + [Test] + public void ExplicitOperatorForJsonAndXmlModel() + { + var inputModel = InputFactory.Model( + "TestModel", + usage: InputModelTypeUsage.Input | InputModelTypeUsage.Output | InputModelTypeUsage.Json | InputModelTypeUsage.Xml, + properties: + [ + InputFactory.Property("name", InputPrimitiveType.String, isRequired: true, wireName: "name", xmlSerializationOptions: new("name")) + ]); + + var (_, serialization) = MrwSerializationTypeDefinitionTests.CreateModelAndSerialization(inputModel); + var method = serialization.Methods.FirstOrDefault(m => m.Signature.Name == "TestModel"); + Assert.IsNotNull(method); + + var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( + serialization, + name => name == "TestModel")); + + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/StringSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/StringSnippets.cs index af77b445581..41a9b42a01e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/StringSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/StringSnippets.cs @@ -38,5 +38,8 @@ public static ValueExpression ToCharArray(this ScopedApi stringExpressio public static ScopedApi Index(this ScopedApi stringExpression, ValueExpression index) => new IndexableExpression(stringExpression)[index].As(); + + public static ScopedApi StartsWith(this ScopedApi stringExpression, ValueExpression value, StringComparison comparisonType) + => stringExpression.Invoke(nameof(string.StartsWith), [value, FrameworkEnumValue(comparisonType)]).As(); } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs index 2833e195475..42abf51b3a8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Plant.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.IO; +using System.Text.Json; using System.Xml.Linq; namespace SampleTypeSpec @@ -17,7 +18,7 @@ namespace SampleTypeSpec /// Please note this is the abstract base class. The derived classes available for instantiation are: . /// [PersistableModelProxy(typeof(UnknownPlant))] - public abstract partial class Plant + public abstract partial class Plant : IJsonModel { /// Initializes a new instance of for deserialization. internal Plant() @@ -31,6 +32,11 @@ protected virtual Plant PersistableModelCreateCore(BinaryData data, ModelReaderW string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePlant(document.RootElement, options); + } case "X": using (Stream dataStream = data.ToStream()) { @@ -41,6 +47,106 @@ protected virtual Plant PersistableModelCreateCore(BinaryData data, ModelReaderW } } + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support writing '{format}' format."); + } + writer.WritePropertyName("species"u8); + writer.WriteStringValue(Species); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("height"u8); + writer.WriteNumberValue(Height); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + Plant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual Plant JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlant(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Plant DeserializePlant(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("species"u8, out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "tree": + return Tree.DeserializeTree(element, options); + } + } + return UnknownPlant.DeserializeUnknownPlant(element, options); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(Plant)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Plant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + /// The xml element to deserialize. /// The client options for reading and writing models. internal static Plant DeserializePlant(XElement element, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs index 1e4f6317497..2442bc81805 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs @@ -39,6 +39,7 @@ namespace SampleTypeSpec [ModelReaderWriterBuildable(typeof(UnknownPlant))] [ModelReaderWriterBuildable(typeof(XmlAdvancedModel))] [ModelReaderWriterBuildable(typeof(XmlItem))] + [ModelReaderWriterBuildable(typeof(XmlModelWithNamespace))] [ModelReaderWriterBuildable(typeof(XmlNestedModel))] public partial class SampleTypeSpecContext : ModelReaderWriterContext { diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs index 43988081548..eb030a63d65 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/Tree.Serialization.cs @@ -10,12 +10,13 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.IO; +using System.Text.Json; using System.Xml.Linq; namespace SampleTypeSpec { /// Tree is a specific type of plant. - public partial class Tree : Plant + public partial class Tree : Plant, IJsonModel { /// Initializes a new instance of for deserialization. internal Tree() @@ -29,6 +30,11 @@ protected override Plant PersistableModelCreateCore(BinaryData data, ModelReader string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeTree(document.RootElement, options); + } case "X": using (Stream dataStream = data.ToStream()) { @@ -43,6 +49,13 @@ protected override Plant PersistableModelCreateCore(BinaryData data, ModelReader public static explicit operator Tree(ClientResult result) { using PipelineResponse response = result.GetRawResponse(); + + if (response.Headers.TryGetValue("Content-Type", out string value) && value.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTree(document.RootElement, ModelSerializationExtensions.WireOptions); + } + using Stream stream = response.ContentStream; if (stream == null) { @@ -52,6 +65,112 @@ public static explicit operator Tree(ClientResult result) return DeserializeTree(XElement.Load(stream, LoadOptions.PreserveWhitespace), ModelSerializationExtensions.WireOptions); } + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Tree)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("age"u8); + writer.WriteNumberValue(Age); + } + + /// The JSON reader. + /// The client options for reading and writing models. + Tree IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (Tree)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override Plant JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Tree)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTree(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Tree DeserializeTree(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string species = "tree"; + string id = default; + int height = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + int age = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("species"u8)) + { + species = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("height"u8)) + { + height = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("age"u8)) + { + age = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new Tree(species, id, height, additionalBinaryDataProperties, age); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(Tree)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Tree IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (Tree)PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + /// The xml element to deserialize. /// The client options for reading and writing models. internal static Tree DeserializeTree(XElement element, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs index cfaa979b6ce..cd2701e118b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/UnknownPlant.Serialization.cs @@ -9,11 +9,12 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.IO; +using System.Text.Json; using System.Xml.Linq; namespace SampleTypeSpec { - internal partial class UnknownPlant : Plant + internal partial class UnknownPlant : Plant, IJsonModel { /// Initializes a new instance of for deserialization. internal UnknownPlant() @@ -27,6 +28,11 @@ protected override Plant PersistableModelCreateCore(BinaryData data, ModelReader string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePlant(document.RootElement, options); + } case "X": using (Stream dataStream = data.ToStream()) { @@ -37,6 +43,104 @@ protected override Plant PersistableModelCreateCore(BinaryData data, ModelReader } } + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + } + + /// The JSON reader. + /// The client options for reading and writing models. + Plant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override Plant JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Plant)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlant(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UnknownPlant DeserializeUnknownPlant(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string species = "unknown"; + string id = default; + int height = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("species"u8)) + { + species = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("height"u8)) + { + height = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new UnknownPlant(species, id, height, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, SampleTypeSpecContext.Default); + default: + throw new FormatException($"The model {nameof(Plant)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Plant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + /// The xml element to deserialize. /// The client options for reading and writing models. internal static UnknownPlant DeserializeUnknownPlant(XElement element, ModelReaderWriterOptions options) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs index 8d815eebdda..97c0b3a07bb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.Serialization.cs @@ -61,6 +61,12 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M return null; } + XNamespace labelNs = "https://example.com/ns1"; + XNamespace daysUsedNs = "https://example.com/ns2"; + XNamespace fooItemsNs = "http://www.contoso.com/anotherbook.dtd"; + XNamespace anotherModelNs = "http://www.contoso.com/anothermodel.dtd"; + XNamespace modelsWithNamespacesNs = "http://www.example.com/namespace"; + string name = default; int age = default; bool enabled = default; @@ -90,11 +96,19 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M StringExtensibleEnum extensibleEnum = default; IntFixedEnum? optionalFixedEnum = default; IntExtensibleEnum? optionalExtensibleEnum = default; + string label = default; + int daysUsed = default; + IList fooItems = default; + XmlNestedModel anotherModel = default; + IList modelsWithNamespaces = default; + IList unwrappedModelsWithNamespaces = default; IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); foreach (var attr in element.Attributes()) { string localName = attr.Name.LocalName; + XNamespace ns = attr.Name.Namespace; + if (localName == "id") { id = (string)attr; @@ -115,11 +129,18 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M xmlIdentifier = (string)attr; continue; } + if (localName == "label" && ns == labelNs) + { + label = (string)attr; + continue; + } } foreach (var child in element.Elements()) { string localName = child.Name.LocalName; + XNamespace ns = child.Name.Namespace; + if (localName == "name") { name = (string)child; @@ -272,6 +293,45 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M optionalExtensibleEnum = new IntExtensibleEnum((int)child); continue; } + if (localName == "daysUsed" && ns == daysUsedNs) + { + daysUsed = (int)child; + continue; + } + if (localName == "fooItems" && ns == fooItemsNs) + { + List array = new List(); + foreach (var e in child.Elements("string")) + { + array.Add((string)e); + } + fooItems = array; + continue; + } + if (localName == "anotherModel" && ns == anotherModelNs) + { + anotherModel = XmlNestedModel.DeserializeXmlNestedModel(child, options); + continue; + } + if (localName == "modelsWithNamespaces") + { + List array = new List(); + foreach (var e in child.Elements(modelsWithNamespacesNs + "XmlModelWithNamespace")) + { + array.Add(XmlModelWithNamespace.DeserializeXmlModelWithNamespace(e, options)); + } + modelsWithNamespaces = array; + continue; + } + if (localName == "unwrappedModelsWithNamespaces") + { + if (unwrappedModelsWithNamespaces == null) + { + unwrappedModelsWithNamespaces = new List(); + } + unwrappedModelsWithNamespaces.Add(XmlModelWithNamespace.DeserializeXmlModelWithNamespace(child, options)); + continue; + } } content = element.Value; @@ -305,6 +365,12 @@ internal static XmlAdvancedModel DeserializeXmlAdvancedModel(XElement element, M extensibleEnum, optionalFixedEnum, optionalExtensibleEnum, + label, + daysUsed, + fooItems, + anotherModel, + modelsWithNamespaces, + unwrappedModelsWithNamespaces, additionalBinaryDataProperties); } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs index bc544f69e6e..282f28a978b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlAdvancedModel.cs @@ -42,7 +42,13 @@ public partial class XmlAdvancedModel /// A bytes property. /// A fixed enum property. /// An extensible enum property. - internal XmlAdvancedModel(string name, int age, bool enabled, float score, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IEnumerable unwrappedStrings, IEnumerable unwrappedCounts, IEnumerable unwrappedItems, IEnumerable wrappedColors, IEnumerable items, XmlNestedModel nestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum) + /// + /// + /// + /// + /// + /// + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IEnumerable unwrappedStrings, IEnumerable unwrappedCounts, IEnumerable unwrappedItems, IEnumerable wrappedColors, IEnumerable items, XmlNestedModel nestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, string label, int daysUsed, IEnumerable fooItems, XmlNestedModel anotherModel, IEnumerable modelsWithNamespaces, IEnumerable unwrappedModelsWithNamespaces) { Name = name; Age = age; @@ -68,6 +74,12 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin OptionalRecordUnknown = new ChangeTrackingDictionary(); FixedEnum = fixedEnum; ExtensibleEnum = extensibleEnum; + Label = label; + DaysUsed = daysUsed; + FooItems = fooItems.ToList(); + AnotherModel = anotherModel; + ModelsWithNamespaces = modelsWithNamespaces.ToList(); + UnwrappedModelsWithNamespaces = unwrappedModelsWithNamespaces.ToList(); } /// Initializes a new instance of . @@ -100,8 +112,14 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin /// An extensible enum property. /// An optional fixed enum property. /// An optional extensible enum property. + /// + /// + /// + /// + /// + /// /// Keeps track of any properties unknown to the library. - internal XmlAdvancedModel(string name, int age, bool enabled, float score, string optionalString, int? optionalInt, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IList unwrappedStrings, IList unwrappedCounts, IList unwrappedItems, IList wrappedColors, IList items, XmlNestedModel nestedModel, XmlNestedModel optionalNestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, IDictionary optionalRecordUnknown, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, IntFixedEnum? optionalFixedEnum, IntExtensibleEnum? optionalExtensibleEnum, IDictionary additionalBinaryDataProperties) + internal XmlAdvancedModel(string name, int age, bool enabled, float score, string optionalString, int? optionalInt, string nullableString, string id, int version, bool isActive, string originalName, string xmlIdentifier, string content, IList unwrappedStrings, IList unwrappedCounts, IList unwrappedItems, IList wrappedColors, IList items, XmlNestedModel nestedModel, XmlNestedModel optionalNestedModel, IDictionary metadata, DateTimeOffset createdAt, TimeSpan duration, BinaryData data, IDictionary optionalRecordUnknown, StringFixedEnum fixedEnum, StringExtensibleEnum extensibleEnum, IntFixedEnum? optionalFixedEnum, IntExtensibleEnum? optionalExtensibleEnum, string label, int daysUsed, IList fooItems, XmlNestedModel anotherModel, IList modelsWithNamespaces, IList unwrappedModelsWithNamespaces, IDictionary additionalBinaryDataProperties) { Name = name; Age = age; @@ -132,6 +150,12 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin ExtensibleEnum = extensibleEnum; OptionalFixedEnum = optionalFixedEnum; OptionalExtensibleEnum = optionalExtensibleEnum; + Label = label; + DaysUsed = daysUsed; + FooItems = fooItems; + AnotherModel = anotherModel; + ModelsWithNamespaces = modelsWithNamespaces; + UnwrappedModelsWithNamespaces = unwrappedModelsWithNamespaces; _additionalBinaryDataProperties = additionalBinaryDataProperties; } @@ -261,5 +285,23 @@ internal XmlAdvancedModel(string name, int age, bool enabled, float score, strin /// An optional extensible enum property. public IntExtensibleEnum? OptionalExtensibleEnum { get; } + + /// Gets the Label. + public string Label { get; } + + /// Gets the DaysUsed. + public int DaysUsed { get; } + + /// Gets the FooItems. + public IList FooItems { get; } + + /// Gets the AnotherModel. + public XmlNestedModel AnotherModel { get; } + + /// Gets the ModelsWithNamespaces. + public IList ModelsWithNamespaces { get; } + + /// Gets the UnwrappedModelsWithNamespaces. + public IList UnwrappedModelsWithNamespaces { get; } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.Serialization.cs new file mode 100644 index 00000000000..0ee92b5fe7a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; + +namespace SampleTypeSpec +{ + /// The XmlModelWithNamespace. + public partial class XmlModelWithNamespace + { + /// Initializes a new instance of for deserialization. + internal XmlModelWithNamespace() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual XmlModelWithNamespace PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "X": + using (Stream dataStream = data.ToStream()) + { + return DeserializeXmlModelWithNamespace(XElement.Load(dataStream, LoadOptions.PreserveWhitespace), options); + } + default: + throw new FormatException($"The model {nameof(XmlModelWithNamespace)} does not support reading '{options.Format}' format."); + } + } + + /// The xml element to deserialize. + /// The client options for reading and writing models. + internal static XmlModelWithNamespace DeserializeXmlModelWithNamespace(XElement element, ModelReaderWriterOptions options) + { + if (element == null) + { + return null; + } + + string foo = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + + foreach (var child in element.Elements()) + { + string localName = child.Name.LocalName; + if (localName == "foo") + { + foo = (string)child; + continue; + } + } + return new XmlModelWithNamespace(foo, additionalBinaryDataProperties); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.cs new file mode 100644 index 00000000000..a8e4fa287d3 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/XmlModelWithNamespace.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace SampleTypeSpec +{ + /// The XmlModelWithNamespace. + public partial class XmlModelWithNamespace + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// + internal XmlModelWithNamespace(string foo) + { + Foo = foo; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal XmlModelWithNamespace(string foo, IDictionary additionalBinaryDataProperties) + { + Foo = foo; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Gets the Foo. + public string Foo { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs index 5c9c1b8aaf4..fe8d64f4ae9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/PlantOperations.RestClient.cs @@ -14,7 +14,7 @@ public partial class PlantOperations { private static PipelineMessageClassifier _pipelineMessageClassifier200; - private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); internal PipelineMessage CreateGetTreeRequest(RequestOptions options) { diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs index a696916968d..5a3ec6dc225 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecModelFactory.cs @@ -266,8 +266,14 @@ public static AnotherDynamicModel AnotherDynamicModel(string bar = default) /// An extensible enum property. /// An optional fixed enum property. /// An optional extensible enum property. + /// + /// + /// + /// + /// + /// /// A new instance for mocking. - public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = default, bool enabled = default, float score = default, string optionalString = default, int? optionalInt = default, string nullableString = default, string id = default, int version = default, bool isActive = default, string originalName = default, string xmlIdentifier = default, string content = default, IEnumerable unwrappedStrings = default, IEnumerable unwrappedCounts = default, IEnumerable unwrappedItems = default, IEnumerable wrappedColors = default, IEnumerable items = default, XmlNestedModel nestedModel = default, XmlNestedModel optionalNestedModel = default, IDictionary metadata = default, DateTimeOffset createdAt = default, TimeSpan duration = default, BinaryData data = default, IDictionary optionalRecordUnknown = default, StringFixedEnum fixedEnum = default, StringExtensibleEnum extensibleEnum = default, IntFixedEnum? optionalFixedEnum = default, IntExtensibleEnum? optionalExtensibleEnum = default) + public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = default, bool enabled = default, float score = default, string optionalString = default, int? optionalInt = default, string nullableString = default, string id = default, int version = default, bool isActive = default, string originalName = default, string xmlIdentifier = default, string content = default, IEnumerable unwrappedStrings = default, IEnumerable unwrappedCounts = default, IEnumerable unwrappedItems = default, IEnumerable wrappedColors = default, IEnumerable items = default, XmlNestedModel nestedModel = default, XmlNestedModel optionalNestedModel = default, IDictionary metadata = default, DateTimeOffset createdAt = default, TimeSpan duration = default, BinaryData data = default, IDictionary optionalRecordUnknown = default, StringFixedEnum fixedEnum = default, StringExtensibleEnum extensibleEnum = default, IntFixedEnum? optionalFixedEnum = default, IntExtensibleEnum? optionalExtensibleEnum = default, string label = default, int daysUsed = default, IEnumerable fooItems = default, XmlNestedModel anotherModel = default, IEnumerable modelsWithNamespaces = default, IEnumerable unwrappedModelsWithNamespaces = default) { unwrappedStrings ??= new ChangeTrackingList(); unwrappedCounts ??= new ChangeTrackingList(); @@ -276,6 +282,9 @@ public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = items ??= new ChangeTrackingList(); metadata ??= new ChangeTrackingDictionary(); optionalRecordUnknown ??= new ChangeTrackingDictionary(); + fooItems ??= new ChangeTrackingList(); + modelsWithNamespaces ??= new ChangeTrackingList(); + unwrappedModelsWithNamespaces ??= new ChangeTrackingList(); return new XmlAdvancedModel( name, @@ -307,6 +316,12 @@ public static XmlAdvancedModel XmlAdvancedModel(string name = default, int age = extensibleEnum, optionalFixedEnum, optionalExtensibleEnum, + label, + daysUsed, + fooItems.ToList(), + anotherModel, + modelsWithNamespaces.ToList(), + unwrappedModelsWithNamespaces.ToList(), additionalBinaryDataProperties: null); } @@ -329,6 +344,14 @@ public static XmlNestedModel XmlNestedModel(string value = default, int nestedId return new XmlNestedModel(value, nestedId, additionalBinaryDataProperties: null); } + /// The XmlModelWithNamespace. + /// + /// A new instance for mocking. + public static XmlModelWithNamespace XmlModelWithNamespace(string foo = default) + { + return new XmlModelWithNamespace(foo, additionalBinaryDataProperties: null); + } + /// /// Base animal with discriminator /// Please note this is the abstract base class. The derived classes available for instantiation are: and . diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json index 3e91444def8..c326d1c92c7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/tspCodeModel.json @@ -913,7 +913,7 @@ "kind": "constant", "name": "TreeSpecies", "namespace": "SampleTypeSpec", - "usage": "Output,Xml", + "usage": "Output,Json,Xml", "valueType": { "$id": "85", "kind": "string", @@ -5184,6 +5184,356 @@ } }, "isHttpMetadata": false + }, + { + "$id": "427", + "kind": "property", + "name": "label", + "serializedName": "label", + "type": { + "$id": "428", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@ns", + "arguments": { + "ns": { + "$id": "429", + "kind": "enumvalue", + "decorators": [], + "name": "ns1", + "value": "https://example.com/ns1", + "enumType": { + "$id": "430", + "kind": "enum", + "decorators": [ + { + "name": "TypeSpec.Xml.@nsDeclarations", + "arguments": {} + } + ], + "name": "XmlNamespaces", + "isGeneratedName": false, + "namespace": "SampleTypeSpec", + "valueType": { + "$id": "431", + "kind": "string", + "decorators": [], + "doc": "A sequence of textual characters.", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "values": [ + { + "$id": "432", + "kind": "enumvalue", + "decorators": [], + "name": "ns1", + "value": "https://example.com/ns1", + "enumType": { + "$ref": "430" + }, + "valueType": { + "$ref": "431" + } + }, + { + "$id": "433", + "kind": "enumvalue", + "decorators": [], + "name": "ns2", + "value": "https://example.com/ns2", + "enumType": { + "$ref": "430" + }, + "valueType": { + "$ref": "431" + } + } + ], + "isFixed": true, + "isFlags": false, + "usage": "None", + "access": "public", + "crossLanguageDefinitionId": "SampleTypeSpec.XmlNamespaces", + "apiVersions": [ + "2024-07-16-preview", + "2024-08-16-preview" + ], + "isUnionAsEnum": false, + "__accessSet": true + }, + "valueType": { + "$ref": "431" + } + } + } + }, + { + "name": "TypeSpec.Xml.@attribute", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.label", + "serializationOptions": { + "xml": { + "name": "label", + "attribute": true, + "ns": { + "namespace": "https://example.com/ns1", + "prefix": "ns1" + }, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "434", + "kind": "property", + "name": "daysUsed", + "serializedName": "daysUsed", + "type": { + "$id": "435", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@ns", + "arguments": { + "ns": { + "$id": "436", + "kind": "enumvalue", + "decorators": [], + "name": "ns2", + "value": "https://example.com/ns2", + "enumType": { + "$ref": "430" + }, + "valueType": { + "$ref": "431" + } + } + } + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.daysUsed", + "serializationOptions": { + "xml": { + "name": "daysUsed", + "attribute": false, + "ns": { + "namespace": "https://example.com/ns2", + "prefix": "ns2" + }, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "437", + "kind": "property", + "name": "fooItems", + "serializedName": "fooItems", + "type": { + "$ref": "212" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@ns", + "arguments": { + "ns": "http://www.contoso.com/anotherbook.dtd", + "prefix": "foo" + } + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.fooItems", + "serializationOptions": { + "xml": { + "name": "fooItems", + "attribute": false, + "ns": { + "namespace": "http://www.contoso.com/anotherbook.dtd", + "prefix": "foo" + }, + "unwrapped": false, + "itemsName": "string" + } + }, + "isHttpMetadata": false + }, + { + "$id": "438", + "kind": "property", + "name": "anotherModel", + "serializedName": "anotherModel", + "type": { + "$ref": "404" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@ns", + "arguments": { + "ns": "http://www.contoso.com/anothermodel.dtd", + "prefix": "bar" + } + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.anotherModel", + "serializationOptions": { + "xml": { + "name": "anotherModel", + "attribute": false, + "ns": { + "namespace": "http://www.contoso.com/anothermodel.dtd", + "prefix": "bar" + }, + "unwrapped": false + } + }, + "isHttpMetadata": false + }, + { + "$id": "439", + "kind": "property", + "name": "modelsWithNamespaces", + "serializedName": "modelsWithNamespaces", + "type": { + "$id": "440", + "kind": "array", + "name": "ArrayXmlModelWithNamespace", + "valueType": { + "$id": "441", + "kind": "model", + "name": "XmlModelWithNamespace", + "namespace": "SampleTypeSpec", + "crossLanguageDefinitionId": "SampleTypeSpec.XmlModelWithNamespace", + "usage": "Output,Xml", + "decorators": [ + { + "name": "TypeSpec.Xml.@ns", + "arguments": { + "ns": "http://www.example.com/namespace", + "prefix": "ns1" + } + } + ], + "serializationOptions": { + "xml": { + "name": "XmlModelWithNamespace", + "attribute": false, + "ns": { + "namespace": "http://www.example.com/namespace", + "prefix": "ns1" + }, + "unwrapped": false + } + }, + "properties": [ + { + "$id": "442", + "kind": "property", + "name": "foo", + "serializedName": "foo", + "type": { + "$id": "443", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlModelWithNamespace.foo", + "serializationOptions": { + "xml": { + "name": "foo", + "attribute": false, + "unwrapped": false + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.modelsWithNamespaces", + "serializationOptions": { + "xml": { + "name": "modelsWithNamespaces", + "attribute": false, + "unwrapped": false, + "itemsName": "XmlModelWithNamespace", + "itemsNs": { + "namespace": "http://www.example.com/namespace", + "prefix": "ns1" + } + } + }, + "isHttpMetadata": false + }, + { + "$id": "444", + "kind": "property", + "name": "unwrappedModelsWithNamespaces", + "serializedName": "unwrappedModelsWithNamespaces", + "type": { + "$ref": "440" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [ + { + "name": "TypeSpec.Xml.@unwrapped", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "SampleTypeSpec.XmlAdvancedModel.unwrappedModelsWithNamespaces", + "serializationOptions": { + "xml": { + "name": "unwrappedModelsWithNamespaces", + "attribute": false, + "unwrapped": true, + "itemsName": "unwrappedModelsWithNamespaces" + } + }, + "isHttpMetadata": false } ] }, @@ -5194,7 +5544,10 @@ "$ref": "404" }, { - "$id": "427", + "$ref": "441" + }, + { + "$id": "445", "kind": "model", "name": "Animal", "namespace": "SampleTypeSpec", @@ -5208,13 +5561,13 @@ } }, "discriminatorProperty": { - "$id": "428", + "$id": "446", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "The kind of animal", "type": { - "$id": "429", + "$id": "447", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5235,16 +5588,16 @@ }, "properties": [ { - "$ref": "428" + "$ref": "446" }, { - "$id": "430", + "$id": "448", "kind": "property", "name": "name", "serializedName": "name", "doc": "Name of the animal", "type": { - "$id": "431", + "$id": "449", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5266,7 +5619,7 @@ ], "discriminatedSubtypes": { "pet": { - "$id": "432", + "$id": "450", "kind": "model", "name": "Pet", "namespace": "SampleTypeSpec", @@ -5281,7 +5634,7 @@ } }, "discriminatorProperty": { - "$id": "433", + "$id": "451", "kind": "property", "name": "kind", "serializedName": "kind", @@ -5302,20 +5655,20 @@ "isHttpMetadata": false }, "baseModel": { - "$ref": "427" + "$ref": "445" }, "properties": [ { - "$ref": "433" + "$ref": "451" }, { - "$id": "434", + "$id": "452", "kind": "property", "name": "trained", "serializedName": "trained", "doc": "Whether the pet is trained", "type": { - "$id": "435", + "$id": "453", "kind": "boolean", "name": "boolean", "crossLanguageDefinitionId": "TypeSpec.boolean", @@ -5337,7 +5690,7 @@ ], "discriminatedSubtypes": { "dog": { - "$id": "436", + "$id": "454", "kind": "model", "name": "Dog", "namespace": "SampleTypeSpec", @@ -5352,11 +5705,11 @@ } }, "baseModel": { - "$ref": "432" + "$ref": "450" }, "properties": [ { - "$id": "437", + "$id": "455", "kind": "property", "name": "kind", "serializedName": "kind", @@ -5377,13 +5730,13 @@ "isHttpMetadata": false }, { - "$id": "438", + "$id": "456", "kind": "property", "name": "breed", "serializedName": "breed", "doc": "The breed of the dog", "type": { - "$id": "439", + "$id": "457", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5407,23 +5760,23 @@ } }, "dog": { - "$ref": "436" + "$ref": "454" } } }, { - "$ref": "432" + "$ref": "450" }, { - "$ref": "436" + "$ref": "454" }, { - "$id": "440", + "$id": "458", "kind": "model", "name": "Tree", "namespace": "SampleTypeSpec", "crossLanguageDefinitionId": "SampleTypeSpec.Tree", - "usage": "Output,Xml", + "usage": "Output,Json,Xml", "doc": "Tree is a specific type of plant", "discriminatorValue": "tree", "decorators": [], @@ -5432,15 +5785,18 @@ "name": "Tree", "attribute": false, "unwrapped": false + }, + "json": { + "name": "Tree" } }, "baseModel": { - "$id": "441", + "$id": "459", "kind": "model", "name": "Plant", "namespace": "SampleTypeSpec", "crossLanguageDefinitionId": "SampleTypeSpec.Plant", - "usage": "Output,Xml", + "usage": "Output,Json,Xml", "doc": "Base plant with discriminator", "decorators": [], "serializationOptions": { @@ -5448,16 +5804,19 @@ "name": "Plant", "attribute": false, "unwrapped": false + }, + "json": { + "name": "Plant" } }, "discriminatorProperty": { - "$id": "442", + "$id": "460", "kind": "property", "name": "species", "serializedName": "species", "doc": "The species of plant", "type": { - "$id": "443", + "$id": "461", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5474,22 +5833,25 @@ "name": "species", "attribute": false, "unwrapped": false + }, + "json": { + "name": "species" } }, "isHttpMetadata": false }, "properties": [ { - "$ref": "442" + "$ref": "460" }, { - "$id": "444", + "$id": "462", "kind": "property", "name": "id", "serializedName": "id", "doc": "The unique identifier of the plant", "type": { - "$id": "445", + "$id": "463", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5506,18 +5868,21 @@ "name": "id", "attribute": false, "unwrapped": false + }, + "json": { + "name": "id" } }, "isHttpMetadata": false }, { - "$id": "446", + "$id": "464", "kind": "property", "name": "height", "serializedName": "height", "doc": "The height of the plant in centimeters", "type": { - "$id": "447", + "$id": "465", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -5534,6 +5899,9 @@ "name": "height", "attribute": false, "unwrapped": false + }, + "json": { + "name": "height" } }, "isHttpMetadata": false @@ -5541,13 +5909,13 @@ ], "discriminatedSubtypes": { "tree": { - "$ref": "440" + "$ref": "458" } } }, "properties": [ { - "$id": "448", + "$id": "466", "kind": "property", "name": "species", "serializedName": "species", @@ -5565,18 +5933,21 @@ "name": "species", "attribute": false, "unwrapped": false + }, + "json": { + "name": "species" } }, "isHttpMetadata": false }, { - "$id": "449", + "$id": "467", "kind": "property", "name": "age", "serializedName": "age", "doc": "The age of the tree in years", "type": { - "$id": "450", + "$id": "468", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -5593,6 +5964,9 @@ "name": "age", "attribute": false, "unwrapped": false + }, + "json": { + "name": "age" } }, "isHttpMetadata": false @@ -5600,10 +5974,10 @@ ] }, { - "$ref": "441" + "$ref": "459" }, { - "$id": "451", + "$id": "469", "kind": "model", "name": "GetWidgetMetricsResponse", "namespace": "SampleTypeSpec", @@ -5617,12 +5991,12 @@ }, "properties": [ { - "$id": "452", + "$id": "470", "kind": "property", "name": "numSold", "serializedName": "numSold", "type": { - "$id": "453", + "$id": "471", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -5642,12 +6016,12 @@ "isHttpMetadata": false }, { - "$id": "454", + "$id": "472", "kind": "property", "name": "averagePrice", "serializedName": "averagePrice", "type": { - "$id": "455", + "$id": "473", "kind": "float32", "name": "float32", "crossLanguageDefinitionId": "TypeSpec.float32", @@ -5671,14 +6045,14 @@ ], "clients": [ { - "$id": "456", + "$id": "474", "kind": "client", "name": "SampleTypeSpecClient", "namespace": "SampleTypeSpec", "doc": "This is a sample typespec project.", "methods": [ { - "$id": "457", + "$id": "475", "kind": "basic", "name": "sayHi", "accessibility": "public", @@ -5688,19 +6062,19 @@ ], "doc": "Return hi", "operation": { - "$id": "458", + "$id": "476", "name": "sayHi", "resourceName": "SampleTypeSpec", "doc": "Return hi", "accessibility": "public", "parameters": [ { - "$id": "459", + "$id": "477", "kind": "header", "name": "headParameter", "serializedName": "head-parameter", "type": { - "$id": "460", + "$id": "478", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5715,12 +6089,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.sayHi.headParameter" }, { - "$id": "461", + "$id": "479", "kind": "query", "name": "queryParameter", "serializedName": "queryParameter", "type": { - "$id": "462", + "$id": "480", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5735,12 +6109,12 @@ "readOnly": false }, { - "$id": "463", + "$id": "481", "kind": "query", "name": "optionalQuery", "serializedName": "optionalQuery", "type": { - "$id": "464", + "$id": "482", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5755,7 +6129,7 @@ "readOnly": false }, { - "$id": "465", + "$id": "483", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -5798,12 +6172,12 @@ }, "parameters": [ { - "$id": "466", + "$id": "484", "kind": "method", "name": "headParameter", "serializedName": "head-parameter", "type": { - "$id": "467", + "$id": "485", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5819,12 +6193,12 @@ "decorators": [] }, { - "$id": "468", + "$id": "486", "kind": "method", "name": "queryParameter", "serializedName": "queryParameter", "type": { - "$id": "469", + "$id": "487", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5840,12 +6214,12 @@ "decorators": [] }, { - "$id": "470", + "$id": "488", "kind": "method", "name": "optionalQuery", "serializedName": "optionalQuery", "type": { - "$id": "471", + "$id": "489", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5861,7 +6235,7 @@ "decorators": [] }, { - "$id": "472", + "$id": "490", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -5889,7 +6263,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.sayHi" }, { - "$id": "473", + "$id": "491", "kind": "basic", "name": "helloAgain", "accessibility": "public", @@ -5899,19 +6273,19 @@ ], "doc": "Return hi again", "operation": { - "$id": "474", + "$id": "492", "name": "helloAgain", "resourceName": "SampleTypeSpec", "doc": "Return hi again", "accessibility": "public", "parameters": [ { - "$id": "475", + "$id": "493", "kind": "header", "name": "p1", "serializedName": "p1", "type": { - "$id": "476", + "$id": "494", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5926,7 +6300,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.p1" }, { - "$id": "477", + "$id": "495", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -5942,12 +6316,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.contentType" }, { - "$id": "478", + "$id": "496", "kind": "path", "name": "p2", "serializedName": "p2", "type": { - "$id": "479", + "$id": "497", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5965,7 +6339,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.p2" }, { - "$id": "480", + "$id": "498", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -5981,7 +6355,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain.accept" }, { - "$id": "481", + "$id": "499", "kind": "body", "name": "action", "serializedName": "action", @@ -6030,12 +6404,12 @@ }, "parameters": [ { - "$id": "482", + "$id": "500", "kind": "method", "name": "p1", "serializedName": "p1", "type": { - "$id": "483", + "$id": "501", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6051,7 +6425,7 @@ "decorators": [] }, { - "$id": "484", + "$id": "502", "kind": "method", "name": "action", "serializedName": "action", @@ -6068,7 +6442,7 @@ "decorators": [] }, { - "$id": "485", + "$id": "503", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -6085,12 +6459,12 @@ "decorators": [] }, { - "$id": "486", + "$id": "504", "kind": "method", "name": "p2", "serializedName": "p2", "type": { - "$id": "487", + "$id": "505", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6106,7 +6480,7 @@ "decorators": [] }, { - "$id": "488", + "$id": "506", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -6134,7 +6508,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloAgain" }, { - "$id": "489", + "$id": "507", "kind": "basic", "name": "noContentType", "accessibility": "public", @@ -6144,19 +6518,19 @@ ], "doc": "Return hi again", "operation": { - "$id": "490", + "$id": "508", "name": "noContentType", "resourceName": "SampleTypeSpec", "doc": "Return hi again", "accessibility": "public", "parameters": [ { - "$id": "491", + "$id": "509", "kind": "header", "name": "p1", "serializedName": "p1", "type": { - "$id": "492", + "$id": "510", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6171,12 +6545,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.p1" }, { - "$id": "493", + "$id": "511", "kind": "path", "name": "p2", "serializedName": "p2", "type": { - "$id": "494", + "$id": "512", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6194,7 +6568,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.p2" }, { - "$id": "495", + "$id": "513", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -6211,7 +6585,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.contentType" }, { - "$id": "496", + "$id": "514", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -6227,7 +6601,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType.accept" }, { - "$id": "497", + "$id": "515", "kind": "body", "name": "action", "serializedName": "action", @@ -6276,12 +6650,12 @@ }, "parameters": [ { - "$id": "498", + "$id": "516", "kind": "method", "name": "p1", "serializedName": "p1", "type": { - "$id": "499", + "$id": "517", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6297,7 +6671,7 @@ "decorators": [] }, { - "$id": "500", + "$id": "518", "kind": "method", "name": "action", "serializedName": "action", @@ -6314,12 +6688,12 @@ "decorators": [] }, { - "$id": "501", + "$id": "519", "kind": "method", "name": "p2", "serializedName": "p2", "type": { - "$id": "502", + "$id": "520", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6335,7 +6709,7 @@ "decorators": [] }, { - "$id": "503", + "$id": "521", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -6353,7 +6727,7 @@ "decorators": [] }, { - "$id": "504", + "$id": "522", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -6381,7 +6755,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.noContentType" }, { - "$id": "505", + "$id": "523", "kind": "basic", "name": "helloDemo2", "accessibility": "public", @@ -6391,14 +6765,14 @@ ], "doc": "Return hi in demo2", "operation": { - "$id": "506", + "$id": "524", "name": "helloDemo2", "resourceName": "SampleTypeSpec", "doc": "Return hi in demo2", "accessibility": "public", "parameters": [ { - "$id": "507", + "$id": "525", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -6441,7 +6815,7 @@ }, "parameters": [ { - "$id": "508", + "$id": "526", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -6469,7 +6843,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloDemo2" }, { - "$id": "509", + "$id": "527", "kind": "basic", "name": "createLiteral", "accessibility": "public", @@ -6479,14 +6853,14 @@ ], "doc": "Create with literal value", "operation": { - "$id": "510", + "$id": "528", "name": "createLiteral", "resourceName": "SampleTypeSpec", "doc": "Create with literal value", "accessibility": "public", "parameters": [ { - "$id": "511", + "$id": "529", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -6503,7 +6877,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.createLiteral.contentType" }, { - "$id": "512", + "$id": "530", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -6519,7 +6893,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.createLiteral.accept" }, { - "$id": "513", + "$id": "531", "kind": "body", "name": "body", "serializedName": "body", @@ -6568,7 +6942,7 @@ }, "parameters": [ { - "$id": "514", + "$id": "532", "kind": "method", "name": "body", "serializedName": "body", @@ -6585,7 +6959,7 @@ "decorators": [] }, { - "$id": "515", + "$id": "533", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -6603,7 +6977,7 @@ "decorators": [] }, { - "$id": "516", + "$id": "534", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -6631,7 +7005,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.createLiteral" }, { - "$id": "517", + "$id": "535", "kind": "basic", "name": "helloLiteral", "accessibility": "public", @@ -6641,14 +7015,14 @@ ], "doc": "Send literal parameters", "operation": { - "$id": "518", + "$id": "536", "name": "helloLiteral", "resourceName": "SampleTypeSpec", "doc": "Send literal parameters", "accessibility": "public", "parameters": [ { - "$id": "519", + "$id": "537", "kind": "header", "name": "p1", "serializedName": "p1", @@ -6664,7 +7038,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloLiteral.p1" }, { - "$id": "520", + "$id": "538", "kind": "path", "name": "p2", "serializedName": "p2", @@ -6683,7 +7057,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloLiteral.p2" }, { - "$id": "521", + "$id": "539", "kind": "query", "name": "p3", "serializedName": "p3", @@ -6699,7 +7073,7 @@ "readOnly": false }, { - "$id": "522", + "$id": "540", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -6742,7 +7116,7 @@ }, "parameters": [ { - "$id": "523", + "$id": "541", "kind": "method", "name": "p1", "serializedName": "p1", @@ -6759,7 +7133,7 @@ "decorators": [] }, { - "$id": "524", + "$id": "542", "kind": "method", "name": "p2", "serializedName": "p2", @@ -6776,7 +7150,7 @@ "decorators": [] }, { - "$id": "525", + "$id": "543", "kind": "method", "name": "p3", "serializedName": "p3", @@ -6793,7 +7167,7 @@ "decorators": [] }, { - "$id": "526", + "$id": "544", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -6821,7 +7195,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.helloLiteral" }, { - "$id": "527", + "$id": "545", "kind": "basic", "name": "topAction", "accessibility": "public", @@ -6831,24 +7205,24 @@ ], "doc": "top level method", "operation": { - "$id": "528", + "$id": "546", "name": "topAction", "resourceName": "SampleTypeSpec", "doc": "top level method", "accessibility": "public", "parameters": [ { - "$id": "529", + "$id": "547", "kind": "path", "name": "action", "serializedName": "action", "type": { - "$id": "530", + "$id": "548", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc3339", "wireType": { - "$id": "531", + "$id": "549", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6869,7 +7243,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.topAction.action" }, { - "$id": "532", + "$id": "550", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -6912,17 +7286,17 @@ }, "parameters": [ { - "$id": "533", + "$id": "551", "kind": "method", "name": "action", "serializedName": "action", "type": { - "$id": "534", + "$id": "552", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc3339", "wireType": { - "$id": "535", + "$id": "553", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -6941,7 +7315,7 @@ "decorators": [] }, { - "$id": "536", + "$id": "554", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -6969,7 +7343,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.topAction" }, { - "$id": "537", + "$id": "555", "kind": "basic", "name": "topAction2", "accessibility": "public", @@ -6979,14 +7353,14 @@ ], "doc": "top level method2", "operation": { - "$id": "538", + "$id": "556", "name": "topAction2", "resourceName": "SampleTypeSpec", "doc": "top level method2", "accessibility": "public", "parameters": [ { - "$id": "539", + "$id": "557", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -7029,7 +7403,7 @@ }, "parameters": [ { - "$id": "540", + "$id": "558", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -7057,7 +7431,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.topAction2" }, { - "$id": "541", + "$id": "559", "kind": "basic", "name": "patchAction", "accessibility": "public", @@ -7067,14 +7441,14 @@ ], "doc": "top level patch", "operation": { - "$id": "542", + "$id": "560", "name": "patchAction", "resourceName": "SampleTypeSpec", "doc": "top level patch", "accessibility": "public", "parameters": [ { - "$id": "543", + "$id": "561", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -7091,7 +7465,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.patchAction.contentType" }, { - "$id": "544", + "$id": "562", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -7107,7 +7481,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.patchAction.accept" }, { - "$id": "545", + "$id": "563", "kind": "body", "name": "body", "serializedName": "body", @@ -7156,7 +7530,7 @@ }, "parameters": [ { - "$id": "546", + "$id": "564", "kind": "method", "name": "body", "serializedName": "body", @@ -7173,7 +7547,7 @@ "decorators": [] }, { - "$id": "547", + "$id": "565", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -7191,7 +7565,7 @@ "decorators": [] }, { - "$id": "548", + "$id": "566", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -7219,7 +7593,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.patchAction" }, { - "$id": "549", + "$id": "567", "kind": "basic", "name": "anonymousBody", "accessibility": "public", @@ -7229,14 +7603,14 @@ ], "doc": "body parameter without body decorator", "operation": { - "$id": "550", + "$id": "568", "name": "anonymousBody", "resourceName": "SampleTypeSpec", "doc": "body parameter without body decorator", "accessibility": "public", "parameters": [ { - "$id": "551", + "$id": "569", "kind": "query", "name": "requiredQueryParam", "serializedName": "requiredQueryParam", @@ -7252,7 +7626,7 @@ "readOnly": false }, { - "$id": "552", + "$id": "570", "kind": "header", "name": "requiredHeader", "serializedName": "required-header", @@ -7268,7 +7642,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody.requiredHeader" }, { - "$id": "553", + "$id": "571", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -7285,7 +7659,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody.contentType" }, { - "$id": "554", + "$id": "572", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -7301,7 +7675,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody.accept" }, { - "$id": "555", + "$id": "573", "kind": "body", "name": "thing", "serializedName": "thing", @@ -7350,13 +7724,13 @@ }, "parameters": [ { - "$id": "556", + "$id": "574", "kind": "method", "name": "name", "serializedName": "name", "doc": "name of the Thing", "type": { - "$id": "557", + "$id": "575", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7372,7 +7746,7 @@ "decorators": [] }, { - "$id": "558", + "$id": "576", "kind": "method", "name": "requiredUnion", "serializedName": "requiredUnion", @@ -7390,7 +7764,7 @@ "decorators": [] }, { - "$id": "559", + "$id": "577", "kind": "method", "name": "requiredLiteralString", "serializedName": "requiredLiteralString", @@ -7408,7 +7782,7 @@ "decorators": [] }, { - "$id": "560", + "$id": "578", "kind": "method", "name": "requiredNullableString", "serializedName": "requiredNullableString", @@ -7426,7 +7800,7 @@ "decorators": [] }, { - "$id": "561", + "$id": "579", "kind": "method", "name": "optionalNullableString", "serializedName": "optionalNullableString", @@ -7444,7 +7818,7 @@ "decorators": [] }, { - "$id": "562", + "$id": "580", "kind": "method", "name": "requiredLiteralInt", "serializedName": "requiredLiteralInt", @@ -7462,7 +7836,7 @@ "decorators": [] }, { - "$id": "563", + "$id": "581", "kind": "method", "name": "requiredLiteralFloat", "serializedName": "requiredLiteralFloat", @@ -7480,7 +7854,7 @@ "decorators": [] }, { - "$id": "564", + "$id": "582", "kind": "method", "name": "requiredLiteralBool", "serializedName": "requiredLiteralBool", @@ -7498,18 +7872,18 @@ "decorators": [] }, { - "$id": "565", + "$id": "583", "kind": "method", "name": "optionalLiteralString", "serializedName": "optionalLiteralString", "doc": "optional literal string", "type": { - "$id": "566", + "$id": "584", "kind": "enum", "name": "ThingOptionalLiteralString", "crossLanguageDefinitionId": "", "valueType": { - "$id": "567", + "$id": "585", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7517,12 +7891,12 @@ }, "values": [ { - "$id": "568", + "$id": "586", "kind": "enumvalue", "name": "reject", "value": "reject", "valueType": { - "$id": "569", + "$id": "587", "kind": "string", "decorators": [], "doc": "A sequence of textual characters.", @@ -7530,7 +7904,7 @@ "crossLanguageDefinitionId": "TypeSpec.string" }, "enumType": { - "$ref": "566" + "$ref": "584" }, "decorators": [] } @@ -7551,7 +7925,7 @@ "decorators": [] }, { - "$id": "570", + "$id": "588", "kind": "method", "name": "requiredNullableLiteralString", "serializedName": "requiredNullableLiteralString", @@ -7569,18 +7943,18 @@ "decorators": [] }, { - "$id": "571", + "$id": "589", "kind": "method", "name": "optionalLiteralInt", "serializedName": "optionalLiteralInt", "doc": "optional literal int", "type": { - "$id": "572", + "$id": "590", "kind": "enum", "name": "ThingOptionalLiteralInt", "crossLanguageDefinitionId": "", "valueType": { - "$id": "573", + "$id": "591", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -7588,12 +7962,12 @@ }, "values": [ { - "$id": "574", + "$id": "592", "kind": "enumvalue", "name": "456", "value": 456, "valueType": { - "$id": "575", + "$id": "593", "kind": "int32", "decorators": [], "doc": "A 32-bit integer. (`-2,147,483,648` to `2,147,483,647`)", @@ -7601,7 +7975,7 @@ "crossLanguageDefinitionId": "TypeSpec.int32" }, "enumType": { - "$ref": "572" + "$ref": "590" }, "decorators": [] } @@ -7622,18 +7996,18 @@ "decorators": [] }, { - "$id": "576", + "$id": "594", "kind": "method", "name": "optionalLiteralFloat", "serializedName": "optionalLiteralFloat", "doc": "optional literal float", "type": { - "$id": "577", + "$id": "595", "kind": "enum", "name": "ThingOptionalLiteralFloat", "crossLanguageDefinitionId": "", "valueType": { - "$id": "578", + "$id": "596", "kind": "float32", "name": "float32", "crossLanguageDefinitionId": "TypeSpec.float32", @@ -7641,12 +8015,12 @@ }, "values": [ { - "$id": "579", + "$id": "597", "kind": "enumvalue", "name": "4.56", "value": 4.56, "valueType": { - "$id": "580", + "$id": "598", "kind": "float32", "decorators": [], "doc": "A 32 bit floating point number. (`±1.5 x 10^−45` to `±3.4 x 10^38`)", @@ -7654,7 +8028,7 @@ "crossLanguageDefinitionId": "TypeSpec.float32" }, "enumType": { - "$ref": "577" + "$ref": "595" }, "decorators": [] } @@ -7675,7 +8049,7 @@ "decorators": [] }, { - "$id": "581", + "$id": "599", "kind": "method", "name": "optionalLiteralBool", "serializedName": "optionalLiteralBool", @@ -7693,13 +8067,13 @@ "decorators": [] }, { - "$id": "582", + "$id": "600", "kind": "method", "name": "requiredBadDescription", "serializedName": "requiredBadDescription", "doc": "description with xml <|endoftext|>", "type": { - "$id": "583", + "$id": "601", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7715,7 +8089,7 @@ "decorators": [] }, { - "$id": "584", + "$id": "602", "kind": "method", "name": "optionalNullableList", "serializedName": "optionalNullableList", @@ -7733,7 +8107,7 @@ "decorators": [] }, { - "$id": "585", + "$id": "603", "kind": "method", "name": "requiredNullableList", "serializedName": "requiredNullableList", @@ -7751,13 +8125,13 @@ "decorators": [] }, { - "$id": "586", + "$id": "604", "kind": "method", "name": "propertyWithSpecialDocs", "serializedName": "propertyWithSpecialDocs", "doc": "This tests:\n- Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines.\n- Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation.\n- Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output.\n- Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases.\n- **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines.\n- *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines.", "type": { - "$id": "587", + "$id": "605", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7773,7 +8147,7 @@ "decorators": [] }, { - "$id": "588", + "$id": "606", "kind": "method", "name": "requiredQueryParam", "serializedName": "requiredQueryParam", @@ -7790,7 +8164,7 @@ "decorators": [] }, { - "$id": "589", + "$id": "607", "kind": "method", "name": "requiredHeader", "serializedName": "required-header", @@ -7807,7 +8181,7 @@ "decorators": [] }, { - "$id": "590", + "$id": "608", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -7825,7 +8199,7 @@ "decorators": [] }, { - "$id": "591", + "$id": "609", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -7853,7 +8227,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.anonymousBody" }, { - "$id": "592", + "$id": "610", "kind": "basic", "name": "friendlyModel", "accessibility": "public", @@ -7863,14 +8237,14 @@ ], "doc": "Model can have its friendly name", "operation": { - "$id": "593", + "$id": "611", "name": "friendlyModel", "resourceName": "SampleTypeSpec", "doc": "Model can have its friendly name", "accessibility": "public", "parameters": [ { - "$id": "594", + "$id": "612", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -7887,7 +8261,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.friendlyModel.contentType" }, { - "$id": "595", + "$id": "613", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -7903,7 +8277,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.friendlyModel.accept" }, { - "$id": "596", + "$id": "614", "kind": "body", "name": "friend", "serializedName": "friend", @@ -7952,13 +8326,13 @@ }, "parameters": [ { - "$id": "597", + "$id": "615", "kind": "method", "name": "name", "serializedName": "name", "doc": "name of the NotFriend", "type": { - "$id": "598", + "$id": "616", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -7974,7 +8348,7 @@ "decorators": [] }, { - "$id": "599", + "$id": "617", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -7992,7 +8366,7 @@ "decorators": [] }, { - "$id": "600", + "$id": "618", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -8020,7 +8394,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.friendlyModel" }, { - "$id": "601", + "$id": "619", "kind": "basic", "name": "addTimeHeader", "accessibility": "public", @@ -8029,23 +8403,23 @@ "2024-08-16-preview" ], "operation": { - "$id": "602", + "$id": "620", "name": "addTimeHeader", "resourceName": "SampleTypeSpec", "accessibility": "public", "parameters": [ { - "$id": "603", + "$id": "621", "kind": "header", "name": "repeatabilityFirstSent", "serializedName": "Repeatability-First-Sent", "type": { - "$id": "604", + "$id": "622", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc7231", "wireType": { - "$id": "605", + "$id": "623", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8084,17 +8458,17 @@ }, "parameters": [ { - "$id": "606", + "$id": "624", "kind": "method", "name": "repeatabilityFirstSent", "serializedName": "Repeatability-First-Sent", "type": { - "$id": "607", + "$id": "625", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc7231", "wireType": { - "$id": "608", + "$id": "626", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8120,7 +8494,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.addTimeHeader" }, { - "$id": "609", + "$id": "627", "kind": "basic", "name": "projectedNameModel", "accessibility": "public", @@ -8130,14 +8504,14 @@ ], "doc": "Model can have its projected name", "operation": { - "$id": "610", + "$id": "628", "name": "projectedNameModel", "resourceName": "SampleTypeSpec", "doc": "Model can have its projected name", "accessibility": "public", "parameters": [ { - "$id": "611", + "$id": "629", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -8154,7 +8528,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.projectedNameModel.contentType" }, { - "$id": "612", + "$id": "630", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -8170,7 +8544,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.projectedNameModel.accept" }, { - "$id": "613", + "$id": "631", "kind": "body", "name": "renamedModel", "serializedName": "renamedModel", @@ -8219,13 +8593,13 @@ }, "parameters": [ { - "$id": "614", + "$id": "632", "kind": "method", "name": "otherName", "serializedName": "otherName", "doc": "name of the ModelWithClientName", "type": { - "$id": "615", + "$id": "633", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8241,7 +8615,7 @@ "decorators": [] }, { - "$id": "616", + "$id": "634", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -8259,7 +8633,7 @@ "decorators": [] }, { - "$id": "617", + "$id": "635", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -8287,7 +8661,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.projectedNameModel" }, { - "$id": "618", + "$id": "636", "kind": "basic", "name": "returnsAnonymousModel", "accessibility": "public", @@ -8297,14 +8671,14 @@ ], "doc": "return anonymous model", "operation": { - "$id": "619", + "$id": "637", "name": "returnsAnonymousModel", "resourceName": "SampleTypeSpec", "doc": "return anonymous model", "accessibility": "public", "parameters": [ { - "$id": "620", + "$id": "638", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -8347,7 +8721,7 @@ }, "parameters": [ { - "$id": "621", + "$id": "639", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -8375,7 +8749,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.returnsAnonymousModel" }, { - "$id": "622", + "$id": "640", "kind": "basic", "name": "getUnknownValue", "accessibility": "public", @@ -8385,19 +8759,19 @@ ], "doc": "get extensible enum", "operation": { - "$id": "623", + "$id": "641", "name": "getUnknownValue", "resourceName": "SampleTypeSpec", "doc": "get extensible enum", "accessibility": "public", "parameters": [ { - "$id": "624", + "$id": "642", "kind": "header", "name": "accept", "serializedName": "Accept", "type": { - "$id": "625", + "$id": "643", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8418,7 +8792,7 @@ 200 ], "bodyType": { - "$id": "626", + "$id": "644", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8450,12 +8824,12 @@ }, "parameters": [ { - "$id": "627", + "$id": "645", "kind": "method", "name": "accept", "serializedName": "Accept", "type": { - "$ref": "625" + "$ref": "643" }, "location": "Header", "isApiVersion": false, @@ -8469,7 +8843,7 @@ ], "response": { "type": { - "$ref": "626" + "$ref": "644" } }, "isOverride": false, @@ -8478,7 +8852,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.getUnknownValue" }, { - "$id": "628", + "$id": "646", "kind": "basic", "name": "internalProtocol", "accessibility": "public", @@ -8488,14 +8862,14 @@ ], "doc": "When set protocol false and convenient true, then the protocol method should be internal", "operation": { - "$id": "629", + "$id": "647", "name": "internalProtocol", "resourceName": "SampleTypeSpec", "doc": "When set protocol false and convenient true, then the protocol method should be internal", "accessibility": "public", "parameters": [ { - "$id": "630", + "$id": "648", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -8512,7 +8886,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.internalProtocol.contentType" }, { - "$id": "631", + "$id": "649", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -8528,7 +8902,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.internalProtocol.accept" }, { - "$id": "632", + "$id": "650", "kind": "body", "name": "body", "serializedName": "body", @@ -8577,7 +8951,7 @@ }, "parameters": [ { - "$id": "633", + "$id": "651", "kind": "method", "name": "body", "serializedName": "body", @@ -8594,7 +8968,7 @@ "decorators": [] }, { - "$id": "634", + "$id": "652", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -8612,7 +8986,7 @@ "decorators": [] }, { - "$id": "635", + "$id": "653", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -8640,7 +9014,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.internalProtocol" }, { - "$id": "636", + "$id": "654", "kind": "basic", "name": "stillConvenient", "accessibility": "public", @@ -8650,7 +9024,7 @@ ], "doc": "When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one", "operation": { - "$id": "637", + "$id": "655", "name": "stillConvenient", "resourceName": "SampleTypeSpec", "doc": "When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one", @@ -8683,7 +9057,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.stillConvenient" }, { - "$id": "638", + "$id": "656", "kind": "basic", "name": "headAsBoolean", "accessibility": "public", @@ -8693,19 +9067,19 @@ ], "doc": "head as boolean.", "operation": { - "$id": "639", + "$id": "657", "name": "headAsBoolean", "resourceName": "SampleTypeSpec", "doc": "head as boolean.", "accessibility": "public", "parameters": [ { - "$id": "640", + "$id": "658", "kind": "path", "name": "id", "serializedName": "id", "type": { - "$id": "641", + "$id": "659", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8744,12 +9118,12 @@ }, "parameters": [ { - "$id": "642", + "$id": "660", "kind": "method", "name": "id", "serializedName": "id", "type": { - "$id": "643", + "$id": "661", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8772,7 +9146,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.headAsBoolean" }, { - "$id": "644", + "$id": "662", "kind": "basic", "name": "WithApiVersion", "accessibility": "public", @@ -8782,19 +9156,19 @@ ], "doc": "Return hi again", "operation": { - "$id": "645", + "$id": "663", "name": "WithApiVersion", "resourceName": "SampleTypeSpec", "doc": "Return hi again", "accessibility": "public", "parameters": [ { - "$id": "646", + "$id": "664", "kind": "header", "name": "p1", "serializedName": "p1", "type": { - "$id": "647", + "$id": "665", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8809,12 +9183,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.WithApiVersion.p1" }, { - "$id": "648", + "$id": "666", "kind": "query", "name": "apiVersion", "serializedName": "apiVersion", "type": { - "$id": "649", + "$id": "667", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8824,7 +9198,7 @@ "explode": false, "defaultValue": { "type": { - "$id": "650", + "$id": "668", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" @@ -8859,12 +9233,12 @@ }, "parameters": [ { - "$id": "651", + "$id": "669", "kind": "method", "name": "p1", "serializedName": "p1", "type": { - "$id": "652", + "$id": "670", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -8887,7 +9261,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.WithApiVersion" }, { - "$id": "653", + "$id": "671", "kind": "paging", "name": "ListWithNextLink", "accessibility": "public", @@ -8897,14 +9271,14 @@ ], "doc": "List things with nextlink", "operation": { - "$id": "654", + "$id": "672", "name": "ListWithNextLink", "resourceName": "SampleTypeSpec", "doc": "List things with nextlink", "accessibility": "public", "parameters": [ { - "$id": "655", + "$id": "673", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -8947,7 +9321,7 @@ }, "parameters": [ { - "$id": "656", + "$id": "674", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -8990,7 +9364,7 @@ } }, { - "$id": "657", + "$id": "675", "kind": "paging", "name": "ListWithStringNextLink", "accessibility": "public", @@ -9000,14 +9374,14 @@ ], "doc": "List things with nextlink", "operation": { - "$id": "658", + "$id": "676", "name": "ListWithStringNextLink", "resourceName": "SampleTypeSpec", "doc": "List things with nextlink", "accessibility": "public", "parameters": [ { - "$id": "659", + "$id": "677", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -9050,7 +9424,7 @@ }, "parameters": [ { - "$id": "660", + "$id": "678", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -9093,7 +9467,7 @@ } }, { - "$id": "661", + "$id": "679", "kind": "paging", "name": "ListWithContinuationToken", "accessibility": "public", @@ -9103,19 +9477,19 @@ ], "doc": "List things with continuation token", "operation": { - "$id": "662", + "$id": "680", "name": "ListWithContinuationToken", "resourceName": "SampleTypeSpec", "doc": "List things with continuation token", "accessibility": "public", "parameters": [ { - "$id": "663", + "$id": "681", "kind": "query", "name": "token", "serializedName": "token", "type": { - "$id": "664", + "$id": "682", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9130,7 +9504,7 @@ "readOnly": false }, { - "$id": "665", + "$id": "683", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -9173,12 +9547,12 @@ }, "parameters": [ { - "$id": "666", + "$id": "684", "kind": "method", "name": "token", "serializedName": "token", "type": { - "$id": "667", + "$id": "685", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9194,7 +9568,7 @@ "decorators": [] }, { - "$id": "668", + "$id": "686", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -9229,7 +9603,7 @@ ], "continuationToken": { "parameter": { - "$ref": "663" + "$ref": "681" }, "responseSegments": [ "nextToken" @@ -9240,7 +9614,7 @@ } }, { - "$id": "669", + "$id": "687", "kind": "paging", "name": "ListWithContinuationTokenHeaderResponse", "accessibility": "public", @@ -9250,19 +9624,19 @@ ], "doc": "List things with continuation token header response", "operation": { - "$id": "670", + "$id": "688", "name": "ListWithContinuationTokenHeaderResponse", "resourceName": "SampleTypeSpec", "doc": "List things with continuation token header response", "accessibility": "public", "parameters": [ { - "$id": "671", + "$id": "689", "kind": "query", "name": "token", "serializedName": "token", "type": { - "$id": "672", + "$id": "690", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9277,7 +9651,7 @@ "readOnly": false }, { - "$id": "673", + "$id": "691", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -9306,7 +9680,7 @@ "name": "nextToken", "nameInResponse": "next-token", "type": { - "$id": "674", + "$id": "692", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9332,12 +9706,12 @@ }, "parameters": [ { - "$id": "675", + "$id": "693", "kind": "method", "name": "token", "serializedName": "token", "type": { - "$id": "676", + "$id": "694", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9353,7 +9727,7 @@ "decorators": [] }, { - "$id": "677", + "$id": "695", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -9388,7 +9762,7 @@ ], "continuationToken": { "parameter": { - "$ref": "671" + "$ref": "689" }, "responseSegments": [ "next-token" @@ -9399,7 +9773,7 @@ } }, { - "$id": "678", + "$id": "696", "kind": "paging", "name": "ListWithPaging", "accessibility": "public", @@ -9409,14 +9783,14 @@ ], "doc": "List things with paging", "operation": { - "$id": "679", + "$id": "697", "name": "ListWithPaging", "resourceName": "SampleTypeSpec", "doc": "List things with paging", "accessibility": "public", "parameters": [ { - "$id": "680", + "$id": "698", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -9459,7 +9833,7 @@ }, "parameters": [ { - "$id": "681", + "$id": "699", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -9496,7 +9870,7 @@ } }, { - "$id": "682", + "$id": "700", "kind": "basic", "name": "EmbeddedParameters", "accessibility": "public", @@ -9506,20 +9880,20 @@ ], "doc": "An operation with embedded parameters within the body", "operation": { - "$id": "683", + "$id": "701", "name": "EmbeddedParameters", "resourceName": "SampleTypeSpec", "doc": "An operation with embedded parameters within the body", "accessibility": "public", "parameters": [ { - "$id": "684", + "$id": "702", "kind": "header", "name": "requiredHeader", "serializedName": "required-header", "doc": "required header parameter", "type": { - "$id": "685", + "$id": "703", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9534,13 +9908,13 @@ "crossLanguageDefinitionId": "SampleTypeSpec.ModelWithEmbeddedNonBodyParameters.requiredHeader" }, { - "$id": "686", + "$id": "704", "kind": "header", "name": "optionalHeader", "serializedName": "optional-header", "doc": "optional header parameter", "type": { - "$id": "687", + "$id": "705", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9555,13 +9929,13 @@ "crossLanguageDefinitionId": "SampleTypeSpec.ModelWithEmbeddedNonBodyParameters.optionalHeader" }, { - "$id": "688", + "$id": "706", "kind": "query", "name": "requiredQuery", "serializedName": "requiredQuery", "doc": "required query parameter", "type": { - "$id": "689", + "$id": "707", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9576,13 +9950,13 @@ "readOnly": false }, { - "$id": "690", + "$id": "708", "kind": "query", "name": "optionalQuery", "serializedName": "optionalQuery", "doc": "optional query parameter", "type": { - "$id": "691", + "$id": "709", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9597,7 +9971,7 @@ "readOnly": false }, { - "$id": "692", + "$id": "710", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -9614,7 +9988,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.EmbeddedParameters.contentType" }, { - "$id": "693", + "$id": "711", "kind": "body", "name": "body", "serializedName": "body", @@ -9657,7 +10031,7 @@ }, "parameters": [ { - "$id": "694", + "$id": "712", "kind": "method", "name": "body", "serializedName": "body", @@ -9674,7 +10048,7 @@ "decorators": [] }, { - "$id": "695", + "$id": "713", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -9699,7 +10073,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.EmbeddedParameters" }, { - "$id": "696", + "$id": "714", "kind": "basic", "name": "DynamicModelOperation", "accessibility": "public", @@ -9709,14 +10083,14 @@ ], "doc": "An operation with a dynamic model", "operation": { - "$id": "697", + "$id": "715", "name": "DynamicModelOperation", "resourceName": "SampleTypeSpec", "doc": "An operation with a dynamic model", "accessibility": "public", "parameters": [ { - "$id": "698", + "$id": "716", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -9733,7 +10107,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.DynamicModelOperation.contentType" }, { - "$id": "699", + "$id": "717", "kind": "body", "name": "body", "serializedName": "body", @@ -9776,7 +10150,7 @@ }, "parameters": [ { - "$id": "700", + "$id": "718", "kind": "method", "name": "body", "serializedName": "body", @@ -9793,7 +10167,7 @@ "decorators": [] }, { - "$id": "701", + "$id": "719", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -9818,7 +10192,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.DynamicModelOperation" }, { - "$id": "702", + "$id": "720", "kind": "basic", "name": "GetXmlAdvancedModel", "accessibility": "public", @@ -9828,14 +10202,14 @@ ], "doc": "Get an advanced XML model with various property types", "operation": { - "$id": "703", + "$id": "721", "name": "GetXmlAdvancedModel", "resourceName": "SampleTypeSpec", "doc": "Get an advanced XML model with various property types", "accessibility": "public", "parameters": [ { - "$id": "704", + "$id": "722", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -9886,7 +10260,7 @@ }, "parameters": [ { - "$id": "705", + "$id": "723", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -9916,12 +10290,12 @@ ], "parameters": [ { - "$id": "706", + "$id": "724", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "707", + "$id": "725", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -9936,12 +10310,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.sampleTypeSpecUrl" }, { - "$id": "708", + "$id": "726", "kind": "method", "name": "apiVersion", "serializedName": "apiVersion", "type": { - "$id": "709", + "$id": "727", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -9951,7 +10325,7 @@ "isApiVersion": true, "defaultValue": { "type": { - "$id": "710", + "$id": "728", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" @@ -9975,13 +10349,13 @@ ], "children": [ { - "$id": "711", + "$id": "729", "kind": "client", "name": "AnimalOperations", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "712", + "$id": "730", "kind": "basic", "name": "updatePetAsAnimal", "accessibility": "public", @@ -9991,14 +10365,14 @@ ], "doc": "Update a pet as an animal", "operation": { - "$id": "713", + "$id": "731", "name": "updatePetAsAnimal", "resourceName": "AnimalOperations", "doc": "Update a pet as an animal", "accessibility": "public", "parameters": [ { - "$id": "714", + "$id": "732", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -10015,7 +10389,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updatePetAsAnimal.contentType" }, { - "$id": "715", + "$id": "733", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -10031,12 +10405,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updatePetAsAnimal.accept" }, { - "$id": "716", + "$id": "734", "kind": "body", "name": "animal", "serializedName": "animal", "type": { - "$ref": "427" + "$ref": "445" }, "isApiVersion": false, "contentTypes": [ @@ -10056,7 +10430,7 @@ 200 ], "bodyType": { - "$ref": "427" + "$ref": "445" }, "headers": [], "isErrorResponse": false, @@ -10080,12 +10454,12 @@ }, "parameters": [ { - "$id": "717", + "$id": "735", "kind": "method", "name": "animal", "serializedName": "animal", "type": { - "$ref": "427" + "$ref": "445" }, "location": "Body", "isApiVersion": false, @@ -10097,7 +10471,7 @@ "decorators": [] }, { - "$id": "718", + "$id": "736", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -10115,7 +10489,7 @@ "decorators": [] }, { - "$id": "719", + "$id": "737", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -10134,7 +10508,7 @@ ], "response": { "type": { - "$ref": "427" + "$ref": "445" } }, "isOverride": false, @@ -10143,7 +10517,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updatePetAsAnimal" }, { - "$id": "720", + "$id": "738", "kind": "basic", "name": "updateDogAsAnimal", "accessibility": "public", @@ -10153,14 +10527,14 @@ ], "doc": "Update a dog as an animal", "operation": { - "$id": "721", + "$id": "739", "name": "updateDogAsAnimal", "resourceName": "AnimalOperations", "doc": "Update a dog as an animal", "accessibility": "public", "parameters": [ { - "$id": "722", + "$id": "740", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -10177,7 +10551,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updateDogAsAnimal.contentType" }, { - "$id": "723", + "$id": "741", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -10193,12 +10567,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.AnimalOperations.updateDogAsAnimal.accept" }, { - "$id": "724", + "$id": "742", "kind": "body", "name": "animal", "serializedName": "animal", "type": { - "$ref": "427" + "$ref": "445" }, "isApiVersion": false, "contentTypes": [ @@ -10218,7 +10592,7 @@ 200 ], "bodyType": { - "$ref": "427" + "$ref": "445" }, "headers": [], "isErrorResponse": false, @@ -10242,12 +10616,12 @@ }, "parameters": [ { - "$id": "725", + "$id": "743", "kind": "method", "name": "animal", "serializedName": "animal", "type": { - "$ref": "427" + "$ref": "445" }, "location": "Body", "isApiVersion": false, @@ -10259,7 +10633,7 @@ "decorators": [] }, { - "$id": "726", + "$id": "744", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -10277,7 +10651,7 @@ "decorators": [] }, { - "$id": "727", + "$id": "745", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -10296,7 +10670,7 @@ ], "response": { "type": { - "$ref": "427" + "$ref": "445" } }, "isOverride": false, @@ -10307,12 +10681,12 @@ ], "parameters": [ { - "$id": "728", + "$id": "746", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "729", + "$id": "747", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -10335,18 +10709,18 @@ "2024-08-16-preview" ], "parent": { - "$ref": "456" + "$ref": "474" }, "isMultiServiceClient": false }, { - "$id": "730", + "$id": "748", "kind": "client", "name": "PetOperations", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "731", + "$id": "749", "kind": "basic", "name": "updatePetAsPet", "accessibility": "public", @@ -10356,14 +10730,14 @@ ], "doc": "Update a pet as a pet", "operation": { - "$id": "732", + "$id": "750", "name": "updatePetAsPet", "resourceName": "PetOperations", "doc": "Update a pet as a pet", "accessibility": "public", "parameters": [ { - "$id": "733", + "$id": "751", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -10380,7 +10754,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updatePetAsPet.contentType" }, { - "$id": "734", + "$id": "752", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -10396,12 +10770,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updatePetAsPet.accept" }, { - "$id": "735", + "$id": "753", "kind": "body", "name": "pet", "serializedName": "pet", "type": { - "$ref": "432" + "$ref": "450" }, "isApiVersion": false, "contentTypes": [ @@ -10421,7 +10795,7 @@ 200 ], "bodyType": { - "$ref": "432" + "$ref": "450" }, "headers": [], "isErrorResponse": false, @@ -10445,12 +10819,12 @@ }, "parameters": [ { - "$id": "736", + "$id": "754", "kind": "method", "name": "pet", "serializedName": "pet", "type": { - "$ref": "432" + "$ref": "450" }, "location": "Body", "isApiVersion": false, @@ -10462,7 +10836,7 @@ "decorators": [] }, { - "$id": "737", + "$id": "755", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -10480,7 +10854,7 @@ "decorators": [] }, { - "$id": "738", + "$id": "756", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -10499,7 +10873,7 @@ ], "response": { "type": { - "$ref": "432" + "$ref": "450" } }, "isOverride": false, @@ -10508,7 +10882,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updatePetAsPet" }, { - "$id": "739", + "$id": "757", "kind": "basic", "name": "updateDogAsPet", "accessibility": "public", @@ -10518,14 +10892,14 @@ ], "doc": "Update a dog as a pet", "operation": { - "$id": "740", + "$id": "758", "name": "updateDogAsPet", "resourceName": "PetOperations", "doc": "Update a dog as a pet", "accessibility": "public", "parameters": [ { - "$id": "741", + "$id": "759", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -10542,7 +10916,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updateDogAsPet.contentType" }, { - "$id": "742", + "$id": "760", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -10558,12 +10932,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.PetOperations.updateDogAsPet.accept" }, { - "$id": "743", + "$id": "761", "kind": "body", "name": "pet", "serializedName": "pet", "type": { - "$ref": "432" + "$ref": "450" }, "isApiVersion": false, "contentTypes": [ @@ -10583,7 +10957,7 @@ 200 ], "bodyType": { - "$ref": "432" + "$ref": "450" }, "headers": [], "isErrorResponse": false, @@ -10607,12 +10981,12 @@ }, "parameters": [ { - "$id": "744", + "$id": "762", "kind": "method", "name": "pet", "serializedName": "pet", "type": { - "$ref": "432" + "$ref": "450" }, "location": "Body", "isApiVersion": false, @@ -10624,7 +10998,7 @@ "decorators": [] }, { - "$id": "745", + "$id": "763", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -10642,7 +11016,7 @@ "decorators": [] }, { - "$id": "746", + "$id": "764", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -10661,7 +11035,7 @@ ], "response": { "type": { - "$ref": "432" + "$ref": "450" } }, "isOverride": false, @@ -10672,12 +11046,12 @@ ], "parameters": [ { - "$id": "747", + "$id": "765", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "748", + "$id": "766", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -10700,18 +11074,18 @@ "2024-08-16-preview" ], "parent": { - "$ref": "456" + "$ref": "474" }, "isMultiServiceClient": false }, { - "$id": "749", + "$id": "767", "kind": "client", "name": "DogOperations", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "750", + "$id": "768", "kind": "basic", "name": "updateDogAsDog", "accessibility": "public", @@ -10721,14 +11095,14 @@ ], "doc": "Update a dog as a dog", "operation": { - "$id": "751", + "$id": "769", "name": "updateDogAsDog", "resourceName": "DogOperations", "doc": "Update a dog as a dog", "accessibility": "public", "parameters": [ { - "$id": "752", + "$id": "770", "kind": "header", "name": "contentType", "serializedName": "Content-Type", @@ -10745,7 +11119,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.DogOperations.updateDogAsDog.contentType" }, { - "$id": "753", + "$id": "771", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -10761,12 +11135,12 @@ "crossLanguageDefinitionId": "SampleTypeSpec.DogOperations.updateDogAsDog.accept" }, { - "$id": "754", + "$id": "772", "kind": "body", "name": "dog", "serializedName": "dog", "type": { - "$ref": "436" + "$ref": "454" }, "isApiVersion": false, "contentTypes": [ @@ -10786,7 +11160,7 @@ 200 ], "bodyType": { - "$ref": "436" + "$ref": "454" }, "headers": [], "isErrorResponse": false, @@ -10810,12 +11184,12 @@ }, "parameters": [ { - "$id": "755", + "$id": "773", "kind": "method", "name": "dog", "serializedName": "dog", "type": { - "$ref": "436" + "$ref": "454" }, "location": "Body", "isApiVersion": false, @@ -10827,7 +11201,7 @@ "decorators": [] }, { - "$id": "756", + "$id": "774", "kind": "method", "name": "contentType", "serializedName": "Content-Type", @@ -10845,7 +11219,7 @@ "decorators": [] }, { - "$id": "757", + "$id": "775", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -10864,7 +11238,7 @@ ], "response": { "type": { - "$ref": "436" + "$ref": "454" } }, "isOverride": false, @@ -10875,12 +11249,12 @@ ], "parameters": [ { - "$id": "758", + "$id": "776", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "759", + "$id": "777", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -10903,18 +11277,18 @@ "2024-08-16-preview" ], "parent": { - "$ref": "456" + "$ref": "474" }, "isMultiServiceClient": false }, { - "$id": "760", + "$id": "778", "kind": "client", "name": "PlantOperations", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "761", + "$id": "779", "kind": "basic", "name": "getTree", "accessibility": "public", @@ -10924,14 +11298,14 @@ ], "doc": "Get a tree as a plant", "operation": { - "$id": "762", + "$id": "780", "name": "getTree", "resourceName": "PlantOperations", "doc": "Get a tree as a plant", "accessibility": "public", "parameters": [ { - "$id": "763", + "$id": "781", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -10953,7 +11327,7 @@ 200 ], "bodyType": { - "$ref": "440" + "$ref": "458" }, "headers": [ { @@ -10982,7 +11356,7 @@ }, "parameters": [ { - "$id": "764", + "$id": "782", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -11001,7 +11375,7 @@ ], "response": { "type": { - "$ref": "440" + "$ref": "458" } }, "isOverride": false, @@ -11012,12 +11386,12 @@ ], "parameters": [ { - "$id": "765", + "$id": "783", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "766", + "$id": "784", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -11040,18 +11414,18 @@ "2024-08-16-preview" ], "parent": { - "$ref": "456" + "$ref": "474" }, "isMultiServiceClient": false }, { - "$id": "767", + "$id": "785", "kind": "client", "name": "Metrics", "namespace": "SampleTypeSpec", "methods": [ { - "$id": "768", + "$id": "786", "kind": "basic", "name": "getWidgetMetrics", "accessibility": "public", @@ -11061,14 +11435,14 @@ ], "doc": "Get Widget metrics for given day of week", "operation": { - "$id": "769", + "$id": "787", "name": "getWidgetMetrics", "resourceName": "Metrics", "doc": "Get Widget metrics for given day of week", "accessibility": "public", "parameters": [ { - "$id": "770", + "$id": "788", "kind": "path", "name": "day", "serializedName": "day", @@ -11087,7 +11461,7 @@ "crossLanguageDefinitionId": "SampleTypeSpec.Metrics.getWidgetMetrics.day" }, { - "$id": "771", + "$id": "789", "kind": "header", "name": "accept", "serializedName": "Accept", @@ -11109,7 +11483,7 @@ 200 ], "bodyType": { - "$ref": "451" + "$ref": "469" }, "headers": [], "isErrorResponse": false, @@ -11130,7 +11504,7 @@ }, "parameters": [ { - "$id": "772", + "$id": "790", "kind": "method", "name": "day", "serializedName": "day", @@ -11147,7 +11521,7 @@ "decorators": [] }, { - "$id": "773", + "$id": "791", "kind": "method", "name": "accept", "serializedName": "Accept", @@ -11166,7 +11540,7 @@ ], "response": { "type": { - "$ref": "451" + "$ref": "469" } }, "isOverride": false, @@ -11177,12 +11551,12 @@ ], "parameters": [ { - "$id": "774", + "$id": "792", "kind": "endpoint", "name": "sampleTypeSpecUrl", "serializedName": "sampleTypeSpecUrl", "type": { - "$id": "775", + "$id": "793", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -11205,7 +11579,7 @@ "2024-08-16-preview" ], "parent": { - "$ref": "456" + "$ref": "474" }, "isMultiServiceClient": false } From 34f9f24cfa364996d31bd893c3aa243ca3eb583a Mon Sep 17 00:00:00 2001 From: Jorge Rangel Date: Thu, 5 Feb 2026 11:06:08 -0600 Subject: [PATCH 3/5] refactor serialization options --- .../src/Primitives/ScmSerializationOptions.cs | 22 ++++++++++++++ .../XmlSerializationNamespaceOptions.cs} | 6 ++-- .../Primitives/XmlSerializationOptions.cs} | 10 +++---- .../MrwSerializationTypeDefinition.Xml.cs | 18 +++++++----- .../src/ScmTypeFactory.cs | 4 +++ .../src/Primitives/PropertyWireInformation.cs | 6 ++-- .../src/Primitives/SerializationOptions.cs | 7 +++++ .../src/Primitives/WireInformation.cs | 1 + .../src/TypeFactory.cs | 29 +++++++++++++++++++ 9 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs rename packages/http-client-csharp/generator/{Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs => Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespaceOptions.cs} (63%) rename packages/http-client-csharp/generator/{Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs => Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationOptions.cs} (70%) create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/SerializationOptions.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs new file mode 100644 index 00000000000..9dcf52fa1d1 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Primitives; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Primitives +{ + public class ScmSerializationOptions : SerializationOptions + { + public ScmSerializationOptions(InputSerializationOptions inputSerializationOptions) : base() + { + Xml = inputSerializationOptions.Xml != null + ? new(inputSerializationOptions.Xml) + : null; + } + + public XmlSerializationOptions? Xml { get; } + + // TO-DO: Add remaining SCM serialization options https://github.com/microsoft/typespec/issues/5861. + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespaceOptions.cs similarity index 63% rename from packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs rename to packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespaceOptions.cs index 7b1645c2db5..65bea88d171 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireNamespaceOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespaceOptions.cs @@ -3,11 +3,11 @@ using Microsoft.TypeSpec.Generator.Input; -namespace Microsoft.TypeSpec.Generator.Primitives +namespace Microsoft.TypeSpec.Generator.ClientModel.Primitives { - public class XmlWireNamespaceOptions + public class XmlSerializationNamespaceOptions { - public XmlWireNamespaceOptions(InputXmlNamespaceOptions options) + public XmlSerializationNamespaceOptions(InputXmlNamespaceOptions options) { Namespace = options.Namespace; Prefix = options.Prefix; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationOptions.cs similarity index 70% rename from packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs rename to packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationOptions.cs index a8352ddddfa..b0fc59d67ca 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/XmlWireInformation.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationOptions.cs @@ -3,11 +3,11 @@ using Microsoft.TypeSpec.Generator.Input; -namespace Microsoft.TypeSpec.Generator.Primitives +namespace Microsoft.TypeSpec.Generator.ClientModel.Primitives { - public class XmlWireInformation + public class XmlSerializationOptions { - public XmlWireInformation(InputXmlSerializationOptions xmlOptions) + public XmlSerializationOptions(InputXmlSerializationOptions xmlOptions) { Name = xmlOptions.Name; Attribute = xmlOptions.Attribute; @@ -25,12 +25,12 @@ public XmlWireInformation(InputXmlSerializationOptions xmlOptions) public bool? Attribute { get; } - public XmlWireNamespaceOptions? Namespace { get; } + public XmlSerializationNamespaceOptions? Namespace { get; } public bool? Unwrapped { get; } public string? ItemsName { get; } - public XmlWireNamespaceOptions? ItemsNamespace { get; } + public XmlSerializationNamespaceOptions? ItemsNamespace { get; } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs index 9237c316b1f..90198c868d1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs @@ -8,6 +8,7 @@ using System.Net; using System.Text.Json; using System.Xml.Linq; +using Microsoft.TypeSpec.Generator.ClientModel.Primitives; using Microsoft.TypeSpec.Generator.ClientModel.Snippets; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Input; @@ -31,7 +32,7 @@ private record XmlPropertyInfo( string PropertyName, CSharpType PropertyType, VariableExpression PropertyExpression, - XmlWireInformation XmlWireInfo, + XmlSerializationOptions XmlWireInfo, SerializationFormat SerializationFormat, IEnumerable SerializationAttributes); @@ -95,9 +96,10 @@ private static MethodBodyStatement BuildXmlDiscriminatedModelsCondition( bool onlyContainsUnknownDerivedModel, ScopedApi elementParameter) { - if (!onlyContainsUnknownDerivedModel && discriminatorProperty?.WireInfo?.XmlWireInformation?.Name != null) + var xmlSerializationOptions = (discriminatorProperty?.WireInfo?.SerializationOptions as ScmSerializationOptions)?.Xml; + if (!onlyContainsUnknownDerivedModel && xmlSerializationOptions?.Name != null) { - var discriminatorElementName = discriminatorProperty.WireInfo.XmlWireInformation.Name; + var discriminatorElementName = xmlSerializationOptions.Name; var discriminatorElement = new VariableExpression(typeof(XElement), "discriminatorElement"); return new MethodBodyStatements( @@ -198,7 +200,7 @@ private XmlPropertyCategories CategorizeXmlProperties() } var wireInfo = parameter.Property?.WireInfo ?? parameter.Field?.WireInfo; - var xmlWireInfo = wireInfo?.XmlWireInformation; + var xmlWireInfo = (wireInfo?.SerializationOptions as ScmSerializationOptions)?.Xml; if (xmlWireInfo == null || wireInfo?.IsHttpMetadata == true) { continue; @@ -350,7 +352,7 @@ private MethodBodyStatement CreateXmlDeserializePropertyAssignment( ScopedApi childElement, CSharpType propertyType, VariableExpression propertyExpression, - XmlWireInformation xmlWireInfo, + XmlSerializationOptions xmlWireInfo, SerializationFormat serializationFormat, Dictionary? namespaces = null) { @@ -372,7 +374,7 @@ private MethodBodyStatement CreateXmlDeserializeListAssignment( ScopedApi childElement, CSharpType listType, VariableExpression listExpression, - XmlWireInformation xmlWireInfo, + XmlSerializationOptions xmlWireInfo, SerializationFormat serializationFormat, Dictionary? namespaces = null) { @@ -425,7 +427,7 @@ private MethodBodyStatement CreateXmlDeserializeDictionaryAssignment( ScopedApi childElement, CSharpType dictionaryType, VariableExpression dictionaryExpression, - XmlWireInformation xmlWireInfo, + XmlSerializationOptions xmlWireInfo, SerializationFormat serializationFormat) { var valueType = dictionaryType.ElementType; @@ -717,7 +719,7 @@ private MethodProvider BuildJsonAndXmlExplicitFromClientResult() this); } - private static void CollectNamespace(string propertyName, XmlWireNamespaceOptions nsOptions, Dictionary namespaces) + private static void CollectNamespace(string propertyName, XmlSerializationNamespaceOptions nsOptions, Dictionary namespaces) { if (!namespaces.ContainsKey(nsOptions.Namespace)) { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs index bd301b41e96..d1d644a638b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmTypeFactory.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; +using Microsoft.TypeSpec.Generator.ClientModel.Primitives; using Microsoft.TypeSpec.Generator.ClientModel.Providers; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Input; @@ -246,5 +247,8 @@ public virtual MethodBodyStatement SerializeJsonValue( => MrwSerializationTypeDefinition.SerializeJsonValueCore(valueType, value, utf8JsonWriter, mrwOptionsParameter, serializationFormat); protected override ModelProvider? CreateModelCore(InputModelType model) => new ScmModelProvider(model); + + protected override ScmSerializationOptions? CreateSerializationOptionsCore(InputSerializationOptions inputSerializationOptions) + => new(inputSerializationOptions); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs index 65a3c166bad..b7a2e85b87a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/PropertyWireInformation.cs @@ -16,7 +16,7 @@ public class PropertyWireInformation : WireInformation public bool IsHttpMetadata { get; } public bool IsApiVersion { get; } internal FormattableString? Description { get; } - public XmlWireInformation? XmlWireInformation { get; } + public SerializationOptions? SerializationOptions { get; } public PropertyWireInformation(SerializationFormat serializationFormat, bool isRequired, bool isReadOnly, bool isNullable, bool isDiscriminator, string serializedName, bool isHttpMetadata, bool isApiVersion) : base(serializationFormat, serializedName) @@ -45,8 +45,8 @@ internal PropertyWireInformation(InputProperty inputProperty) IsDiscriminator = modelProperty != null && modelProperty.IsDiscriminator; Description = DocHelpers.GetFormattableDescription(inputProperty.Summary, inputProperty.Doc); IsApiVersion = inputProperty.IsApiVersion; - XmlWireInformation = modelProperty?.SerializationOptions?.Xml != null - ? new XmlWireInformation(modelProperty.SerializationOptions.Xml) + SerializationOptions = modelProperty?.SerializationOptions != null + ? CodeModelGenerator.Instance.TypeFactory.CreateSerializationOptions(modelProperty.SerializationOptions) : null; } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/SerializationOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/SerializationOptions.cs new file mode 100644 index 00000000000..10914162ee3 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/SerializationOptions.cs @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.TypeSpec.Generator.Primitives +{ + public abstract class SerializationOptions { } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs index 91b50db58ef..72fdafc6802 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs @@ -8,6 +8,7 @@ namespace Microsoft.TypeSpec.Generator.Primitives public class WireInformation { public SerializationFormat SerializationFormat { get; } + public string SerializedName { get; internal set; } public WireInformation(SerializationFormat serializationFormat, string serializedName) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/TypeFactory.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/TypeFactory.cs index bd6a4d8c6dc..da80224b4cf 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/TypeFactory.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/TypeFactory.cs @@ -26,6 +26,7 @@ public class TypeFactory private Dictionary EnumCache { get; } = []; private Dictionary TypeCache { get; } = []; + private Dictionary SerializationOptionsCache { get; } = []; private Dictionary PropertyCache { get; } = []; @@ -423,6 +424,34 @@ public virtual NewProjectScaffolding CreateNewProjectScaffolding() return new NewProjectScaffolding(); } + /// + /// Creates serialization options for the given input serialization options. + /// + /// The input serialization options. + /// The serialization options, or null if not applicable. + public SerializationOptions? CreateSerializationOptions(InputSerializationOptions inputSerializationOptions) + { + if (SerializationOptionsCache.TryGetValue(inputSerializationOptions, out var options)) + { + return options; + } + + options = CreateSerializationOptionsCore(inputSerializationOptions); + SerializationOptionsCache.Add(inputSerializationOptions, options); + + return options; + } + + /// + /// Factory method for creating for the given input serialization options. + /// + /// The input serialization options. + /// The serialization options, or null if not applicable. + protected virtual SerializationOptions? CreateSerializationOptionsCore(InputSerializationOptions inputSerializationOptions) + { + return null; + } + private readonly struct EnumCacheKey { public InputEnumType EnumType { get; } From 0d6b094bef88d9a0eedcbd2b53db9d7b48135ecc Mon Sep 17 00:00:00 2001 From: Jorge Rangel Date: Thu, 5 Feb 2026 11:21:27 -0600 Subject: [PATCH 4/5] formatting --- docs/samples/client/csharp/SampleService/main.tsp | 2 +- .../src/Primitives/WireInformation.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/samples/client/csharp/SampleService/main.tsp b/docs/samples/client/csharp/SampleService/main.tsp index 8005008cb63..c2b189ecb0a 100644 --- a/docs/samples/client/csharp/SampleService/main.tsp +++ b/docs/samples/client/csharp/SampleService/main.tsp @@ -760,7 +760,7 @@ model Plant { } @doc("Tree is a specific type of plant") -@usage(Usage.xml | Usage.output | Usage.json ) +@usage(Usage.xml | Usage.output | Usage.json) model Tree extends Plant { species: "tree"; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs index 72fdafc6802..91b50db58ef 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/WireInformation.cs @@ -8,7 +8,6 @@ namespace Microsoft.TypeSpec.Generator.Primitives public class WireInformation { public SerializationFormat SerializationFormat { get; } - public string SerializedName { get; internal set; } public WireInformation(SerializationFormat serializationFormat, string serializedName) From 174041545cb2e2c35c85ccfa454dd37171356e0f Mon Sep 17 00:00:00 2001 From: Jorge Rangel Date: Thu, 5 Feb 2026 11:35:05 -0600 Subject: [PATCH 5/5] rename serialization options api --- .../src/Primitives/ScmSerializationOptions.cs | 2 +- ...{XmlSerializationOptions.cs => XmlSerialization.cs} | 8 ++++---- ...amespaceOptions.cs => XmlSerializationNamespace.cs} | 4 ++-- .../Providers/MrwSerializationTypeDefinition.Xml.cs | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) rename packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/{XmlSerializationOptions.cs => XmlSerialization.cs} (76%) rename packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/{XmlSerializationNamespaceOptions.cs => XmlSerializationNamespace.cs} (75%) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs index 9dcf52fa1d1..607db81f950 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/ScmSerializationOptions.cs @@ -15,7 +15,7 @@ public ScmSerializationOptions(InputSerializationOptions inputSerializationOptio : null; } - public XmlSerializationOptions? Xml { get; } + public XmlSerialization? Xml { get; } // TO-DO: Add remaining SCM serialization options https://github.com/microsoft/typespec/issues/5861. } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerialization.cs similarity index 76% rename from packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationOptions.cs rename to packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerialization.cs index b0fc59d67ca..404fc499a64 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerialization.cs @@ -5,9 +5,9 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Primitives { - public class XmlSerializationOptions + public class XmlSerialization { - public XmlSerializationOptions(InputXmlSerializationOptions xmlOptions) + public XmlSerialization(InputXmlSerializationOptions xmlOptions) { Name = xmlOptions.Name; Attribute = xmlOptions.Attribute; @@ -25,12 +25,12 @@ public XmlSerializationOptions(InputXmlSerializationOptions xmlOptions) public bool? Attribute { get; } - public XmlSerializationNamespaceOptions? Namespace { get; } + public XmlSerializationNamespace? Namespace { get; } public bool? Unwrapped { get; } public string? ItemsName { get; } - public XmlSerializationNamespaceOptions? ItemsNamespace { get; } + public XmlSerializationNamespace? ItemsNamespace { get; } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespaceOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespace.cs similarity index 75% rename from packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespaceOptions.cs rename to packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespace.cs index 65bea88d171..5bae1386c10 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespaceOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Primitives/XmlSerializationNamespace.cs @@ -5,9 +5,9 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Primitives { - public class XmlSerializationNamespaceOptions + public class XmlSerializationNamespace { - public XmlSerializationNamespaceOptions(InputXmlNamespaceOptions options) + public XmlSerializationNamespace(InputXmlNamespaceOptions options) { Namespace = options.Namespace; Prefix = options.Prefix; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs index 90198c868d1..d89d149d08e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs @@ -32,7 +32,7 @@ private record XmlPropertyInfo( string PropertyName, CSharpType PropertyType, VariableExpression PropertyExpression, - XmlSerializationOptions XmlWireInfo, + XmlSerialization XmlWireInfo, SerializationFormat SerializationFormat, IEnumerable SerializationAttributes); @@ -352,7 +352,7 @@ private MethodBodyStatement CreateXmlDeserializePropertyAssignment( ScopedApi childElement, CSharpType propertyType, VariableExpression propertyExpression, - XmlSerializationOptions xmlWireInfo, + XmlSerialization xmlWireInfo, SerializationFormat serializationFormat, Dictionary? namespaces = null) { @@ -374,7 +374,7 @@ private MethodBodyStatement CreateXmlDeserializeListAssignment( ScopedApi childElement, CSharpType listType, VariableExpression listExpression, - XmlSerializationOptions xmlWireInfo, + XmlSerialization xmlWireInfo, SerializationFormat serializationFormat, Dictionary? namespaces = null) { @@ -427,7 +427,7 @@ private MethodBodyStatement CreateXmlDeserializeDictionaryAssignment( ScopedApi childElement, CSharpType dictionaryType, VariableExpression dictionaryExpression, - XmlSerializationOptions xmlWireInfo, + XmlSerialization xmlWireInfo, SerializationFormat serializationFormat) { var valueType = dictionaryType.ElementType; @@ -719,7 +719,7 @@ private MethodProvider BuildJsonAndXmlExplicitFromClientResult() this); } - private static void CollectNamespace(string propertyName, XmlSerializationNamespaceOptions nsOptions, Dictionary namespaces) + private static void CollectNamespace(string propertyName, XmlSerializationNamespace nsOptions, Dictionary namespaces) { if (!namespaces.ContainsKey(nsOptions.Namespace)) {