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

Drop deprecated Microsoft.AspNetCore.* #3366

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions src/NSwag.Annotations/NSwag.Annotations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>../NSwag.snk</AssemblyOriginatorKeyFile>
<Authors>Rico Suter</Authors>
<PackageIconUrl>https://raw.githubusercontent.com/RicoSuter/NSwag/master/assets/NuGetIcon.png</PackageIconUrl>
<PackageIcon>NuGetIcon.png</PackageIcon>
<Company />
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/RicoSuter/NSwag.git</RepositoryUrl>
Expand All @@ -22,7 +22,10 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\assets\NuGetIcon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>
</Project>
2 changes: 2 additions & 0 deletions src/NSwag.Annotations/OpenApiExtensionDataAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ namespace NSwag.Annotations
/// <remarks>Requires the SwaggerExtensionDataOperationProcessor to be used in the Swagger definition generation.</remarks>
/// <seealso cref="Attribute" />
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true)]
#pragma warning disable 618
public sealed class OpenApiExtensionDataAttribute : SwaggerExtensionDataAttribute
#pragma warning restore 618
{
/// <summary>Initializes a new instance of the <see cref="SwaggerExtensionDataAttribute"/> class.</summary>
/// <param name="key">The key.</param>
Expand Down
4 changes: 3 additions & 1 deletion src/NSwag.Annotations/OpenApiFileAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace NSwag.Annotations
{
/// <summary>Specifies a parameter or class to be handled as file.</summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Parameter)]
#pragma warning disable 618
public class OpenApiFileAttribute : SwaggerFileAttribute
#pragma warning restore 618
{
}

Expand All @@ -22,4 +24,4 @@ public class OpenApiFileAttribute : SwaggerFileAttribute
public class SwaggerFileAttribute : Attribute
{
}
}
}
4 changes: 3 additions & 1 deletion src/NSwag.Annotations/OpenApiIgnoreAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace NSwag.Annotations
{
/// <summary>Excludes an action method from the generated Swagger specification.</summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Parameter)]
#pragma warning disable 618
public class OpenApiIgnoreAttribute : SwaggerIgnoreAttribute
#pragma warning restore 618
{
}

Expand All @@ -22,4 +24,4 @@ public class OpenApiIgnoreAttribute : SwaggerIgnoreAttribute
public class SwaggerIgnoreAttribute : Attribute
{
}
}
}
4 changes: 3 additions & 1 deletion src/NSwag.Annotations/OpenApiOperationAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace NSwag.Annotations
{
/// <summary>Specifies the operation id, summary and description</summary>
[AttributeUsage(AttributeTargets.Method)]
#pragma warning disable 618
public class OpenApiOperationAttribute : SwaggerOperationAttribute
#pragma warning restore 618
{
/// <summary>Initializes a new instance of the <see cref="OpenApiOperationAttribute"/> class.</summary>
/// <param name="operationId">The operation ID.</param>
Expand Down Expand Up @@ -61,4 +63,4 @@ public SwaggerOperationAttribute(string operationId)
/// <summary>Gets or sets the operation ID.</summary>
public string OperationId { get; private set; }
}
}
}
4 changes: 3 additions & 1 deletion src/NSwag.Annotations/OpenApiOperationProcessorAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace NSwag.Annotations
/// <summary>Registers an operation processor for the given method or class.</summary>
/// <seealso cref="System.Attribute" />
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
#pragma warning disable 618
public class OpenApiOperationProcessorAttribute : SwaggerOperationProcessorAttribute
#pragma warning restore 618
{
/// <summary>Initializes a new instance of the <see cref="SwaggerOperationProcessorAttribute"/> class.</summary>
/// <param name="type">The operation processor type (must implement IOperationProcessor).</param>
Expand Down Expand Up @@ -44,4 +46,4 @@ public SwaggerOperationProcessorAttribute(Type type, params object[] parameters)
/// <summary>Gets or sets the type of the constructor parameters.</summary>
public object[] Parameters { get; set; }
}
}
}
4 changes: 3 additions & 1 deletion src/NSwag.Annotations/OpenApiTagAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace NSwag.Annotations
{
/// <summary>Specifies the tags for an operation.</summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
#pragma warning disable 618
public class OpenApiTagAttribute : SwaggerTagAttribute
#pragma warning restore 618
{
/// <summary>Initializes a new instance of the <see cref="SwaggerTagAttribute"/> class.</summary>
public OpenApiTagAttribute(string name) : base(name)
Expand Down Expand Up @@ -46,4 +48,4 @@ public SwaggerTagAttribute(string name)
/// <summary>Gets or sets a value indicating whether the tags should be added to document's 'tags' property (only needed on operation methods, default: false).</summary>
public bool AddToDocument { get; set; }
}
}
}
4 changes: 3 additions & 1 deletion src/NSwag.Annotations/OpenApiTagsAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace NSwag.Annotations
{
/// <summary>Specifies the tags for an operation or a document.</summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
#pragma warning disable 618
public class OpenApiTagsAttribute : SwaggerTagsAttribute
#pragma warning restore 618
{
/// <summary>Initializes a new instance of the <see cref="SwaggerTagsAttribute"/> class.</summary>
/// <param name="tags">The tags.</param>
Expand Down Expand Up @@ -40,4 +42,4 @@ public SwaggerTagsAttribute(params string[] tags)
/// <summary>Gets or sets a value indicating whether the tags should be added to document's 'tags' property (only needed on operation methods, default: false).</summary>
public bool AddToDocument { get; set; }
}
}
}
35 changes: 21 additions & 14 deletions src/NSwag.AspNetCore/NSwag.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net451;netstandard1.6;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net451;netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
<Description>NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript</Description>
<Version>13.10.8</Version>
<PackageTags>Swagger Documentation AspNetCore NetCore TypeScript CodeGen</PackageTags>
Expand All @@ -11,7 +11,7 @@
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>../NSwag.snk</AssemblyOriginatorKeyFile>
<Authors>Rico Suter</Authors>
<PackageIconUrl>https://raw.githubusercontent.com/RicoSuter/NSwag/master/assets/NuGetIcon.png</PackageIconUrl>
<PackageIcon>NuGetIcon.png</PackageIcon>
<Company />
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>

Expand All @@ -22,7 +22,9 @@
<MicrosoftAspNetCoreMvcFormattersJsonPackageVersion>1.0.6</MicrosoftAspNetCoreMvcFormattersJsonPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>1.0.4</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftExtensionsApiDescriptionServerPackageVersion>3.0.0</MicrosoftExtensionsApiDescriptionServerPackageVersion>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>1.0.1</MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>[1.0.1, 6.0)</MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersionCore31>[3.1, 4.0)</MicrosoftExtensionsFileProvidersEmbeddedPackageVersionCore31>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersionNet5>[5, 6.0)</MicrosoftExtensionsFileProvidersEmbeddedPackageVersionNet5>
<NETStandardLibraryPackageVersion>1.6.1</NETStandardLibraryPackageVersion>
<SystemIOFileSystemPackageVersion>4.3.0</SystemIOFileSystemPackageVersion>
<SystemXmlXPathXDocumentPackageVersion>4.0.1</SystemXmlXPathXDocumentPackageVersion>
Expand All @@ -31,30 +33,33 @@
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\assets\NuGetIcon.png" Pack="true" PackagePath="" />
<EmbeddedResource Include="ReDoc\index.html" />
<EmbeddedResource Include="SwaggerUi\**\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
<EmbeddedResource Include="SwaggerUi3\**\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'netcoreapp3.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' OR '$(TargetFramework)' == 'netstandard1.6' OR '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="$(MicrosoftAspNetCoreMvcCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="$(MicrosoftAspNetCoreMvcFormattersJsonPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersion)" />
</ItemGroup>
<!--<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
<PackageReference Include="Microsoft.AspNetCore.App" Version="3.0.0" />
</ItemGroup>-->
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' OR '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.IO.FileSystem" Version="$(SystemIOFileSystemPackageVersion)" />
<PackageReference Include="System.Xml.XPath.XDocument" Version="$(SystemXmlXPathXDocumentPackageVersion)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
<Compile Remove="Middlewares\WebApiToSwaggerMiddleware.cs" />
<Compile Remove="SwaggerExtensions.cs" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersionCore31)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersionNet5)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NSwag.Annotations\NSwag.Annotations.csproj" />
<ProjectReference Include="..\NSwag.Core\NSwag.Core.csproj" />
Expand All @@ -77,6 +82,8 @@
microsoftAspNetCoreStaticFilesPackageVersion=$(MicrosoftAspNetCoreStaticFilesPackageVersion);
microsoftExtensionsApiDescriptionServerPackageVersion=$(MicrosoftExtensionsApiDescriptionServerPackageVersion);
microsoftExtensionsFileProvidersEmbeddedPackageVersion=$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersion);
microsoftExtensionsFileProvidersEmbeddedPackageVersionCore31=$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersionCore31);
microsoftExtensionsFileProvidersEmbeddedPackageVersionNet5=$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersionNet5);
netStandardLibraryPackageVersion=$(NETStandardLibraryPackageVersion);
systemIOFileSystemPackageVersion=$(SystemIOFileSystemPackageVersion);
systemXmlXPathXDocumentPackageVersion=$(SystemXmlXPathXDocumentPackageVersion);
Expand Down
23 changes: 22 additions & 1 deletion src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<tags>OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet</tags>
<projectUrl>https://github.com/RicoSuter/NSwag</projectUrl>
<license type="expression">MIT</license>
<iconUrl>https://raw.githubusercontent.com/RicoSuter/NSwag/master/assets/NuGetIcon.png</iconUrl>
<icon>NuGetIcon.png</icon>
<repository type="git" url="https://github.com/RicoSuter/NSwag.git"/>
<dependencies>
<group targetFramework=".NETFramework4.5.1">
Expand Down Expand Up @@ -52,9 +52,26 @@
<dependency id="System.IO.FileSystem" version="$systemIOFileSystemPackageVersion$" exclude="Build,Analyzers" />
<dependency id="System.Xml.XPath.XDocument" version="$systemXmlXPathXDocumentPackageVersion$" exclude="Build,Analyzers" />
</group>
<group targetFramework="netcoreapp3.1">
<dependency id="NSwag.Annotations" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Core" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Core.Yaml" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Generation.AspNetCore" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Generation" version="$version$" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.FileProviders.Embedded" version="$MicrosoftExtensionsFileProvidersEmbeddedPackageVersionCore31$" exclude="Build,Analyzers" />
</group>
<group targetFramework="net5.0">
<dependency id="NSwag.Annotations" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Core" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Core.Yaml" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Generation.AspNetCore" version="$version$" exclude="Build,Analyzers" />
<dependency id="NSwag.Generation" version="$version$" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.FileProviders.Embedded" version="$MicrosoftExtensionsFileProvidersEmbeddedPackageVersionNet5$" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\..\assets\NuGetIcon.png" target="NuGetIcon.png" />
<file src="build\*" target="build\" />
<file src="buildMultiTargeting\*" target="buildMultiTargeting\" />
<file src="bin\$configuration$\net451\NSwag.AspNetCore.dll" target="lib\net451\" />
Expand All @@ -63,5 +80,9 @@
<file src="bin\$configuration$\netstandard1.6\NSwag.AspNetCore.xml" target="lib\netstandard1.6\" />
<file src="bin\$configuration$\netstandard2.0\NSwag.AspNetCore.dll" target="lib\netstandard2.0\" />
<file src="bin\$configuration$\netstandard2.0\NSwag.AspNetCore.xml" target="lib\netstandard2.0\" />
<file src="bin\$configuration$\netcoreapp3.1\NSwag.AspNetCore.dll" target="lib\netcoreapp3.1\" />
<file src="bin\$configuration$\netcoreapp3.1\NSwag.AspNetCore.xml" target="lib\netcoreapp3.1\" />
<file src="bin\$configuration$\net5.0\NSwag.AspNetCore.dll" target="lib\net5.0\" />
<file src="bin\$configuration$\net5.0\NSwag.AspNetCore.xml" target="lib\net5.0\" />
</files>
</package>
4 changes: 3 additions & 1 deletion src/NSwag.AspNetCore/SwaggerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public SwaggerSettings()
public TimeSpan ExceptionCacheTime { get; set; } = TimeSpan.FromSeconds(10);
#endif

#pragma warning disable 618
internal virtual string ActualSwaggerDocumentPath => DocumentPath.Substring(MiddlewareBasePath?.Length ?? 0);
#pragma warning restore 618

#if AspNetOwin
internal T CreateGeneratorSettings(JsonSerializerSettings serializerSettings, object mvcOptions)
Expand All @@ -75,4 +77,4 @@ internal T CreateGeneratorSettings(JsonSerializerSettings serializerSettings, ob
}
#endif
}
}
}
4 changes: 3 additions & 1 deletion src/NSwag.AspNetCore/SwaggerUi3Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ internal override string TransformHtml(string html, HttpRequest request)
html = html.Replace("{Urls}", !SwaggerRoutes.Any() ?
"undefined" :
JsonConvert.SerializeObject(
#pragma warning disable 618
SwaggerRoutes.Select(r => new SwaggerUi3Route(r.Name, TransformToExternalPath(r.Url.Substring(MiddlewareBasePath?.Length ?? 0), request)))
#pragma warning restore 618
));

html = html.Replace("{ValidatorUrl}", ValidateSpecification ? "undefined" : "null");
Expand Down Expand Up @@ -189,4 +191,4 @@ public SwaggerUi3Route(string name, string url)
[JsonProperty("name")]
public string Name { get; internal set; }
}
}
}
2 changes: 2 additions & 0 deletions src/NSwag.AspNetCore/SwaggerUiSettingsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public SwaggerUiSettingsBase()
/// <summary>Gets or sets the internal swagger UI route (must start with '/').</summary>
public string Path { get; set; } = "/swagger";

#pragma warning disable 618
internal string ActualSwaggerUiPath => Path.Substring(MiddlewareBasePath?.Length ?? 0);
#pragma warning restore 618

/// <summary>Gets or sets custom inline styling to inject into the index.html</summary>
public string CustomInlineStyles { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static IServiceProvider GetServiceProvider(string applicationName)
null, createWebHostMethod.GetParameters().Length > 0 ? new object[] { args } : new object[0]);
serviceProvider = webHostBuilder.Build().Services;
}
#if NET5_0 || NETCOREAPP3_0
#if NET5_0 || NETCOREAPP3_1 || NETCOREAPP3_0
else
{
var createHostMethod =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public bool AllowNullableBodyParameters
public async Task<TSettings> CreateSettingsAsync(AssemblyLoader.AssemblyLoader assemblyLoader, IServiceProvider serviceProvider, string workingDirectory)
{
var mvcOptions = serviceProvider?.GetRequiredService<IOptions<MvcOptions>>().Value;
#if NET5_0 || NETCOREAPP3_0
#if NET5_0 || NETCOREAPP3_1 || NETCOREAPP3_0
JsonSerializerSettings serializerSettings;
try
{
Expand Down Expand Up @@ -302,7 +302,7 @@ protected async Task<IDisposable> CreateWebHostAsync(AssemblyLoader.AssemblyLoad
}
else
{
#if NET5_0 || NETCOREAPP3_0
#if NET5_0 || NETCOREAPP3_1 || NETCOREAPP3_0
method =
programType.GetRuntimeMethod("CreateHostBuilder", new[] { typeof(string[]) }) ??
programType.GetRuntimeMethod("CreateHostBuilder", new Type[0]);
Expand Down Expand Up @@ -441,4 +441,4 @@ private async Task<string> GetDocumentTemplateAsync(string workingDirectory)
}
}
}
}
}
Loading