| | | 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 OpenAPIMetadata : OpenAPICommonMetadata |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Initializes a new instance of the <see cref="OpenAPIMetadata"/> class with the specified pattern. |
| | | 12 | | /// </summary> |
| | | 13 | | /// <param name="pattern">The route pattern.</param> |
| | | 14 | | public OpenAPIMetadata(string pattern) |
| | 9 | 15 | | : base(pattern) |
| | | 16 | | { |
| | 9 | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Initializes a new instance of the <see cref="OpenAPIMetadata"/> class. |
| | | 21 | | /// </summary> |
| | 0 | 22 | | public OpenAPIMetadata() |
| | | 23 | | { |
| | 0 | 24 | | } |
| | | 25 | | /// <summary> |
| | | 26 | | /// The unique operation ID for the route in OpenAPI documentation. |
| | | 27 | | /// </summary> |
| | 5 | 28 | | public string? OperationId { get; set; } |
| | | 29 | | /// <summary> |
| | | 30 | | /// Comma-separated tags for OpenAPI documentation. |
| | | 31 | | /// </summary> |
| | 17 | 32 | | public List<string> Tags { get; set; } = []; // Comma-separated tags |
| | | 33 | | /// <summary> |
| | | 34 | | /// External documentation reference for the route. |
| | | 35 | | /// </summary> |
| | 0 | 36 | | public OpenApiExternalDocs? ExternalDocs { get; set; } |
| | | 37 | | /// <summary> |
| | | 38 | | /// Indicates whether the operation is deprecated in OpenAPI documentation. |
| | | 39 | | /// </summary> |
| | 0 | 40 | | public bool Deprecated { get; set; } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// The request body applicable for this operation. |
| | | 44 | | /// The requestBody is only supported in HTTP methods where the HTTP 1.1 specification RFC7231 |
| | | 45 | | /// has explicitly defined semantics for request bodies. |
| | | 46 | | /// In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers. |
| | | 47 | | /// </summary> |
| | 0 | 48 | | public IOpenApiRequestBody? RequestBody { get; set; } |
| | | 49 | | |
| | | 50 | | /// <summary> |
| | | 51 | | /// REQUIRED. The list of possible responses as they are returned from executing this operation. |
| | | 52 | | /// </summary> |
| | 11 | 53 | | public OpenApiResponses? Responses { get; set; } = []; |
| | | 54 | | |
| | | 55 | | /// <summary> |
| | | 56 | | /// A map of possible out-of band callbacks related to the parent operation. |
| | | 57 | | /// The key is a unique identifier for the Callback Object. |
| | | 58 | | /// Each value in the map is a Callback Object that describes a request |
| | | 59 | | /// that may be initiated by the API provider and the expected responses. |
| | | 60 | | /// The key value used to identify the callback object is an expression, evaluated at runtime, |
| | | 61 | | /// that identifies a URL to use for the callback operation. |
| | | 62 | | /// </summary> |
| | 0 | 63 | | public IDictionary<string, IOpenApiCallback>? Callbacks { get; set; } |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// A declaration of which security mechanisms can be used for this operation. |
| | | 67 | | /// The list of values includes alternative security requirement objects that can be used. |
| | | 68 | | /// </summary> |
| | 0 | 69 | | public List<Dictionary<string, List<string>>>? SecuritySchemes { get; set; } |
| | | 70 | | } |