diff --git a/packages/http-client-csharp/eng/scripts/Generate.ps1 b/packages/http-client-csharp/eng/scripts/Generate.ps1 index 7332ea45e6..83cead013e 100644 --- a/packages/http-client-csharp/eng/scripts/Generate.ps1 +++ b/packages/http-client-csharp/eng/scripts/Generate.ps1 @@ -46,7 +46,6 @@ function IsSpecDir { $failingSpecs = @( Join-Path 'http' 'special-words' - Join-Path 'http' 'client' 'naming' Join-Path 'http' 'client' 'structure' 'default' Join-Path 'http' 'client' 'structure' 'multi-client' Join-Path 'http' 'client' 'structure' 'renamed-operation' diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs index bffb578b4c..15c071c966 100644 --- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs @@ -103,7 +103,14 @@ private IReadOnlyList GetParamConversions(IReadOnlyList(); client.Parameters = parameters ?? Array.Empty(); client.Parent = parent; 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 2dec05074c..f3a0b51970 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 @@ -25,6 +25,11 @@ "commandName": "Executable", "executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe" }, + "http-client-naming": { + "commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/client/naming -p StubLibraryPlugin", + "commandName": "Executable", + "executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe" + }, "Unbranded-TypeSpec": { "commandLineArgs": "$(SolutionDir)/TestProjects/Local/Unbranded-TypeSpec -p ClientModelPlugin", "commandName": "Executable", diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Providers/ParameterProvider.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Providers/ParameterProvider.cs index 9397df4567..564af22c19 100644 --- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Providers/ParameterProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Providers/ParameterProvider.cs @@ -30,6 +30,7 @@ public sealed class ParameterProvider : IEquatable public bool IsOut { get; } internal IReadOnlyList Attributes { get; } = []; public WireInformation WireInfo { get; } + public bool IsBodyParameter { get; } /// /// This property tracks which property this parameter is constructed from. @@ -52,6 +53,7 @@ public ParameterProvider(InputParameter inputParameter) Type = CodeModelPlugin.Instance.TypeFactory.CreateCSharpType(inputParameter.Type) ?? throw new InvalidOperationException($"Failed to create CSharpType for {inputParameter.Type}"); Validation = inputParameter.IsRequired && !Type.IsValueType ? ParameterValidationType.AssertNotNull : ParameterValidationType.None; WireInfo = new WireInformation(CodeModelPlugin.Instance.TypeFactory.GetSerializationFormat(inputParameter.Type), inputParameter.NameInRequest); + IsBodyParameter = inputParameter.Location == RequestLocation.Body; } public ParameterProvider( diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Client/Naming/NamingTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Client/Naming/NamingTests.cs new file mode 100644 index 0000000000..32b44ebec8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Client/Naming/NamingTests.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Client.Naming; +using Client.Naming.Models; +using NUnit.Framework; +using ClientModel = Client.Naming.Models.ClientModel; + +namespace TestProjects.CadlRanch.Tests.Http.Client.Naming +{ + public class ClientNamingTests : CadlRanchTestBase + { + [CadlRanchTest] + public Task Client() => Test(async (host) => + { + var response = await new NamingClient(host, null).ClientAsync(new ClientNameModel(true)); + Assert.AreEqual(204, response.GetRawResponse().Status); + + Assert.NotNull(typeof(ClientNameModel).GetProperty("ClientName")); + Assert.IsNull(typeof(ClientNameModel).GetProperty("DefaultName")); + }); + + [CadlRanchTest] + public Task Language() => Test(async (host) => + { + var response = await new NamingClient(host, null).LanguageAsync(new LanguageClientNameModel(true)); + Assert.AreEqual(204, response.GetRawResponse().Status); + + Assert.NotNull(typeof(LanguageClientNameModel).GetProperty("CSName")); + Assert.IsNull(typeof(LanguageClientNameModel).GetProperty("DefaultName")); + }); + + [CadlRanchTest] + public Task CompatibleWithEncodedName() => Test(async (host) => + { + var response = await new NamingClient(host, null).CompatibleWithEncodedNameAsync(new ClientNameAndJsonEncodedNameModel(true)); + Assert.AreEqual(204, response.GetRawResponse().Status); + + Assert.NotNull(typeof(ClientNameModel).GetProperty("ClientName")); + Assert.IsNull(typeof(ClientNameModel).GetProperty("DefaultName")); + }); + + [CadlRanchTest] + public Task Operation() => Test(async (host) => + { + var response = await new NamingClient(host, null).ClientNameAsync(); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [CadlRanchTest] + public Task Parameter() => Test(async (host) => + { + var response = await new NamingClient(host, null).ParameterAsync(clientName: "true"); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [CadlRanchTest] + public Task Request() => Test(async (host) => + { + var response = await new NamingClient(host, null).RequestAsync(clientName: "true"); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [CadlRanchTest] + public Task Response() => Test(async (host) => + { + var response = await new NamingClient(host, null).ResponseAsync(); + Assert.IsTrue(response.GetRawResponse().Headers.TryGetValue("default-name", out _)); + foreach (var header in response.GetRawResponse().Headers) + { + var key = header.Key; + if (key == "default-name") + { + var value = header.Value; + Assert.AreEqual("true", value); + } + } + }); + + [CadlRanchTest] + public Task ModelClient() => Test(async (host) => + { + var response = await new NamingClient(host, null).GetClientModelClient().ClientAsync(new ClientModel(true)); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [CadlRanchTest] + public Task ModelLanguage() => Test(async (host) => + { + var response = await new NamingClient(host, null).GetClientModelClient().LanguageAsync(new CSModel(true)); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [CadlRanchTest] + public Task UnionEnumName() => Test(async (host) => + { + var response = await new NamingClient(host, null).GetUnionEnumClient().UnionEnumNameAsync(ClientExtensibleEnum.EnumValue1); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [CadlRanchTest] + public Task UnionEnumMemberName() => Test(async (host) => + { + var response = await new NamingClient(host, null).GetUnionEnumClient().UnionEnumMemberNameAsync(ExtensibleEnum.ClientEnumValue1); + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/Client.Naming.sln b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/Client.Naming.sln new file mode 100644 index 0000000000..4fd4f6ff28 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/Client.Naming.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}") = "Client.Naming", "src\Client.Naming.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/client/naming/Configuration.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/Configuration.json new file mode 100644 index 0000000000..ff36f3dc3e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/Configuration.json @@ -0,0 +1,6 @@ +{ + "output-folder": ".", + "namespace": "Client.Naming", + "library-name": "Client.Naming", + "use-model-reader-writer": true +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Client.Naming.csproj b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Client.Naming.csproj new file mode 100644 index 0000000000..6c87383d9d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Client.Naming.csproj @@ -0,0 +1,16 @@ + + + This is the Client.Naming client library for developing .NET applications with rich experience. + SDK Code Generation Client.Naming + 1.0.0-beta.1 + Client.Naming + netstandard2.0 + latest + true + + + + + + + diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/ClientModel.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/ClientModel.cs new file mode 100644 index 0000000000..4ecd9e6aec --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/ClientModel.cs @@ -0,0 +1,34 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; +using Client.Naming.Models; + +namespace Client.Naming +{ + public partial class ClientModel + { + protected ClientModel() => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual ClientResult Client(BinaryContent content, RequestOptions options) => throw null; + + public virtual Task ClientAsync(BinaryContent content, RequestOptions options) => throw null; + + public virtual ClientResult Client(Models.ClientModel body) => throw null; + + public virtual Task ClientAsync(Models.ClientModel body) => throw null; + + public virtual ClientResult Language(BinaryContent content, RequestOptions options) => throw null; + + public virtual Task LanguageAsync(BinaryContent content, RequestOptions options) => throw null; + + public virtual ClientResult Language(CSModel body) => throw null; + + public virtual Task LanguageAsync(CSModel body) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/ClientNamingModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/ClientNamingModelFactory.cs new file mode 100644 index 0000000000..a18789aad5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/ClientNamingModelFactory.cs @@ -0,0 +1,19 @@ +// + +#nullable disable + +namespace Client.Naming.Models +{ + public static partial class ClientNamingModelFactory + { + public static ClientNameModel ClientNameModel(bool clientName = default) => throw null; + + public static LanguageClientNameModel LanguageClientNameModel(bool csName = default) => throw null; + + public static ClientNameAndJsonEncodedNameModel ClientNameAndJsonEncodedNameModel(bool clientName = default) => throw null; + + public static ClientModel ClientModel(bool defaultName = default) => throw null; + + public static CSModel CSModel(bool defaultName = default) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/CSModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/CSModel.Serialization.cs new file mode 100644 index 0000000000..3a7c829105 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/CSModel.Serialization.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Client.Naming.Models +{ + public partial class CSModel : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + CSModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + protected virtual CSModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + + CSModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + + protected virtual CSModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + + public static implicit operator BinaryContent(CSModel csModel) => throw null; + + public static explicit operator CSModel(ClientResult result) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/CSModel.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/CSModel.cs new file mode 100644 index 0000000000..4849337db5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/CSModel.cs @@ -0,0 +1,18 @@ +// + +#nullable disable + +namespace Client.Naming.Models +{ + public partial class CSModel + { + public CSModel(bool defaultName) => throw null; + + public bool DefaultName + { + get => throw null; + set => throw null; + } + + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientExtensibleEnum.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientExtensibleEnum.cs new file mode 100644 index 0000000000..9af1d0dcc1 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientExtensibleEnum.cs @@ -0,0 +1,31 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Client.Naming.Models +{ + public readonly partial struct ClientExtensibleEnum : IEquatable + { + public ClientExtensibleEnum(string value) => throw null; + + public static ClientExtensibleEnum EnumValue1 => throw null; + + public static bool operator ==(ClientExtensibleEnum left, ClientExtensibleEnum right) => throw null; + + public static bool operator !=(ClientExtensibleEnum left, ClientExtensibleEnum right) => throw null; + + public static implicit operator ClientExtensibleEnum(string value) => throw null; + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => throw null; + + public bool Equals(ClientExtensibleEnum 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/client/naming/src/Generated/Models/ClientModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientModel.Serialization.cs new file mode 100644 index 0000000000..82c8e50623 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientModel.Serialization.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Client.Naming.Models +{ + public partial class ClientModel : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + ClientModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + protected virtual ClientModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + + ClientModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + + protected virtual ClientModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + + public static implicit operator BinaryContent(ClientModel clientModel) => throw null; + + public static explicit operator ClientModel(ClientResult result) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientModel.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientModel.cs new file mode 100644 index 0000000000..81901c0752 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientModel.cs @@ -0,0 +1,18 @@ +// + +#nullable disable + +namespace Client.Naming.Models +{ + public partial class ClientModel + { + public ClientModel(bool defaultName) => throw null; + + public bool DefaultName + { + get => throw null; + set => throw null; + } + + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameAndJsonEncodedNameModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameAndJsonEncodedNameModel.Serialization.cs new file mode 100644 index 0000000000..d0558fa383 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameAndJsonEncodedNameModel.Serialization.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Client.Naming.Models +{ + public partial class ClientNameAndJsonEncodedNameModel : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + ClientNameAndJsonEncodedNameModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + protected virtual ClientNameAndJsonEncodedNameModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + + ClientNameAndJsonEncodedNameModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + + protected virtual ClientNameAndJsonEncodedNameModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + + public static implicit operator BinaryContent(ClientNameAndJsonEncodedNameModel clientNameAndJsonEncodedNameModel) => throw null; + + public static explicit operator ClientNameAndJsonEncodedNameModel(ClientResult result) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameAndJsonEncodedNameModel.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameAndJsonEncodedNameModel.cs new file mode 100644 index 0000000000..29deb91c9f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameAndJsonEncodedNameModel.cs @@ -0,0 +1,18 @@ +// + +#nullable disable + +namespace Client.Naming.Models +{ + public partial class ClientNameAndJsonEncodedNameModel + { + public ClientNameAndJsonEncodedNameModel(bool clientName) => throw null; + + public bool ClientName + { + get => throw null; + set => throw null; + } + + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameModel.Serialization.cs new file mode 100644 index 0000000000..7cc7e258fd --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameModel.Serialization.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Client.Naming.Models +{ + public partial class ClientNameModel : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + ClientNameModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + protected virtual ClientNameModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + + ClientNameModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + + protected virtual ClientNameModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + + public static implicit operator BinaryContent(ClientNameModel clientNameModel) => throw null; + + public static explicit operator ClientNameModel(ClientResult result) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameModel.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameModel.cs new file mode 100644 index 0000000000..b26d0dd5de --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ClientNameModel.cs @@ -0,0 +1,18 @@ +// + +#nullable disable + +namespace Client.Naming.Models +{ + public partial class ClientNameModel + { + public ClientNameModel(bool clientName) => throw null; + + public bool ClientName + { + get => throw null; + set => throw null; + } + + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ExtensibleEnum.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ExtensibleEnum.cs new file mode 100644 index 0000000000..3bed4fa3f6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/ExtensibleEnum.cs @@ -0,0 +1,33 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Client.Naming.Models +{ + public readonly partial struct ExtensibleEnum : IEquatable + { + public ExtensibleEnum(string value) => throw null; + + public static ExtensibleEnum ClientEnumValue1 => throw null; + + public static ExtensibleEnum ClientEnumValue2 => throw null; + + public static bool operator ==(ExtensibleEnum left, ExtensibleEnum right) => throw null; + + public static bool operator !=(ExtensibleEnum left, ExtensibleEnum right) => throw null; + + public static implicit operator ExtensibleEnum(string value) => throw null; + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => throw null; + + public bool Equals(ExtensibleEnum 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/client/naming/src/Generated/Models/LanguageClientNameModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/LanguageClientNameModel.Serialization.cs new file mode 100644 index 0000000000..8da7567bf7 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/LanguageClientNameModel.Serialization.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Client.Naming.Models +{ + public partial class LanguageClientNameModel : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + LanguageClientNameModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + protected virtual LanguageClientNameModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + + LanguageClientNameModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + + protected virtual LanguageClientNameModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + + public static implicit operator BinaryContent(LanguageClientNameModel languageClientNameModel) => throw null; + + public static explicit operator LanguageClientNameModel(ClientResult result) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/LanguageClientNameModel.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/LanguageClientNameModel.cs new file mode 100644 index 0000000000..da5b186278 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/Models/LanguageClientNameModel.cs @@ -0,0 +1,18 @@ +// + +#nullable disable + +namespace Client.Naming.Models +{ + public partial class LanguageClientNameModel + { + public LanguageClientNameModel(bool csName) => throw null; + + public bool CSName + { + get => throw null; + set => throw null; + } + + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/NamingClient.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/NamingClient.cs new file mode 100644 index 0000000000..713ad92bdb --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/NamingClient.cs @@ -0,0 +1,81 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; +using Client.Naming.Models; + +namespace Client.Naming +{ + public partial class NamingClient + { + public NamingClient() : this(new Uri("http://localhost:3000"), new NamingClientOptions()) => throw null; + + public NamingClient(Uri endpoint, NamingClientOptions options) => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual ClientResult ClientName(RequestOptions options) => throw null; + + public virtual Task ClientNameAsync(RequestOptions options) => throw null; + + public virtual ClientResult ClientName() => throw null; + + public virtual Task ClientNameAsync() => throw null; + + public virtual ClientResult Parameter(string clientName, RequestOptions options) => throw null; + + public virtual Task ParameterAsync(string clientName, RequestOptions options) => throw null; + + public virtual ClientResult Parameter(string clientName) => throw null; + + public virtual Task ParameterAsync(string clientName) => throw null; + + public virtual ClientResult Client(BinaryContent content, RequestOptions options) => throw null; + + public virtual Task ClientAsync(BinaryContent content, RequestOptions options) => throw null; + + public virtual ClientResult Client(ClientNameModel body) => throw null; + + public virtual Task ClientAsync(ClientNameModel body) => throw null; + + public virtual ClientResult Language(BinaryContent content, RequestOptions options) => throw null; + + public virtual Task LanguageAsync(BinaryContent content, RequestOptions options) => throw null; + + public virtual ClientResult Language(LanguageClientNameModel body) => throw null; + + public virtual Task LanguageAsync(LanguageClientNameModel body) => throw null; + + public virtual ClientResult CompatibleWithEncodedName(BinaryContent content, RequestOptions options) => throw null; + + public virtual Task CompatibleWithEncodedNameAsync(BinaryContent content, RequestOptions options) => throw null; + + public virtual ClientResult CompatibleWithEncodedName(ClientNameAndJsonEncodedNameModel body) => throw null; + + public virtual Task CompatibleWithEncodedNameAsync(ClientNameAndJsonEncodedNameModel body) => throw null; + + public virtual ClientResult Request(string clientName, RequestOptions options) => throw null; + + public virtual Task RequestAsync(string clientName, RequestOptions options) => throw null; + + public virtual ClientResult Request(string clientName) => throw null; + + public virtual Task RequestAsync(string clientName) => throw null; + + public virtual ClientResult Response(RequestOptions options) => throw null; + + public virtual Task ResponseAsync(RequestOptions options) => throw null; + + public virtual ClientResult Response() => throw null; + + public virtual Task ResponseAsync() => throw null; + + public virtual ClientModel GetClientModelClient() => throw null; + + public virtual UnionEnum GetUnionEnumClient() => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/NamingClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/NamingClientOptions.cs new file mode 100644 index 0000000000..aab8bfd2f2 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/NamingClientOptions.cs @@ -0,0 +1,12 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Client.Naming +{ + public partial class NamingClientOptions : ClientPipelineOptions + { + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/UnionEnum.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/UnionEnum.cs new file mode 100644 index 0000000000..9607ce0f8c --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/src/Generated/UnionEnum.cs @@ -0,0 +1,34 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; +using Client.Naming.Models; + +namespace Client.Naming +{ + public partial class UnionEnum + { + protected UnionEnum() => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual ClientResult UnionEnumName(BinaryContent content, RequestOptions options) => throw null; + + public virtual Task UnionEnumNameAsync(BinaryContent content, RequestOptions options) => throw null; + + public virtual ClientResult UnionEnumName(ClientExtensibleEnum body) => throw null; + + public virtual Task UnionEnumNameAsync(ClientExtensibleEnum body) => throw null; + + public virtual ClientResult UnionEnumMemberName(BinaryContent content, RequestOptions options) => throw null; + + public virtual Task UnionEnumMemberNameAsync(BinaryContent content, RequestOptions options) => throw null; + + public virtual ClientResult UnionEnumMemberName(ExtensibleEnum body) => throw null; + + public virtual Task UnionEnumMemberNameAsync(ExtensibleEnum body) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/tspCodeModel.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/tspCodeModel.json new file mode 100644 index 0000000000..4ecc47d77f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/client/naming/tspCodeModel.json @@ -0,0 +1,976 @@ +{ + "$id": "1", + "Name": "Client.Naming", + "ApiVersions": [], + "Enums": [ + { + "$id": "2", + "Kind": "enum", + "Name": "ClientExtensibleEnum", + "CrossLanguageDefinitionId": "Client.Naming.UnionEnum.ServerExtensibleEnum", + "ValueType": { + "$id": "3", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Values": [ + { + "$id": "4", + "Name": "EnumValue1", + "Value": "value1" + } + ], + "IsExtensible": true, + "Usage": "Input,Json" + }, + { + "$id": "5", + "Kind": "enum", + "Name": "ExtensibleEnum", + "CrossLanguageDefinitionId": "Client.Naming.UnionEnum.ExtensibleEnum", + "ValueType": { + "$id": "6", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Values": [ + { + "$id": "7", + "Name": "ClientEnumValue1", + "Value": "value1" + }, + { + "$id": "8", + "Name": "ClientEnumValue2", + "Value": "value2" + } + ], + "IsExtensible": true, + "Usage": "Input,Json" + } + ], + "Models": [ + { + "$id": "9", + "Kind": "model", + "Name": "ClientNameModel", + "CrossLanguageDefinitionId": "Client.Naming.Property.ClientNameModel", + "Usage": "Input,Json", + "Decorators": [], + "Properties": [ + { + "$id": "10", + "Name": "clientName", + "SerializedName": "defaultName", + "Description": "Pass in true", + "Type": { + "$id": "11", + "Kind": "boolean", + "Name": "boolean", + "CrossLanguageDefinitionId": "TypeSpec.boolean" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "12", + "Kind": "model", + "Name": "LanguageClientNameModel", + "CrossLanguageDefinitionId": "Client.Naming.Property.LanguageClientNameModel", + "Usage": "Input,Json", + "Decorators": [], + "Properties": [ + { + "$id": "13", + "Name": "CSName", + "SerializedName": "defaultName", + "Description": "Pass in true", + "Type": { + "$id": "14", + "Kind": "boolean", + "Name": "boolean", + "CrossLanguageDefinitionId": "TypeSpec.boolean" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "15", + "Kind": "model", + "Name": "ClientNameAndJsonEncodedNameModel", + "CrossLanguageDefinitionId": "Client.Naming.Property.ClientNameAndJsonEncodedNameModel", + "Usage": "Input,Json", + "Decorators": [], + "Properties": [ + { + "$id": "16", + "Name": "clientName", + "SerializedName": "wireName", + "Description": "Pass in true", + "Type": { + "$id": "17", + "Kind": "boolean", + "Name": "boolean", + "CrossLanguageDefinitionId": "TypeSpec.boolean" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "18", + "Kind": "model", + "Name": "ClientModel", + "CrossLanguageDefinitionId": "Client.Naming.Model.ModelWithClientClientName", + "Usage": "Input,Json", + "Decorators": [], + "Properties": [ + { + "$id": "19", + "Name": "defaultName", + "SerializedName": "defaultName", + "Description": "Pass in true", + "Type": { + "$id": "20", + "Kind": "boolean", + "Name": "boolean", + "CrossLanguageDefinitionId": "TypeSpec.boolean" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "21", + "Kind": "model", + "Name": "CSModel", + "CrossLanguageDefinitionId": "Client.Naming.Model.ModelWithLanguageClientName", + "Usage": "Input,Json", + "Decorators": [], + "Properties": [ + { + "$id": "22", + "Name": "defaultName", + "SerializedName": "defaultName", + "Description": "Pass in true", + "Type": { + "$id": "23", + "Kind": "boolean", + "Name": "boolean", + "CrossLanguageDefinitionId": "TypeSpec.boolean" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + } + ], + "Clients": [ + { + "$id": "24", + "Name": "NamingClient", + "Description": "Describe changing names of types in a client with `@clientName`", + "Operations": [ + { + "$id": "25", + "Name": "clientName", + "ResourceName": "Naming", + "Accessibility": "public", + "Parameters": [ + { + "$id": "26", + "Name": "endpoint", + "NameInRequest": "endpoint", + "Type": { + "$id": "27", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "28", + "Type": { + "$id": "29", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "http://localhost:3000" + } + } + ], + "Responses": [ + { + "$id": "30", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/client/naming/operation", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.operation" + }, + { + "$id": "31", + "Name": "parameter", + "ResourceName": "Naming", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "26" + }, + { + "$id": "32", + "Name": "clientName", + "NameInRequest": "defaultName", + "Type": { + "$id": "33", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Location": "Query", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "34", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/client/naming/parameter", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.parameter" + }, + { + "$id": "35", + "Name": "client", + "ResourceName": "Property", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "26" + }, + { + "$id": "36", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "Body parameter's content type. Known values are application/json", + "Type": { + "$id": "37", + "Kind": "constant", + "ValueType": { + "$id": "38", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "application/json" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": true, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Constant" + }, + { + "$id": "39", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$ref": "9" + }, + "Location": "Body", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "40", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/client/naming/property/client", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.Property.client" + }, + { + "$id": "41", + "Name": "language", + "ResourceName": "Property", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "26" + }, + { + "$id": "42", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "Body parameter's content type. Known values are application/json", + "Type": { + "$id": "43", + "Kind": "constant", + "ValueType": { + "$id": "44", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "application/json" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": true, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Constant" + }, + { + "$id": "45", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$ref": "12" + }, + "Location": "Body", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "46", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/client/naming/property/language", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.Property.language" + }, + { + "$id": "47", + "Name": "compatibleWithEncodedName", + "ResourceName": "Property", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "26" + }, + { + "$id": "48", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "Body parameter's content type. Known values are application/json", + "Type": { + "$id": "49", + "Kind": "constant", + "ValueType": { + "$id": "50", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "application/json" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": true, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Constant" + }, + { + "$id": "51", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$ref": "15" + }, + "Location": "Body", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "52", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/client/naming/property/compatible-with-encoded-name", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.Property.compatibleWithEncodedName" + }, + { + "$id": "53", + "Name": "request", + "ResourceName": "Header", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "26" + }, + { + "$id": "54", + "Name": "clientName", + "NameInRequest": "default-name", + "Type": { + "$id": "55", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "56", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/client/naming/header", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.Header.request" + }, + { + "$id": "57", + "Name": "response", + "ResourceName": "Header", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "26" + } + ], + "Responses": [ + { + "$id": "58", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "59", + "Name": "default-name", + "NameInResponse": "default-name", + "Type": { + "$id": "60", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/client/naming/header", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.Header.response" + } + ], + "Protocol": { + "$id": "61" + }, + "Parameters": [ + { + "$ref": "26" + } + ] + }, + { + "$id": "62", + "Name": "ClientModel", + "Operations": [ + { + "$id": "63", + "Name": "client", + "ResourceName": "Model", + "Accessibility": "public", + "Parameters": [ + { + "$id": "64", + "Name": "endpoint", + "NameInRequest": "endpoint", + "Type": { + "$id": "65", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "66", + "Type": { + "$id": "67", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "http://localhost:3000" + } + }, + { + "$id": "68", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "Body parameter's content type. Known values are application/json", + "Type": { + "$id": "69", + "Kind": "constant", + "ValueType": { + "$id": "70", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "application/json" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": true, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Constant" + }, + { + "$id": "71", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$ref": "18" + }, + "Location": "Body", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "72", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/client/naming/model/client", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.Model.client" + }, + { + "$id": "73", + "Name": "language", + "ResourceName": "Model", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "64" + }, + { + "$id": "74", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "Body parameter's content type. Known values are application/json", + "Type": { + "$id": "75", + "Kind": "constant", + "ValueType": { + "$id": "76", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "application/json" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": true, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Constant" + }, + { + "$id": "77", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$ref": "21" + }, + "Location": "Body", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "78", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/client/naming/model/language", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.Model.language" + } + ], + "Protocol": { + "$id": "79" + }, + "Parent": "NamingClient", + "Parameters": [ + { + "$ref": "64" + } + ] + }, + { + "$id": "80", + "Name": "UnionEnum", + "Operations": [ + { + "$id": "81", + "Name": "unionEnumName", + "ResourceName": "UnionEnum", + "Accessibility": "public", + "Parameters": [ + { + "$id": "82", + "Name": "endpoint", + "NameInRequest": "endpoint", + "Type": { + "$id": "83", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "84", + "Type": { + "$id": "85", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "http://localhost:3000" + } + }, + { + "$id": "86", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "Body parameter's content type. Known values are application/json", + "Type": { + "$id": "87", + "Kind": "constant", + "ValueType": { + "$id": "88", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "application/json" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": true, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Constant" + }, + { + "$id": "89", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$ref": "2" + }, + "Location": "Body", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "90", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/client/naming/union-enum/union-enum-name", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.UnionEnum.unionEnumName" + }, + { + "$id": "91", + "Name": "unionEnumMemberName", + "ResourceName": "UnionEnum", + "Accessibility": "public", + "Parameters": [ + { + "$ref": "82" + }, + { + "$id": "92", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "Body parameter's content type. Known values are application/json", + "Type": { + "$id": "93", + "Kind": "constant", + "ValueType": { + "$id": "94", + "Kind": "string", + "Name": "string", + "CrossLanguageDefinitionId": "TypeSpec.string" + }, + "Value": "application/json" + }, + "Location": "Header", + "IsApiVersion": false, + "IsContentType": true, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Constant" + }, + { + "$id": "95", + "Name": "body", + "NameInRequest": "body", + "Type": { + "$ref": "5" + }, + "Location": "Body", + "IsApiVersion": false, + "IsContentType": false, + "IsEndpoint": false, + "Explode": false, + "IsRequired": true, + "Kind": "Method" + } + ], + "Responses": [ + { + "$id": "96", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/client/naming/union-enum/union-enum-member-name", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true, + "CrossLanguageDefinitionId": "Client.Naming.UnionEnum.unionEnumMemberName" + } + ], + "Protocol": { + "$id": "97" + }, + "Parent": "NamingClient", + "Parameters": [ + { + "$ref": "82" + } + ] + } + ] +}