Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microsoft.AspNetCore.OpenApi package #41238

Merged
merged 7 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions AspNetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildAfterTargetingPack", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResultsOfTGenerator", "src\Http\Http.Results\tools\ResultsOfTGenerator\ResultsOfTGenerator.csproj", "{9716D0D0-2251-44DD-8596-67D253EEF41C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{85520C50-CF33-4A27-BEC9-272100870D9D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenApi", "OpenApi", "{2D2D1107-7389-473B-BDCE-BFA060EAC453}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E47D1385-64B3-429B-9B1D-B0D0B7B6E506}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{25642C23-0BB8-4FF7-9181-9599489679EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.OpenApi", "src\OpenApi\src\Microsoft.AspNetCore.OpenApi.csproj", "{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.OpenApi.Tests", "src\OpenApi\test\Microsoft.AspNetCore.OpenApi.Tests.csproj", "{77305727-1A53-402A-A4E8-4CFA0DBFACC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -10153,6 +10165,38 @@ Global
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|x64.Build.0 = Release|Any CPU
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|x86.ActiveCfg = Release|Any CPU
{9716D0D0-2251-44DD-8596-67D253EEF41C}.Release|x86.Build.0 = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|arm64.ActiveCfg = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|arm64.Build.0 = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|x64.ActiveCfg = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|x64.Build.0 = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|x86.ActiveCfg = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Debug|x86.Build.0 = Debug|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|Any CPU.Build.0 = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|arm64.ActiveCfg = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|arm64.Build.0 = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|x64.ActiveCfg = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|x64.Build.0 = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|x86.ActiveCfg = Release|Any CPU
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4}.Release|x86.Build.0 = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|arm64.ActiveCfg = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|arm64.Build.0 = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|x64.ActiveCfg = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|x64.Build.0 = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|x86.ActiveCfg = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Debug|x86.Build.0 = Debug|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|Any CPU.Build.0 = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|arm64.ActiveCfg = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|arm64.Build.0 = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|x64.ActiveCfg = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|x64.Build.0 = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|x86.ActiveCfg = Release|Any CPU
{77305727-1A53-402A-A4E8-4CFA0DBFACC6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -10993,6 +11037,11 @@ Global
{489020F2-80D9-4468-A5D3-07E785837A5D} = {017429CC-C5FB-48B4-9C46-034E29EE2F06}
{8FED7E65-A7DD-4F13-8980-BF03E77B6C85} = {489020F2-80D9-4468-A5D3-07E785837A5D}
{9716D0D0-2251-44DD-8596-67D253EEF41C} = {323C3EB6-1D15-4B3D-918D-699D7F64DED9}
{2D2D1107-7389-473B-BDCE-BFA060EAC453} = {627BE8B3-59E6-4F1D-8C9C-76B804D41724}
{E47D1385-64B3-429B-9B1D-B0D0B7B6E506} = {2D2D1107-7389-473B-BDCE-BFA060EAC453}
{25642C23-0BB8-4FF7-9181-9599489679EB} = {2D2D1107-7389-473B-BDCE-BFA060EAC453}
{EF5062E5-93FA-48B3-B8DB-7B7B263A64D4} = {E47D1385-64B3-429B-9B1D-B0D0B7B6E506}
{77305727-1A53-402A-A4E8-4CFA0DBFACC6} = {25642C23-0BB8-4FF7-9181-9599489679EB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F}
Expand Down
1 change: 1 addition & 0 deletions eng/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ and are generated based on the last package release.
<LatestPackageReference Include="Microsoft.Win32.Registry" />
<LatestPackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" />
<LatestPackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" />
<LatestPackageReference Include="Microsoft.OpenApi" />
<LatestPackageReference Include="System.Buffers" />
<LatestPackageReference Include="System.CodeDom" />
<LatestPackageReference Include="System.CommandLine.Experimental" />
Expand Down
1 change: 1 addition & 0 deletions eng/ProjectReferences.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Http.Results" ProjectPath="$(RepoRoot)src\Http\Http.Results\src\Microsoft.AspNetCore.Http.Results.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Http" ProjectPath="$(RepoRoot)src\Http\Http\src\Microsoft.AspNetCore.Http.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Metadata" ProjectPath="$(RepoRoot)src\Http\Metadata\src\Microsoft.AspNetCore.Metadata.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.OpenApi" ProjectPath="$(RepoRoot)src\OpenApi\src\Microsoft.AspNetCore.OpenApi.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Owin" ProjectPath="$(RepoRoot)src\Http\Owin\src\Microsoft.AspNetCore.Owin.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Routing.Abstractions" ProjectPath="$(RepoRoot)src\Http\Routing.Abstractions\src\Microsoft.AspNetCore.Routing.Abstractions.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Routing" ProjectPath="$(RepoRoot)src\Http\Routing\src\Microsoft.AspNetCore.Routing.csproj" />
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
<XUnitRunnerVisualStudioVersion>2.4.3</XUnitRunnerVisualStudioVersion>
<MicrosoftDataSqlClientVersion>4.0.1</MicrosoftDataSqlClientVersion>
<MicrosoftAspNetCoreAppVersion>6.0.0-preview.3.21167.1</MicrosoftAspNetCoreAppVersion>
<MicrosoftOpenApiVersion>1.2.3</MicrosoftOpenApiVersion>
</PropertyGroup>
<!-- Restore feeds -->
<PropertyGroup Label="Restore feeds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public abstract class EndpointBuilder
/// </summary>
public IList<object> Metadata { get; } = new List<object>();

/// <summary>
/// Gets the <see cref="IServiceProvider"/> associated with the endpoint.
/// </summary>
public IServiceProvider? ServiceProvider { get; set; }

/// <summary>
/// Creates an instance of <see cref="Endpoint"/> from the <see cref="EndpointBuilder"/>.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#nullable enable
*REMOVED*abstract Microsoft.AspNetCore.Http.HttpResponse.ContentType.get -> string!
Microsoft.AspNetCore.Builder.EndpointBuilder.ServiceProvider.get -> System.IServiceProvider?
Microsoft.AspNetCore.Builder.EndpointBuilder.ServiceProvider.set -> void
Microsoft.AspNetCore.Http.EndpointMetadataCollection.GetRequiredMetadata<T>() -> T!
Microsoft.AspNetCore.Http.IRouteHandlerFilter.InvokeAsync(Microsoft.AspNetCore.Http.RouteHandlerInvocationContext! context, Microsoft.AspNetCore.Http.RouteHandlerFilterDelegate! next) -> System.Threading.Tasks.ValueTask<object?>
Microsoft.AspNetCore.Http.Metadata.IFromFormMetadata
Expand Down
2 changes: 1 addition & 1 deletion src/Http/HttpAbstractions.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
"src\\WebEncoders\\src\\Microsoft.Extensions.WebEncoders.csproj"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ private static RouteHandlerBuilder Map(
defaultOrder)
{
DisplayName = pattern.RawText ?? pattern.DebuggerToString(),
ServiceProvider = endpoints.ServiceProvider,
};

// Methods defined in a top-level program are generated as statics so the delegate
Expand Down
1 change: 1 addition & 0 deletions src/Http/Routing/src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Microsoft.AspNetCore.OpenApi.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Routing.Microbenchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Routing.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.ApiExplorer.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
Expand Down
14 changes: 14 additions & 0 deletions src/OpenApi/OpenApi.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"solution": {
"path": "..\\..\\AspNetCore.sln",
"projects": [
"src\\Hosting\\Abstractions\\src\\Microsoft.AspNetCore.Hosting.Abstractions.csproj",
"src\\Hosting\\Hosting\\src\\Microsoft.AspNetCore.Hosting.csproj",
"src\\Http\\Http.Abstractions\\src\\Microsoft.AspNetCore.Http.Abstractions.csproj",
"src\\Http\\Http\\src\\Microsoft.AspNetCore.Http.csproj",
"src\\Http\\Routing\\src\\Microsoft.AspNetCore.Routing.csproj",
"src\\OpenApi\\src\\Microsoft.AspNetCore.OpenApi.csproj",
"src\\OpenApi\\test\\Microsoft.AspNetCore.OpenApi.Tests.csproj"
]
}
}
5 changes: 5 additions & 0 deletions src/OpenApi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Microsoft.AspNetCore.OpenApi

This directory contains the source for the `Microsoft.AspNetCore.OpenApi` package which provides support for
generating OpenApi schemas directly for route handler endpoints in ASP.NET Core.

3 changes: 3 additions & 0 deletions src/OpenApi/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@ECHO OFF
SET RepoRoot=%~dp0..\..
%RepoRoot%\eng\build.cmd -projects %~dp0**\*.*proj %*
7 changes: 7 additions & 0 deletions src/OpenApi/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
repo_root="$DIR/../.."
"$repo_root/eng/build.sh" --projects "$DIR/**/*.*proj" "$@"
29 changes: 29 additions & 0 deletions src/OpenApi/src/Microsoft.AspNetCore.OpenApi.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;openapi</PackageTags>
<Description>Provides APIs for annotating route handler endpoints in ASP.NET Core with OpenAPI annotations.</Description>
<Nullable>enable</Nullable>
captainsafia marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup>
<Reference Include="Microsoft.OpenApi" />
<Reference Include="Microsoft.AspNetCore.Http.Abstractions" />
<Reference Include="Microsoft.AspNetCore.Routing" />
<Reference Include="Microsoft.AspNetCore.Mvc.Core" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(SharedSourceRoot)RoslynUtils\TypeHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ObjectMethodExecutor\**\*.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)ParameterBindingMethodCache.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)TypeNameHelper\TypeNameHelper.cs" LinkBase="Shared" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Microsoft.AspNetCore.OpenApi.Tests" />
</ItemGroup>

</Project>
Loading