Skip to content

Commit 0d10c49

Browse files
authored
Make IApiBehaviorMetadata public (#8410)
Fixes #8403 The analyzer expects the type to be present. However since it's listed as internal, it is not present when compiling against the ref assembly \ targeting pack. It was left as internal so we could evolve it later, but we haven't found a need for it as yet.
1 parent 4a5f2d1 commit 0d10c49

File tree

6 files changed

+25
-18
lines changed

6 files changed

+25
-18
lines changed

src/Mvc/Mvc.Analyzers/src/SymbolNames.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal static class SymbolNames
2929

3030
public const string HtmlHelperPartialExtensionsType = "Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperPartialExtensions";
3131

32-
public const string IApiBehaviorMetadata = "Microsoft.AspNetCore.Mvc.IApiBehaviorMetadata";
32+
public const string IApiBehaviorMetadata = "Microsoft.AspNetCore.Mvc.Infrastructure.IApiBehaviorMetadata";
3333

3434
public const string IBinderTypeProviderMetadata = "Microsoft.AspNetCore.Mvc.ModelBinding.IBinderTypeProviderMetadata";
3535

src/Mvc/Mvc.Api.Analyzers/src/ApiSymbolNames.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal static class ApiSymbolNames
2323

2424
public const string DefaultStatusCodeAttribute = "Microsoft.AspNetCore.Mvc.Infrastructure.DefaultStatusCodeAttribute";
2525

26-
public const string IApiBehaviorMetadata = "Microsoft.AspNetCore.Mvc.IApiBehaviorMetadata";
26+
public const string IApiBehaviorMetadata = "Microsoft.AspNetCore.Mvc.Infrastructure.IApiBehaviorMetadata";
2727

2828
public const string IActionResult = "Microsoft.AspNetCore.Mvc.IActionResult";
2929

src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp3.0.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public ApiBehaviorOptions() { }
115115
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
116116
}
117117
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
118-
public partial class ApiControllerAttribute : Microsoft.AspNetCore.Mvc.ControllerAttribute, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata
118+
public partial class ApiControllerAttribute : Microsoft.AspNetCore.Mvc.ControllerAttribute, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata, Microsoft.AspNetCore.Mvc.Infrastructure.IApiBehaviorMetadata
119119
{
120120
public ApiControllerAttribute() { }
121121
}
@@ -1980,6 +1980,9 @@ public partial interface IActionSelector
19801980
Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor SelectBestCandidate(Microsoft.AspNetCore.Routing.RouteContext context, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor> candidates);
19811981
System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor> SelectCandidates(Microsoft.AspNetCore.Routing.RouteContext context);
19821982
}
1983+
public partial interface IApiBehaviorMetadata : Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata
1984+
{
1985+
}
19831986
public partial interface IClientErrorActionResult : Microsoft.AspNetCore.Mvc.IActionResult, Microsoft.AspNetCore.Mvc.Infrastructure.IStatusCodeActionResult
19841987
{
19851988
}

src/Mvc/Mvc.Core/src/ApiControllerAttribute.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5+
using Microsoft.AspNetCore.Mvc.Infrastructure;
56

67
namespace Microsoft.AspNetCore.Mvc
78
{

src/Mvc/Mvc.Core/src/IApiBehaviorMetadata.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using Microsoft.AspNetCore.Mvc.Filters;
5+
6+
namespace Microsoft.AspNetCore.Mvc.Infrastructure
7+
{
8+
/// <summary>
9+
/// A <see cref="IFilterMetadata"/> that indicates that a type and all derived types are used to serve HTTP API responses.
10+
/// <para>
11+
/// Controllers decorated with this attribute (<see cref="ApiControllerAttribute"/>) are configured with
12+
/// features and behavior targeted at improving the developer experience for building APIs.
13+
/// </para>
14+
/// </summary>
15+
public interface IApiBehaviorMetadata : IFilterMetadata
16+
{
17+
}
18+
}

0 commit comments

Comments
 (0)