diff --git a/packages/http-client-csharp/eng/scripts/Generate.ps1 b/packages/http-client-csharp/eng/scripts/Generate.ps1
index cc09a300b..93687095a 100644
--- a/packages/http-client-csharp/eng/scripts/Generate.ps1
+++ b/packages/http-client-csharp/eng/scripts/Generate.ps1
@@ -76,7 +76,6 @@ $failingSpecs = @(
Join-Path 'http' 'type' 'model' 'inheritance' 'not-discriminated'
Join-Path 'http' 'type' 'model' 'inheritance' 'recursive'
Join-Path 'http' 'type' 'property' 'additional-properties'
- Join-Path 'http' 'type' 'property' 'optionality'
Join-Path 'http' 'type' 'property' 'value-types'
)
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
index b22b8fb29..772249dfb 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
@@ -110,6 +110,11 @@
"commandName": "Executable",
"executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
},
+ "http-type-property-optionality": {
+ "commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/type/property/optionality -p StubLibraryPlugin",
+ "commandName": "Executable",
+ "executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
+ },
"http-type-scalar": {
"commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/type/scalar -p StubLibraryPlugin",
"commandName": "Executable",
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Encode/Bytes/EncodeBytesTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Encode/Bytes/EncodeBytesTests.cs
index b87889ead..673f26404 100644
--- a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Encode/Bytes/EncodeBytesTests.cs
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Encode/Bytes/EncodeBytesTests.cs
@@ -5,7 +5,6 @@ using System;
using System.ClientModel;
using System.IO;
using System.Threading.Tasks;
-using AutoRest.TestServer.Tests.Infrastructure;
using Encode.Bytes;
using Encode.Bytes.Models;
using NUnit.Framework;
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Property/Nullable/NullableTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Property/Nullable/NullableTests.cs
index fdab8886e..ea91310b0 100644
--- a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Property/Nullable/NullableTests.cs
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Property/Nullable/NullableTests.cs
@@ -7,7 +7,6 @@ using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using _Type.Property.Nullable;
-using AutoRest.TestServer.Tests.Infrastructure;
using NUnit.Framework;
namespace TestProjects.CadlRanch.Tests.Http._Type.Property.Nullable
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Property/Optionality/OptionalityTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Property/Optionality/OptionalityTests.cs
new file mode 100644
index 000000000..6c0b89961
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Property/Optionality/OptionalityTests.cs
@@ -0,0 +1,544 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Threading.Tasks;
+using System.Xml;
+using _Type.Property.Optional;
+using _Type.Property.Optional.Models;
+using NUnit.Framework;
+
+namespace TestProjects.CadlRanch.Tests.Http._Type.Property.Optionality
+{
+ internal class OptionalityTests : CadlRanchTestBase
+ {
+ [CadlRanchTest]
+ public Task BooleanLiteralGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetBooleanLiteralClient().GetAllAsync();
+ Assert.AreEqual(true, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task BooleanLiteralGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetBooleanLiteralClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task BooleanLiteralPutAll() => Test(async (host) =>
+ {
+ BooleanLiteralProperty data = new()
+ {
+ Property = true
+ };
+ var response = await new OptionalClient(host, null).GetBooleanLiteralClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task BooleanLiteralPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetBooleanLiteralClient().PutDefaultAsync(new BooleanLiteralProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task StringGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetStringClient().GetAllAsync();
+ Assert.AreEqual("hello", response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task StringGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetStringClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task StringPutAll() => Test(async (host) =>
+ {
+ StringProperty data = new()
+ {
+ Property = "hello"
+ };
+ var response = await new OptionalClient(host, null).GetStringClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task StringPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetStringClient().PutDefaultAsync(new StringProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task BytesGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetBytesClient().GetAllAsync();
+ BinaryDataAssert.AreEqual(BinaryData.FromString("hello, world!"), response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task BytesGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetBytesClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task BytesPutAll() => Test(async (host) =>
+ {
+ BytesProperty data = new()
+ {
+ Property = BinaryData.FromString("hello, world!")
+ };
+ var response = await new OptionalClient(host, null).GetBytesClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task BytesPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetBytesClient().PutDefaultAsync(new BytesProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task DatetimeGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetDatetimeClient().GetAllAsync();
+ Assert.AreEqual(DateTimeOffset.Parse("2022-08-26T18:38:00Z"), response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task DatetimeGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetDatetimeClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task DatetimePutAll() => Test(async (host) =>
+ {
+ DatetimeProperty data = new()
+ {
+ Property = DateTimeOffset.Parse("2022-08-26T18:38:00Z")
+ };
+ var response = await new OptionalClient(host, null).GetDatetimeClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task DatetimePutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetDatetimeClient().PutDefaultAsync(new DatetimeProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task PlaindateGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetPlainDateClient().GetAllAsync();
+ var expectedDate = new DateTimeOffset(2022, 12, 12, 8, 0, 0, TimeSpan.FromHours(8));
+ Assert.AreEqual(expectedDate, response.Value.Property!.Value.ToOffset(TimeSpan.FromHours(8)));
+ });
+
+ [CadlRanchTest]
+ public Task PlaindateGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetPlainDateClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task PlaindatePutAll() => Test(async (host) =>
+ {
+ PlainDateProperty data = new()
+ {
+ Property = DateTimeOffset.Parse("2022-12-12")
+ };
+ var response = await new OptionalClient(host, null).GetPlainDateClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task PlaindatePutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetPlainDateClient().PutDefaultAsync(new PlainDateProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task PlaintimeGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetPlainTimeClient().GetAllAsync();
+ Assert.AreEqual(TimeSpan.Parse("13:06:12"), response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task PlaintimeGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetPlainTimeClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task PlaintimePutAll() => Test(async (host) =>
+ {
+ PlainTimeProperty data = new()
+ {
+ Property = TimeSpan.Parse("13:06:12")
+ };
+ var response = await new OptionalClient(host, null).GetPlainTimeClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task PlaintimePutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetPlainTimeClient().PutDefaultAsync(new PlainTimeProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task DurationGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetDurationClient().GetAllAsync();
+ Assert.AreEqual(XmlConvert.ToTimeSpan("P123DT22H14M12.011S"), response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task DurationGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetDurationClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task DurationPutAll() => Test(async (host) =>
+ {
+ DurationProperty data = new()
+ {
+ Property = XmlConvert.ToTimeSpan("P123DT22H14M12.011S")
+ };
+ var response = await new OptionalClient(host, null).GetDurationClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task DurationPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetDurationClient().PutDefaultAsync(new DurationProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task CollectionsByteGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetCollectionsByteClient().GetAllAsync();
+ BinaryDataAssert.AreEqual(BinaryData.FromString("hello, world!"), response.Value.Property[0]);
+ BinaryDataAssert.AreEqual(BinaryData.FromString("hello, world!"), response.Value.Property[1]);
+ });
+
+ [CadlRanchTest]
+ public Task CollectionsByteGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetCollectionsByteClient().GetDefaultAsync();
+ Assert.AreEqual(0, response.Value.Property.Count);
+ });
+
+ [CadlRanchTest]
+ public Task CollectionsBytePutAll() => Test(async (host) =>
+ {
+ CollectionsByteProperty data = new();
+ data.Property.Add(BinaryData.FromString("hello, world!"));
+ data.Property.Add(BinaryData.FromString("hello, world!"));
+
+ var response = await new OptionalClient(host, null).GetCollectionsByteClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task CollectionsBytePutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetCollectionsByteClient().PutDefaultAsync(new CollectionsByteProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+
+ [CadlRanchTest]
+ public Task CollectionsModelGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetCollectionsModelClient().GetAllAsync();
+ var result = response.Value;
+ Assert.AreEqual("hello", result.Property[0].Property);
+ Assert.AreEqual("world", result.Property[1].Property);
+ Assert.AreEqual(2, result.Property.Count);
+ });
+
+ [CadlRanchTest]
+ public Task CollectionsModelGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetCollectionsModelClient().GetDefaultAsync();
+ Assert.AreEqual(0, response.Value.Property.Count);
+ });
+
+ [CadlRanchTest]
+ public Task CollectionsModelPutAll() => Test(async (host) =>
+ {
+ CollectionsModelProperty data = new();
+ data.Property.Add(new StringProperty()
+ {
+ Property = "hello"
+ });
+ data.Property.Add(new StringProperty()
+ {
+ Property = "world"
+ });
+
+ var response = await new OptionalClient(host, null).GetCollectionsModelClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task CollectionsModelPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetCollectionsModelClient().PutDefaultAsync(new CollectionsModelProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task RequiredAndOptionalGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetRequiredAndOptionalClient().GetAllAsync();
+ var result = response.Value;
+ Assert.AreEqual("hello", result.OptionalProperty);
+ Assert.AreEqual(42, result.RequiredProperty);
+ });
+
+ [CadlRanchTest]
+ public Task RequiredAndOptionalGetRequiredOnly() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetRequiredAndOptionalClient().GetRequiredOnlyAsync();
+ var result = response.Value;
+ Assert.AreEqual(null, result.OptionalProperty);
+ Assert.AreEqual(42, result.RequiredProperty);
+ });
+
+ [CadlRanchTest]
+ public Task RequiredAndOptionalPutAll() => Test(async (host) =>
+ {
+ var content = new RequiredAndOptionalProperty(42)
+ {
+ OptionalProperty = "hello"
+ };
+
+ var response = await new OptionalClient(host, null).GetRequiredAndOptionalClient().PutAllAsync(content);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task RequiredAndOptionalPutRequiredOnly() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetRequiredAndOptionalClient().PutRequiredOnlyAsync(new RequiredAndOptionalProperty(42));
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task FloatLiteralGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetFloatLiteralClient().GetAllAsync();
+ Assert.AreEqual(FloatLiteralPropertyProperty._125, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task FloatLiteralGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetFloatLiteralClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task FloatLiteralPutAll() => Test(async (host) =>
+ {
+ FloatLiteralProperty data = new()
+ {
+ Property = new FloatLiteralPropertyProperty(1.25f)
+ };
+ var response = await new OptionalClient(host, null).GetFloatLiteralClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task FloatLiteralPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetFloatLiteralClient().PutDefaultAsync(new FloatLiteralProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task IntLiteralGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetIntLiteralClient().GetAllAsync();
+ Assert.AreEqual(IntLiteralPropertyProperty._1, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task IntLiteralGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetIntLiteralClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task IntLiteralPutAll() => Test(async (host) =>
+ {
+ IntLiteralProperty data = new()
+ {
+ Property = 1
+ };
+ var response = await new OptionalClient(host, null).GetIntLiteralClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task IntLiteralPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetIntLiteralClient().PutDefaultAsync(new IntLiteralProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task StringLiteralGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetStringLiteralClient().GetAllAsync();
+ Assert.AreEqual(StringLiteralPropertyProperty.Hello, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task StringLiteralGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetStringLiteralClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task StringLiteralPutAll() => Test(async (host) =>
+ {
+ StringLiteralProperty data = new()
+ {
+ Property = "hello"
+ };
+ var response = await new OptionalClient(host, null).GetStringLiteralClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task StringLiteralPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetStringLiteralClient().PutDefaultAsync(new StringLiteralProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task UnionFloatLiteralGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionFloatLiteralClient().GetAllAsync();
+ Assert.AreEqual(UnionFloatLiteralPropertyProperty._2375, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task UnionFloatLiteralGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionFloatLiteralClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task UnionFloatLiteralPutAll() => Test(async (host) =>
+ {
+ UnionFloatLiteralProperty data = new()
+ {
+ Property = UnionFloatLiteralPropertyProperty._2375
+ };
+ var response = await new OptionalClient(host, null).GetUnionFloatLiteralClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task UnionFloatLiteralPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionFloatLiteralClient().PutDefaultAsync(new UnionFloatLiteralProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task UnionIntLiteralGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionIntLiteralClient().GetAllAsync();
+ Assert.AreEqual(UnionIntLiteralPropertyProperty._2, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task UnionIntLiteralGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionIntLiteralClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task UnionIntLiteralGutAll() => Test(async (host) =>
+ {
+ UnionIntLiteralProperty data = new()
+ {
+ Property = UnionIntLiteralPropertyProperty._2
+ };
+ var response = await new OptionalClient(host, null).GetUnionIntLiteralClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task UnionIntLiteralPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionIntLiteralClient().PutDefaultAsync(new UnionIntLiteralProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task UnionStringLiteralGetAll() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionStringLiteralClient().GetAllAsync();
+ Assert.AreEqual(UnionStringLiteralPropertyProperty.World, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task UnionStringLiteralGetDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionStringLiteralClient().GetDefaultAsync();
+ Assert.AreEqual(null, response.Value.Property);
+ });
+
+ [CadlRanchTest]
+ public Task UnionStringLiteralPutAll() => Test(async (host) =>
+ {
+ UnionStringLiteralProperty data = new()
+ {
+ Property = UnionStringLiteralPropertyProperty.World,
+ };
+ var response = await new OptionalClient(host, null).GetUnionStringLiteralClient().PutAllAsync(data);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task UnionStringLiteralPutDefault() => Test(async (host) =>
+ {
+ var response = await new OptionalClient(host, null).GetUnionStringLiteralClient().PutDefaultAsync(new UnionStringLiteralProperty());
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Union/UnionTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Union/UnionTests.cs
index a1c9dee3a..69db503e0 100644
--- a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Union/UnionTests.cs
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/_Type/Union/UnionTests.cs
@@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using _Type.Union;
using _Type.Union.Models;
-using AutoRest.TestServer.Tests.Infrastructure;
using NUnit.Framework;
namespace TestProjects.CadlRanch.Tests.Http._Type.Union
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Infrastructure/BinaryDataAssert.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Infrastructure/BinaryDataAssert.cs
index f16821e41..ddddc89ad 100644
--- a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Infrastructure/BinaryDataAssert.cs
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Infrastructure/BinaryDataAssert.cs
@@ -4,7 +4,7 @@
using System;
using NUnit.Framework;
-namespace AutoRest.TestServer.Tests.Infrastructure
+namespace TestProjects.CadlRanch.Tests
{
public static class BinaryDataAssert
{
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/Configuration.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/Configuration.json
new file mode 100644
index 000000000..745555c8c
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/Configuration.json
@@ -0,0 +1,6 @@
+{
+ "output-folder": ".",
+ "namespace": "Type.Property.Optional",
+ "library-name": "Type.Property.Optional",
+ "use-model-reader-writer": true
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/_Type.Property.Optional.sln b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/_Type.Property.Optional.sln
new file mode 100644
index 000000000..b3130430d
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/_Type.Property.Optional.sln
@@ -0,0 +1,48 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Type.Property.Optional", "src\_Type.Property.Optional.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/BooleanLiteral.cs
new file mode 100644
index 000000000..ed940ad96
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/BooleanLiteral.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class BooleanLiteral
+ {
+ protected BooleanLiteral() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(BooleanLiteralProperty body) => throw null;
+
+ public virtual Task PutAllAsync(BooleanLiteralProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(BooleanLiteralProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(BooleanLiteralProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Bytes.cs
new file mode 100644
index 000000000..d1c9c09ea
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Bytes.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class Bytes
+ {
+ protected Bytes() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(BytesProperty body) => throw null;
+
+ public virtual Task PutAllAsync(BytesProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(BytesProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(BytesProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/CollectionsByte.cs
new file mode 100644
index 000000000..4cbd1f8cb
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/CollectionsByte.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class CollectionsByte
+ {
+ protected CollectionsByte() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(CollectionsByteProperty body) => throw null;
+
+ public virtual Task PutAllAsync(CollectionsByteProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(CollectionsByteProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(CollectionsByteProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/CollectionsModel.cs
new file mode 100644
index 000000000..6b3cbef1b
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/CollectionsModel.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class CollectionsModel
+ {
+ protected CollectionsModel() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(CollectionsModelProperty body) => throw null;
+
+ public virtual Task PutAllAsync(CollectionsModelProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(CollectionsModelProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(CollectionsModelProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Datetime.cs
new file mode 100644
index 000000000..89b236ff2
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Datetime.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class Datetime
+ {
+ protected Datetime() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(DatetimeProperty body) => throw null;
+
+ public virtual Task PutAllAsync(DatetimeProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(DatetimeProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(DatetimeProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Duration.cs
new file mode 100644
index 000000000..8d82dffa2
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Duration.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class Duration
+ {
+ protected Duration() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(DurationProperty body) => throw null;
+
+ public virtual Task PutAllAsync(DurationProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(DurationProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(DurationProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/FloatLiteral.cs
new file mode 100644
index 000000000..9ed91b036
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/FloatLiteral.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class FloatLiteral
+ {
+ protected FloatLiteral() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(FloatLiteralProperty body) => throw null;
+
+ public virtual Task PutAllAsync(FloatLiteralProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(FloatLiteralProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(FloatLiteralProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/IntLiteral.cs
new file mode 100644
index 000000000..d9ffb6712
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/IntLiteral.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class IntLiteral
+ {
+ protected IntLiteral() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(IntLiteralProperty body) => throw null;
+
+ public virtual Task PutAllAsync(IntLiteralProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(IntLiteralProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(IntLiteralProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.Serialization.cs
new file mode 100644
index 000000000..599f0591b
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class BooleanLiteralProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ BooleanLiteralProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BooleanLiteralProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.cs
new file mode 100644
index 000000000..06426c497
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BooleanLiteralProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class BooleanLiteralProperty
+ {
+ public BooleanLiteralProperty() => throw null;
+
+ public bool? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BytesProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BytesProperty.Serialization.cs
new file mode 100644
index 000000000..7cd9bb680
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BytesProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class BytesProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ BytesProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BytesProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/BytesProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BytesProperty.cs
new file mode 100644
index 000000000..b049ec177
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/BytesProperty.cs
@@ -0,0 +1,20 @@
+//
+
+#nullable disable
+
+using System;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class BytesProperty
+ {
+ public BytesProperty() => throw null;
+
+ public BinaryData Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.Serialization.cs
new file mode 100644
index 000000000..009bc213f
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class CollectionsByteProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ CollectionsByteProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual CollectionsByteProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ CollectionsByteProperty IPersistableModel.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/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.cs
new file mode 100644
index 000000000..c8a0ceb2e
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsByteProperty.cs
@@ -0,0 +1,16 @@
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class CollectionsByteProperty
+ {
+ public CollectionsByteProperty() => throw null;
+
+ public IList Property => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.Serialization.cs
new file mode 100644
index 000000000..10d5fb0a5
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class CollectionsModelProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ CollectionsModelProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual CollectionsModelProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ CollectionsModelProperty IPersistableModel.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/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.cs
new file mode 100644
index 000000000..cbd52c6be
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/CollectionsModelProperty.cs
@@ -0,0 +1,15 @@
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class CollectionsModelProperty
+ {
+ public CollectionsModelProperty() => throw null;
+
+ public IList Property => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DatetimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DatetimeProperty.Serialization.cs
new file mode 100644
index 000000000..2c6955ddd
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DatetimeProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class DatetimeProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ DatetimeProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual DatetimeProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/DatetimeProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DatetimeProperty.cs
new file mode 100644
index 000000000..fc31217fb
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DatetimeProperty.cs
@@ -0,0 +1,20 @@
+//
+
+#nullable disable
+
+using System;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class DatetimeProperty
+ {
+ public DatetimeProperty() => throw null;
+
+ public DateTimeOffset? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DurationProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DurationProperty.Serialization.cs
new file mode 100644
index 000000000..bc52b8167
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DurationProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class DurationProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ DurationProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual DurationProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/DurationProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DurationProperty.cs
new file mode 100644
index 000000000..d6ed344aa
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/DurationProperty.cs
@@ -0,0 +1,20 @@
+//
+
+#nullable disable
+
+using System;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class DurationProperty
+ {
+ public DurationProperty() => throw null;
+
+ public TimeSpan? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.Serialization.cs
new file mode 100644
index 000000000..74daa15e4
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class FloatLiteralProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ FloatLiteralProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual FloatLiteralProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.cs
new file mode 100644
index 000000000..378b5d0a4
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class FloatLiteralProperty
+ {
+ public FloatLiteralProperty() => throw null;
+
+ public FloatLiteralPropertyProperty? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralPropertyProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralPropertyProperty.Serialization.cs
new file mode 100644
index 000000000..835345a28
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralPropertyProperty.Serialization.cs
@@ -0,0 +1,10 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public readonly partial struct FloatLiteralPropertyProperty
+ {
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralPropertyProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralPropertyProperty.cs
new file mode 100644
index 000000000..2cd0ab6fe
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/FloatLiteralPropertyProperty.cs
@@ -0,0 +1,31 @@
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace _Type.Property.Optional.Models
+{
+ public readonly partial struct FloatLiteralPropertyProperty : IEquatable
+ {
+ public FloatLiteralPropertyProperty(float value) => throw null;
+
+ public static FloatLiteralPropertyProperty _125 => throw null;
+
+ public static bool operator ==(FloatLiteralPropertyProperty left, FloatLiteralPropertyProperty right) => throw null;
+
+ public static bool operator !=(FloatLiteralPropertyProperty left, FloatLiteralPropertyProperty right) => throw null;
+
+ public static implicit operator FloatLiteralPropertyProperty(float value) => throw null;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => throw null;
+
+ public bool Equals(FloatLiteralPropertyProperty other) => throw null;
+
+ public override int GetHashCode() => throw null;
+
+ public override string ToString() => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.Serialization.cs
new file mode 100644
index 000000000..5b68e8a49
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class IntLiteralProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ IntLiteralProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual IntLiteralProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.cs
new file mode 100644
index 000000000..d55cf030f
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class IntLiteralProperty
+ {
+ public IntLiteralProperty() => throw null;
+
+ public IntLiteralPropertyProperty? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralPropertyProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralPropertyProperty.Serialization.cs
new file mode 100644
index 000000000..143706669
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralPropertyProperty.Serialization.cs
@@ -0,0 +1,10 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public readonly partial struct IntLiteralPropertyProperty
+ {
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralPropertyProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralPropertyProperty.cs
new file mode 100644
index 000000000..4dc8ec4c6
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/IntLiteralPropertyProperty.cs
@@ -0,0 +1,31 @@
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace _Type.Property.Optional.Models
+{
+ public readonly partial struct IntLiteralPropertyProperty : IEquatable
+ {
+ public IntLiteralPropertyProperty(int value) => throw null;
+
+ public static IntLiteralPropertyProperty _1 => throw null;
+
+ public static bool operator ==(IntLiteralPropertyProperty left, IntLiteralPropertyProperty right) => throw null;
+
+ public static bool operator !=(IntLiteralPropertyProperty left, IntLiteralPropertyProperty right) => throw null;
+
+ public static implicit operator IntLiteralPropertyProperty(int value) => throw null;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => throw null;
+
+ public bool Equals(IntLiteralPropertyProperty other) => throw null;
+
+ public override int GetHashCode() => throw null;
+
+ public override string ToString() => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainDateProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainDateProperty.Serialization.cs
new file mode 100644
index 000000000..d9344cbc6
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainDateProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class PlainDateProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ PlainDateProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual PlainDateProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainDateProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainDateProperty.cs
new file mode 100644
index 000000000..f89f2ec3b
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainDateProperty.cs
@@ -0,0 +1,20 @@
+//
+
+#nullable disable
+
+using System;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class PlainDateProperty
+ {
+ public PlainDateProperty() => throw null;
+
+ public DateTimeOffset? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.Serialization.cs
new file mode 100644
index 000000000..76d6cd72f
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class PlainTimeProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ PlainTimeProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual PlainTimeProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.cs
new file mode 100644
index 000000000..b074f737a
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/PlainTimeProperty.cs
@@ -0,0 +1,20 @@
+//
+
+#nullable disable
+
+using System;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class PlainTimeProperty
+ {
+ public PlainTimeProperty() => throw null;
+
+ public TimeSpan? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.Serialization.cs
new file mode 100644
index 000000000..60821360a
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class RequiredAndOptionalProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ RequiredAndOptionalProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual RequiredAndOptionalProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ RequiredAndOptionalProperty IPersistableModel.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/CadlRanch/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.cs
new file mode 100644
index 000000000..cf2e60633
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/RequiredAndOptionalProperty.cs
@@ -0,0 +1,25 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class RequiredAndOptionalProperty
+ {
+ public RequiredAndOptionalProperty(int requiredProperty) => throw null;
+
+ public string OptionalProperty
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+
+ public int RequiredProperty
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.Serialization.cs
new file mode 100644
index 000000000..763365bcc
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class StringLiteralProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ StringLiteralProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual StringLiteralProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.cs
new file mode 100644
index 000000000..bcd3f4d62
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class StringLiteralProperty
+ {
+ public StringLiteralProperty() => throw null;
+
+ public StringLiteralPropertyProperty? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralPropertyProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralPropertyProperty.cs
new file mode 100644
index 000000000..0abcb186e
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringLiteralPropertyProperty.cs
@@ -0,0 +1,31 @@
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace _Type.Property.Optional.Models
+{
+ public readonly partial struct StringLiteralPropertyProperty : IEquatable
+ {
+ public StringLiteralPropertyProperty(string value) => throw null;
+
+ public static StringLiteralPropertyProperty Hello => throw null;
+
+ public static bool operator ==(StringLiteralPropertyProperty left, StringLiteralPropertyProperty right) => throw null;
+
+ public static bool operator !=(StringLiteralPropertyProperty left, StringLiteralPropertyProperty right) => throw null;
+
+ public static implicit operator StringLiteralPropertyProperty(string value) => throw null;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => throw null;
+
+ public bool Equals(StringLiteralPropertyProperty other) => throw null;
+
+ public override int GetHashCode() => throw null;
+
+ public override string ToString() => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringProperty.Serialization.cs
new file mode 100644
index 000000000..666a9e756
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class StringProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ StringProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual StringProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ 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/CadlRanch/http/type/property/optionality/src/Generated/Models/StringProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringProperty.cs
new file mode 100644
index 000000000..187df5c64
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/StringProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class StringProperty
+ {
+ public StringProperty() => throw null;
+
+ public string Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs
new file mode 100644
index 000000000..4c817a314
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class UnionFloatLiteralProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ UnionFloatLiteralProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual UnionFloatLiteralProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ UnionFloatLiteralProperty IPersistableModel.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/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.cs
new file mode 100644
index 000000000..fb36530d1
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class UnionFloatLiteralProperty
+ {
+ public UnionFloatLiteralProperty() => throw null;
+
+ public UnionFloatLiteralPropertyProperty? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralPropertyProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralPropertyProperty.cs
new file mode 100644
index 000000000..1cc8f5512
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionFloatLiteralPropertyProperty.cs
@@ -0,0 +1,14 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public enum UnionFloatLiteralPropertyProperty
+ {
+ /// _125.
+ _125,
+ /// _2375.
+ _2375
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs
new file mode 100644
index 000000000..6da8fcea6
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class UnionIntLiteralProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ UnionIntLiteralProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual UnionIntLiteralProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ UnionIntLiteralProperty IPersistableModel.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/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.cs
new file mode 100644
index 000000000..b21fbc95a
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class UnionIntLiteralProperty
+ {
+ public UnionIntLiteralProperty() => throw null;
+
+ public UnionIntLiteralPropertyProperty? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralPropertyProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralPropertyProperty.cs
new file mode 100644
index 000000000..3f52e7f44
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionIntLiteralPropertyProperty.cs
@@ -0,0 +1,14 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public enum UnionIntLiteralPropertyProperty
+ {
+ /// _1.
+ _1 = 1,
+ /// _2.
+ _2 = 2
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs
new file mode 100644
index 000000000..fc4394b18
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.Serialization.cs
@@ -0,0 +1,36 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class UnionStringLiteralProperty : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null;
+
+ UnionStringLiteralProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ protected virtual UnionStringLiteralProperty JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null;
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null;
+
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null;
+
+ UnionStringLiteralProperty IPersistableModel.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/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.cs
new file mode 100644
index 000000000..2a1475a6a
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralProperty.cs
@@ -0,0 +1,18 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public partial class UnionStringLiteralProperty
+ {
+ public UnionStringLiteralProperty() => throw null;
+
+ public UnionStringLiteralPropertyProperty? Property
+ {
+ get => throw null;
+ set => throw null;
+ }
+
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralPropertyProperty.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralPropertyProperty.cs
new file mode 100644
index 000000000..1b91f2b3e
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/Models/UnionStringLiteralPropertyProperty.cs
@@ -0,0 +1,14 @@
+//
+
+#nullable disable
+
+namespace _Type.Property.Optional.Models
+{
+ public enum UnionStringLiteralPropertyProperty
+ {
+ /// Hello.
+ Hello,
+ /// World.
+ World
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/OptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/OptionalClient.cs
new file mode 100644
index 000000000..6f67bdc1b
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/OptionalClient.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+
+namespace _Type.Property.Optional
+{
+ public partial class OptionalClient
+ {
+ public OptionalClient() : this(new Uri("http://localhost:3000"), new OptionalClientOptions()) => throw null;
+
+ public OptionalClient(Uri endpoint, OptionalClientOptions options) => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual String GetStringClient() => throw null;
+
+ public virtual Bytes GetBytesClient() => throw null;
+
+ public virtual Datetime GetDatetimeClient() => throw null;
+
+ public virtual Duration GetDurationClient() => throw null;
+
+ public virtual PlainDate GetPlainDateClient() => throw null;
+
+ public virtual PlainTime GetPlainTimeClient() => throw null;
+
+ public virtual CollectionsByte GetCollectionsByteClient() => throw null;
+
+ public virtual CollectionsModel GetCollectionsModelClient() => throw null;
+
+ public virtual StringLiteral GetStringLiteralClient() => throw null;
+
+ public virtual IntLiteral GetIntLiteralClient() => throw null;
+
+ public virtual FloatLiteral GetFloatLiteralClient() => throw null;
+
+ public virtual BooleanLiteral GetBooleanLiteralClient() => throw null;
+
+ public virtual UnionStringLiteral GetUnionStringLiteralClient() => throw null;
+
+ public virtual UnionIntLiteral GetUnionIntLiteralClient() => throw null;
+
+ public virtual UnionFloatLiteral GetUnionFloatLiteralClient() => throw null;
+
+ public virtual RequiredAndOptional GetRequiredAndOptionalClient() => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/OptionalClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/OptionalClientOptions.cs
new file mode 100644
index 000000000..a9ffaadfe
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/OptionalClientOptions.cs
@@ -0,0 +1,12 @@
+//
+
+#nullable disable
+
+using System.ClientModel.Primitives;
+
+namespace _Type.Property.Optional
+{
+ public partial class OptionalClientOptions : ClientPipelineOptions
+ {
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/PlainDate.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/PlainDate.cs
new file mode 100644
index 000000000..0a685dce5
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/PlainDate.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class PlainDate
+ {
+ protected PlainDate() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(PlainDateProperty body) => throw null;
+
+ public virtual Task PutAllAsync(PlainDateProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(PlainDateProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(PlainDateProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/PlainTime.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/PlainTime.cs
new file mode 100644
index 000000000..2eb66b62a
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/PlainTime.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class PlainTime
+ {
+ protected PlainTime() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(PlainTimeProperty body) => throw null;
+
+ public virtual Task PutAllAsync(PlainTimeProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(PlainTimeProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(PlainTimeProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/RequiredAndOptional.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/RequiredAndOptional.cs
new file mode 100644
index 000000000..91e5fd158
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/RequiredAndOptional.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class RequiredAndOptional
+ {
+ protected RequiredAndOptional() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetRequiredOnly(RequestOptions options) => throw null;
+
+ public virtual Task GetRequiredOnlyAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetRequiredOnly() => throw null;
+
+ public virtual Task> GetRequiredOnlyAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(RequiredAndOptionalProperty body) => throw null;
+
+ public virtual Task PutAllAsync(RequiredAndOptionalProperty body) => throw null;
+
+ public virtual ClientResult PutRequiredOnly(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutRequiredOnlyAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutRequiredOnly(RequiredAndOptionalProperty body) => throw null;
+
+ public virtual Task PutRequiredOnlyAsync(RequiredAndOptionalProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/String.cs
new file mode 100644
index 000000000..d62a726a8
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/String.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class String
+ {
+ protected String() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(StringProperty body) => throw null;
+
+ public virtual Task PutAllAsync(StringProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(StringProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(StringProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/StringLiteral.cs
new file mode 100644
index 000000000..d829db3da
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/StringLiteral.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class StringLiteral
+ {
+ protected StringLiteral() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(StringLiteralProperty body) => throw null;
+
+ public virtual Task PutAllAsync(StringLiteralProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(StringLiteralProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(StringLiteralProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/TypePropertyOptionalModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/TypePropertyOptionalModelFactory.cs
new file mode 100644
index 000000000..10e459179
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/TypePropertyOptionalModelFactory.cs
@@ -0,0 +1,44 @@
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace _Type.Property.Optional.Models
+{
+ public static partial class TypePropertyOptionalModelFactory
+ {
+ public static RequiredAndOptionalProperty RequiredAndOptionalProperty(string optionalProperty = default, int requiredProperty = default) => throw null;
+
+ public static UnionFloatLiteralProperty UnionFloatLiteralProperty(UnionFloatLiteralPropertyProperty? @property = default) => throw null;
+
+ public static UnionIntLiteralProperty UnionIntLiteralProperty(UnionIntLiteralPropertyProperty? @property = default) => throw null;
+
+ public static UnionStringLiteralProperty UnionStringLiteralProperty(UnionStringLiteralPropertyProperty? @property = default) => throw null;
+
+ public static BooleanLiteralProperty BooleanLiteralProperty(bool? @property = default) => throw null;
+
+ public static FloatLiteralProperty FloatLiteralProperty(FloatLiteralPropertyProperty? @property = default) => throw null;
+
+ public static IntLiteralProperty IntLiteralProperty(IntLiteralPropertyProperty? @property = default) => throw null;
+
+ public static StringLiteralProperty StringLiteralProperty(StringLiteralPropertyProperty? @property = default) => throw null;
+
+ public static CollectionsModelProperty CollectionsModelProperty(IEnumerable @property = default) => throw null;
+
+ public static StringProperty StringProperty(string @property = default) => throw null;
+
+ public static CollectionsByteProperty CollectionsByteProperty(IEnumerable @property = default) => throw null;
+
+ public static PlainTimeProperty PlainTimeProperty(TimeSpan? @property = default) => throw null;
+
+ public static PlainDateProperty PlainDateProperty(DateTimeOffset? @property = default) => throw null;
+
+ public static DurationProperty DurationProperty(TimeSpan? @property = default) => throw null;
+
+ public static DatetimeProperty DatetimeProperty(DateTimeOffset? @property = default) => throw null;
+
+ public static BytesProperty BytesProperty(BinaryData @property = default) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs
new file mode 100644
index 000000000..0ce9d65d5
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class UnionFloatLiteral
+ {
+ protected UnionFloatLiteral() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(UnionFloatLiteralProperty body) => throw null;
+
+ public virtual Task PutAllAsync(UnionFloatLiteralProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(UnionFloatLiteralProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(UnionFloatLiteralProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionIntLiteral.cs
new file mode 100644
index 000000000..c20252ba2
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionIntLiteral.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class UnionIntLiteral
+ {
+ protected UnionIntLiteral() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetAll() => throw null;
+
+ public virtual Task> GetAllAsync() => throw null;
+
+ public virtual ClientResult GetDefault(RequestOptions options) => throw null;
+
+ public virtual Task GetDefaultAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult GetDefault() => throw null;
+
+ public virtual Task> GetDefaultAsync() => throw null;
+
+ public virtual ClientResult PutAll(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutAllAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutAll(UnionIntLiteralProperty body) => throw null;
+
+ public virtual Task PutAllAsync(UnionIntLiteralProperty body) => throw null;
+
+ public virtual ClientResult PutDefault(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual Task PutDefaultAsync(BinaryContent content, RequestOptions options) => throw null;
+
+ public virtual ClientResult PutDefault(UnionIntLiteralProperty body) => throw null;
+
+ public virtual Task PutDefaultAsync(UnionIntLiteralProperty body) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionStringLiteral.cs
new file mode 100644
index 000000000..e4daa5d56
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/type/property/optionality/src/Generated/UnionStringLiteral.cs
@@ -0,0 +1,50 @@
+//
+
+#nullable disable
+
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading.Tasks;
+using _Type.Property.Optional.Models;
+
+namespace _Type.Property.Optional
+{
+ public partial class UnionStringLiteral
+ {
+ protected UnionStringLiteral() => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult GetAll(RequestOptions options) => throw null;
+
+ public virtual Task GetAllAsync(RequestOptions options) => throw null;
+
+ public virtual ClientResult