forked from microsoft/OpenAPI.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenApiLicenseRules.cs
More file actions
28 lines (27 loc) · 928 Bytes
/
OpenApiLicenseRules.cs
File metadata and controls
28 lines (27 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace Microsoft.OpenApi
{
/// <summary>
/// The validation rules for <see cref="OpenApiLicense"/>.
/// </summary>
[OpenApiRule]
public static class OpenApiLicenseRules
{
/// <summary>
/// REQUIRED.
/// </summary>
public static ValidationRule<OpenApiLicense> LicenseRequiredFields =>
new(nameof(LicenseRequiredFields),
(context, license) =>
{
if (license.Name == null)
{
context.Enter("name");
context.CreateError(nameof(LicenseRequiredFields),
string.Format(SRResource.Validation_FieldIsRequired, "name", "license"));
context.Exit();
}
});
}
}