Skip to content

Commit

Permalink
onboard Sever/Path/Single (#4564)
Browse files Browse the repository at this point in the history
Fix #3987
  • Loading branch information
chunyu3 authored Oct 8, 2024
1 parent f69f8fa commit 854024a
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/http-client-csharp/eng/scripts/Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ $failingSpecs = @(
Join-Path 'http' 'serialization' 'encoded-name' 'json'
Join-Path 'http' 'server' 'endpoint' 'not-defined'
Join-Path 'http' 'server' 'path' 'multiple'
Join-Path 'http' 'server' 'path' 'single'
Join-Path 'http' 'server' 'versions' 'versioned'
Join-Path 'http' 'special-headers' 'conditional-request'
Join-Path 'http' 'special-headers' 'repeatability'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"commandName": "Executable",
"executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
},
"http-server-path-single": {
"commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/server/path/single -p StubLibraryPlugin",
"commandName": "Executable",
"executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
},
"http-server-versions-not-versioned": {
"commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/server/versions/not-versioned -p StubLibraryPlugin",
"commandName": "Executable",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using NUnit.Framework;
using Server.Path.Single;
using System.Threading.Tasks;

namespace TestProjects.CadlRanch.Tests.Http.Server.Path.Single
{
public class SingleTests : CadlRanchTestBase
{
[CadlRanchTest]
public Task MyOp() => Test(async (host) =>
{
var result = await new SingleClient(host, null).MyOpAsync();
Assert.AreEqual(200, result.GetRawResponse().Status);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"output-folder": ".",
"namespace": "Server.Path.Single",
"library-name": "Server.Path.Single",
"use-model-reader-writer": true
}
Original file line number Diff line number Diff line change
@@ -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}") = "Server.Path.Single", "src\Server.Path.Single.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// <auto-generated/>

#nullable disable

using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Threading.Tasks;

namespace Server.Path.Single
{
public partial class SingleClient
{
protected SingleClient() => throw null;

public SingleClient(Uri endpoint) : this(endpoint, new SingleClientOptions()) => throw null;

public SingleClient(Uri endpoint, SingleClientOptions options) => throw null;

public ClientPipeline Pipeline => throw null;

public virtual ClientResult MyOp(RequestOptions options) => throw null;

public virtual Task<ClientResult> MyOpAsync(RequestOptions options) => throw null;

public virtual ClientResult MyOp() => throw null;

public virtual Task<ClientResult> MyOpAsync() => throw null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// <auto-generated/>

#nullable disable

using System.ClientModel.Primitives;

namespace Server.Path.Single
{
public partial class SingleClientOptions : ClientPipelineOptions
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>This is the Server.Path.Single client library for developing .NET applications with rich experience.</Description>
<AssemblyTitle>SDK Code Generation Server.Path.Single</AssemblyTitle>
<Version>1.0.0-beta.1</Version>
<PackageTags>Server.Path.Single</PackageTags>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.ClientModel" Version="1.1.0-beta.4" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"$id": "1",
"Name": "Server.Path.Single",
"ApiVersions": [],
"Enums": [],
"Models": [],
"Clients": [
{
"$id": "2",
"Name": "SingleClient",
"Description": "Illustrates server with a single path parameter @server",
"Operations": [
{
"$id": "3",
"Name": "myOp",
"ResourceName": "Single",
"Accessibility": "public",
"Parameters": [
{
"$id": "4",
"Name": "endpoint",
"NameInRequest": "endpoint",
"Description": "Need to be set as 'http://localhost:3000' in client.",
"Type": {
"$id": "5",
"kind": "url",
"name": "url",
"crossLanguageDefinitionId": "TypeSpec.url"
},
"Location": "Uri",
"IsApiVersion": false,
"IsResourceParameter": false,
"IsContentType": false,
"IsRequired": true,
"IsEndpoint": true,
"SkipUrlEncoding": false,
"Explode": false,
"Kind": "Client"
}
],
"Responses": [
{
"$id": "6",
"StatusCodes": [
200
],
"BodyMediaType": "Json",
"Headers": [],
"IsErrorResponse": false
}
],
"HttpMethod": "HEAD",
"RequestBodyMediaType": "None",
"Uri": "{endpoint}",
"Path": "/server/path/single/myOp",
"BufferResponse": true,
"GenerateProtocolMethod": true,
"GenerateConvenienceMethod": true,
"CrossLanguageDefinitionId": "Server.Path.Single.myOp",
"Decorators": []
}
],
"Protocol": {
"$id": "7"
},
"Parameters": [
{
"$ref": "4"
}
],
"Decorators": []
}
]
}

0 comments on commit 854024a

Please sign in to comment.