forked from microsoft/OpenAPI.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenApiExternalDocsRules.cs
More file actions
29 lines (28 loc) · 974 Bytes
/
OpenApiExternalDocsRules.cs
File metadata and controls
29 lines (28 loc) · 974 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
29
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace Microsoft.OpenApi
{
/// <summary>
/// The validation rules for <see cref="OpenApiExternalDocs"/>.
/// </summary>
[OpenApiRule]
public static class OpenApiExternalDocsRules
{
/// <summary>
/// Validate the field is required.
/// </summary>
public static ValidationRule<OpenApiExternalDocs> UrlIsRequired =>
new(nameof(UrlIsRequired),
(context, item) =>
{
// url
if (item.Url == null)
{
context.Enter("url");
context.CreateError(nameof(UrlIsRequired),
string.Format(SRResource.Validation_FieldIsRequired, "url", "External Documentation"));
context.Exit();
}
});
}
}