File tree Expand file tree Collapse file tree 14 files changed +85
-37
lines changed
src/Microsoft.OpenApi/Validations Expand file tree Collapse file tree 14 files changed +85
-37
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ namespace Microsoft.OpenApi.Validations.Rules
11
11
/// <summary>
12
12
/// The validation rules for <see cref="OpenApiComponents"/>.
13
13
/// </summary>
14
+ [ OpenApiRule ]
14
15
public static class OpenApiComponentsRules
15
16
{
16
17
/// <summary>
@@ -22,7 +23,7 @@ public static class OpenApiComponentsRules
22
23
/// All the fixed fields declared above are objects
23
24
/// that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.
24
25
/// </summary>
25
- public static readonly ValidationRule < OpenApiComponents > KeyMustBeRegularExpression =
26
+ public static ValidationRule < OpenApiComponents > KeyMustBeRegularExpression =>
26
27
new ValidationRule < OpenApiComponents > (
27
28
( context , components ) =>
28
29
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="OpenApiContact"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
internal static class OpenApiContactRules
14
15
{
15
16
/// <summary>
16
17
/// Email field MUST be email address.
17
18
/// </summary>
18
- public static readonly ValidationRule < OpenApiContact > EmailMustBeEmailFormat =
19
+ public static ValidationRule < OpenApiContact > EmailMustBeEmailFormat =>
19
20
new ValidationRule < OpenApiContact > (
20
21
( context , item ) =>
21
22
{
@@ -35,7 +36,7 @@ internal static class OpenApiContactRules
35
36
/// <summary>
36
37
/// Url field MUST be url format.
37
38
/// </summary>
38
- public static readonly ValidationRule < OpenApiContact > UrlMustBeUrlFormat =
39
+ public static ValidationRule < OpenApiContact > UrlMustBeUrlFormat =>
39
40
new ValidationRule < OpenApiContact > (
40
41
( context , item ) =>
41
42
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="OpenApiDocument"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
internal static class OpenApiDocumentRules
14
15
{
15
16
/// <summary>
16
17
/// The Info field is required.
17
18
/// </summary>
18
- public static readonly ValidationRule < OpenApiDocument > FieldIsRequired =
19
+ public static ValidationRule < OpenApiDocument > FieldIsRequired =>
19
20
new ValidationRule < OpenApiDocument > (
20
21
( context , item ) =>
21
22
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="IOpenApiExtensible"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
public static class OpenApiExtensibleRules
14
15
{
15
16
/// <summary>
16
17
/// Extension name MUST start with "x-".
17
18
/// </summary>
18
- public static readonly ValidationRule < IOpenApiExtensible > ExtensionNameMustStartWithXDash =
19
+ public static ValidationRule < IOpenApiExtensible > ExtensionNameMustStartWithXDash =>
19
20
new ValidationRule < IOpenApiExtensible > (
20
21
( context , item ) =>
21
22
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="OpenApiExternalDocs"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
internal static class OpenApiExternalDocsRules
14
15
{
15
16
/// <summary>
16
17
/// Validate the field is required.
17
18
/// </summary>
18
- public static readonly ValidationRule < OpenApiExternalDocs > FieldIsRequired =
19
+ public static ValidationRule < OpenApiExternalDocs > FieldIsRequired =>
19
20
new ValidationRule < OpenApiExternalDocs > (
20
21
( context , item ) =>
21
22
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="OpenApiInfo"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
internal static class OpenApiInfoRules
14
15
{
15
16
/// <summary>
16
17
/// Validate the field is required.
17
18
/// </summary>
18
- public static readonly ValidationRule < OpenApiInfo > FieldIsRequired =
19
+ public static ValidationRule < OpenApiInfo > FieldIsRequired =>
19
20
new ValidationRule < OpenApiInfo > (
20
21
( context , item ) =>
21
22
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="OpenApiLicense"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
public static class OpenApiLicenseRules
14
15
{
15
16
/// <summary>
16
17
/// REQUIRED.
17
18
/// </summary>
18
- public static readonly ValidationRule < OpenApiLicense > FieldIsRequired =
19
+ public static ValidationRule < OpenApiLicense > FieldIsRequired =>
19
20
new ValidationRule < OpenApiLicense > (
20
21
( context , license ) =>
21
22
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="OpenApiOAuthFlow"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
internal static class OpenApiOAuthFlowRules
14
15
{
15
16
/// <summary>
16
17
/// Validate the field is required.
17
18
/// </summary>
18
- public static readonly ValidationRule < OpenApiOAuthFlow > FieldIsRequired =
19
+ public static ValidationRule < OpenApiOAuthFlow > FieldIsRequired =>
19
20
new ValidationRule < OpenApiOAuthFlow > (
20
21
( context , flow ) =>
21
22
{
Original file line number Diff line number Diff line change @@ -9,12 +9,13 @@ namespace Microsoft.OpenApi.Validations.Rules
9
9
/// <summary>
10
10
/// The validation rules for <see cref="OpenApiPaths"/>.
11
11
/// </summary>
12
+ [ OpenApiRule ]
12
13
public static class OpenApiPathsRules
13
14
{
14
15
/// <summary>
15
16
/// A relative path to an individual endpoint. The field name MUST begin with a slash.
16
17
/// </summary>
17
- public static readonly ValidationRule < OpenApiPaths > PathNameMustBeginWithSlash =
18
+ public static ValidationRule < OpenApiPaths > PathNameMustBeginWithSlash =>
18
19
new ValidationRule < OpenApiPaths > (
19
20
( context , item ) =>
20
21
{
Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ namespace Microsoft.OpenApi.Validations.Rules
10
10
/// <summary>
11
11
/// The validation rules for <see cref="OpenApiResponse"/>.
12
12
/// </summary>
13
+ [ OpenApiRule ]
13
14
internal static class OpenApiResponseRules
14
15
{
15
16
/// <summary>
16
17
/// Validate the field is required.
17
18
/// </summary>
18
- public static readonly ValidationRule < OpenApiResponse > FieldIsRequired =
19
+ public static ValidationRule < OpenApiResponse > FieldIsRequired =>
19
20
new ValidationRule < OpenApiResponse > (
20
21
( context , response ) =>
21
22
{
You can’t perform that action at this time.
0 commit comments