Skip to content

Commit 6567ae5

Browse files
authored
Mark validations info related types are experimental (#61862)
* Mark validations info related types are experimental * Remove comment from emitted code
1 parent 1b3ec6e commit 6567ae5

File tree

30 files changed

+52
-1
lines changed

30 files changed

+52
-1
lines changed

docs/list-of-diagnostics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
| __`ASP0026`__ | [Authorize] overridden by [AllowAnonymous] from farther away |
3535
| __`ASP0027`__ | Unnecessary public Program class declaration |
3636
| __`ASP0028`__ | Consider using ListenAnyIP() instead of Listen(IPAddress.Any) |
37+
| __`ASP0029`__ | Experimental warning for validations resolver APIs |
3738

3839
### API (`API1000-API1003`)
3940

src/Http/Http.Abstractions/src/Validation/IValidatableInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
5+
46
namespace Microsoft.AspNetCore.Http.Validation;
57

68
/// <summary>
79
/// Represents an interface for validating a value.
810
/// </summary>
11+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
912
public interface IValidatableInfo
1013
{
1114
/// <summary>

src/Http/Http.Abstractions/src/Validation/IValidatableInfoResolver.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Http.Validation;
1010
/// Provides an interface for resolving the validation information associated
1111
/// with a given <seealso cref="Type"/> or <seealso cref="ParameterInfo"/>.
1212
/// </summary>
13+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
1314
public interface IValidatableInfoResolver
1415
{
1516
/// <summary>

src/Http/Http.Abstractions/src/Validation/RuntimeValidatableParameterInfoResolver.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#pragma warning disable ASP0029 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
2+
13
// Licensed to the .NET Foundation under one or more agreements.
24
// The .NET Foundation licenses this file to you under the MIT license.
35

src/Http/Http.Abstractions/src/Validation/ValidatableParameterInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
using System.Collections;
55
using System.ComponentModel.DataAnnotations;
66
using System.Diagnostics;
7+
using System.Diagnostics.CodeAnalysis;
78

89
namespace Microsoft.AspNetCore.Http.Validation;
910

1011
/// <summary>
1112
/// Contains validation information for a parameter.
1213
/// </summary>
14+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
1315
public abstract class ValidatableParameterInfo : IValidatableInfo
1416
{
1517
private RequiredAttribute? _requiredAttribute;

src/Http/Http.Abstractions/src/Validation/ValidatablePropertyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Http.Validation;
1010
/// <summary>
1111
/// Contains validation information for a member of a type.
1212
/// </summary>
13+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
1314
public abstract class ValidatablePropertyInfo : IValidatableInfo
1415
{
1516
private RequiredAttribute? _requiredAttribute;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
5+
46
namespace Microsoft.AspNetCore.Http.Validation;
57

68
/// <summary>
79
/// Indicates that a type is validatable to support discovery by the
810
/// validations generator.
911
/// </summary>
1012
[AttributeUsage(AttributeTargets.Class)]
13+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
1114
public sealed class ValidatableTypeAttribute : Attribute
1215
{
1316
}

src/Http/Http.Abstractions/src/Validation/ValidatableTypeInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace Microsoft.AspNetCore.Http.Validation;
1111
/// <summary>
1212
/// Contains validation information for a type.
1313
/// </summary>
14+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
1415
public abstract class ValidatableTypeInfo : IValidatableInfo
1516
{
1617
private readonly int _membersCount;

src/Http/Http.Abstractions/src/Validation/ValidateContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.ComponentModel.DataAnnotations;
5+
using System.Diagnostics.CodeAnalysis;
56

67
namespace Microsoft.AspNetCore.Http.Validation;
78

89
/// <summary>
910
/// Represents the context for validating a validatable object.
1011
/// </summary>
12+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
1113
public sealed class ValidateContext
1214
{
1315
/// <summary>

src/Http/Http.Abstractions/src/Validation/ValidationOptions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class ValidationOptions
1919
/// Source-generated resolvers are typically inserted at the beginning of this list
2020
/// to ensure they are checked before any runtime-based resolvers.
2121
/// </remarks>
22+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
2223
public IList<IValidatableInfoResolver> Resolvers { get; } = [];
2324

2425
/// <summary>
@@ -35,6 +36,7 @@ public class ValidationOptions
3536
/// <param name="validatableTypeInfo">When this method returns, contains the validation information for the specified type,
3637
/// if the type was found; otherwise, null.</param>
3738
/// <returns>true if validation information was found for the specified type; otherwise, false.</returns>
39+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
3840
public bool TryGetValidatableTypeInfo(Type type, [NotNullWhen(true)] out IValidatableInfo? validatableTypeInfo)
3941
{
4042
foreach (var resolver in Resolvers)
@@ -56,6 +58,7 @@ public bool TryGetValidatableTypeInfo(Type type, [NotNullWhen(true)] out IValida
5658
/// <param name="validatableInfo">When this method returns, contains the validation information for the specified parameter,
5759
/// if validation information was found; otherwise, null.</param>
5860
/// <returns>true if validation information was found for the specified parameter; otherwise, false.</returns>
61+
[Experimental("ASP0029", UrlFormat = "https://aka.ms/aspnet/analyzer/{0}")]
5962
public bool TryGetValidatableParameterInfo(ParameterInfo parameterInfo, [NotNullWhen(true)] out IValidatableInfo? validatableInfo)
6063
{
6164
foreach (var resolver in Resolvers)

0 commit comments

Comments
 (0)