| | | 1 | | using Microsoft.OpenApi; |
| | | 2 | | |
| | | 3 | | namespace Kestrun.Hosting.Options; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Metadata for OpenAPI documentation related to the route. |
| | | 7 | | /// </summary> |
| | | 8 | | public record OpenAPICommonMetadata |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Initializes a new instance of the <see cref="OpenAPICommonMetadata"/> class with the specified pattern. |
| | | 12 | | /// </summary> |
| | | 13 | | /// <param name="pattern">The route pattern.</param> |
| | 9 | 14 | | public OpenAPICommonMetadata(string pattern) |
| | | 15 | | { |
| | 9 | 16 | | Pattern = pattern; |
| | 9 | 17 | | Enabled = true; |
| | 9 | 18 | | } |
| | | 19 | | /// <summary> |
| | | 20 | | /// Initializes a new instance of the <see cref="OpenAPICommonMetadata"/> class. |
| | | 21 | | /// </summary> |
| | 0 | 22 | | public OpenAPICommonMetadata() |
| | | 23 | | { |
| | 0 | 24 | | Pattern = "/"; |
| | 0 | 25 | | Enabled = true; |
| | 0 | 26 | | } |
| | | 27 | | /// <summary> |
| | | 28 | | /// Indicates whether OpenAPI documentation is enabled for this route. |
| | | 29 | | /// </summary> |
| | 9 | 30 | | public bool Enabled { get; set; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// The relative path for the route in OpenAPI documentation. |
| | | 34 | | /// </summary> |
| | 9 | 35 | | public string Pattern { get; set; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// A brief summary of the route for OpenAPI documentation. |
| | | 39 | | /// </summary> |
| | 7 | 40 | | public string? Summary { get; set; } |
| | | 41 | | /// <summary> |
| | | 42 | | /// A detailed description of the route for OpenAPI documentation. |
| | | 43 | | /// </summary> |
| | 3 | 44 | | public string? Description { get; set; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// The name of the CORS policy to apply to this route. |
| | | 48 | | /// </summary> |
| | 0 | 49 | | public string? CorsPolicy { get; set; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// An alternative server array to service this operation. |
| | | 53 | | /// If an alternative server object is specified at the Path Item Object or Root level, |
| | | 54 | | /// it will be overridden by this value. |
| | | 55 | | /// </summary> |
| | 11 | 56 | | public IList<OpenApiServer>? Servers { get; set; } = []; |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// A list of parameters that are applicable for this operation. |
| | | 60 | | /// If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. |
| | | 61 | | /// The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and lo |
| | | 62 | | /// The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/ |
| | | 63 | | /// </summary> |
| | 11 | 64 | | public IList<IOpenApiParameter>? Parameters { get; set; } = []; |
| | | 65 | | } |