-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathOpenApiHelpers.cs
More file actions
27 lines (24 loc) · 816 Bytes
/
OpenApiHelpers.cs
File metadata and controls
27 lines (24 loc) · 816 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
using System.Net.Mime;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi;
namespace SimpleAuthentication.Swagger;
internal static class OpenApiHelpers
{
public static OpenApiSecurityRequirement CreateSecurityRequirement(string name, OpenApiDocument document)
=> new()
{
{ new OpenApiSecuritySchemeReference(name, document), [] }
};
public static OpenApiResponse CreateResponse(string description)
=> new()
{
Description = description,
Content = new Dictionary<string, OpenApiMediaType>
{
[MediaTypeNames.Application.ProblemJson] = new()
{
Schema = new OpenApiSchemaReference(nameof(ProblemDetails))
}
}
};
}