-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathSwaggerEndpointOptions.cs
More file actions
39 lines (35 loc) · 1.43 KB
/
SwaggerEndpointOptions.cs
File metadata and controls
39 lines (35 loc) · 1.43 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
32
33
34
35
36
37
38
39
using Microsoft.AspNetCore.Http;
using Microsoft.OpenApi;
using Microsoft.OpenApi.Models;
namespace Swashbuckle.AspNetCore.Swagger
{
public class SwaggerEndpointOptions
{
public SwaggerEndpointOptions()
{
PreSerializeFilters = [];
OpenApiVersion = OpenApiSpecVersion.OpenApi3_0;
}
/// <summary>
/// Return Swagger JSON/YAML in the V2.0 format rather than V3.0.
/// </summary>
[Obsolete($"This property will be removed in a future version of Swashbuckle.AspNetCore. Use the {nameof(OpenApiVersion)} property instead.")]
public bool SerializeAsV2
{
get => OpenApiVersion == OpenApiSpecVersion.OpenApi2_0;
set => OpenApiVersion = value ? OpenApiSpecVersion.OpenApi2_0 : OpenApiSpecVersion.OpenApi3_0;
}
/// <summary>
/// Gets or sets the OpenAPI (Swagger) document version to use.
/// </summary>
/// <remarks>
/// The default value is <see cref="OpenApiSpecVersion.OpenApi3_0"/>.
/// </remarks>
public OpenApiSpecVersion OpenApiVersion { get; set; }
/// <summary>
/// Actions that can be applied SwaggerDocument's before they're serialized to JSON.
/// Useful for setting metadata that's derived from the current request
/// </summary>
public List<Action<OpenApiDocument, HttpRequest>> PreSerializeFilters { get; private set; }
}
}