-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathOpenApiSchemas.cs
More file actions
31 lines (26 loc) · 1.15 KB
/
OpenApiSchemas.cs
File metadata and controls
31 lines (26 loc) · 1.15 KB
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
30
31
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using OpenShock.Common.Models;
namespace OpenShock.Common.DataAnnotations;
public static class OpenApiSchemas
{
public static OpenApiSchema SemVerSchema => new OpenApiSchema {
Title = "SemVer",
Type = "string",
Pattern = /* lang=regex */ "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
Example = new OpenApiString("1.0.0-dev+a16f2")
};
public static OpenApiSchema PauseReasonEnumSchema => new OpenApiSchema {
Title = nameof(PauseReason),
Type = "integer",
Description = """
An integer representing the reason(s) for the shocker being paused, expressed as a bitfield where reasons are OR'd together.
Each bit corresponds to:
- 1: Shocker
- 2: UserShare
- 4: PublicShare
For example, a value of 6 (2 | 4) indicates both 'UserShare' and 'PublicShare' reasons.
""",
Example = new OpenApiInteger(6)
};
}