| | | 1 | | |
| | | 2 | | /// <summary> |
| | | 3 | | /// Specifies metadata for an OpenAPI response object. |
| | | 4 | | /// Can be attached to PowerShell or C# classes representing reusable responses. |
| | | 5 | | /// </summary> |
| | | 6 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inher |
| | | 7 | | public sealed class OpenApiResponseAttribute : KestrunAnnotation |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Optional component name override for components.responses key. |
| | | 11 | | /// If omitted, the generator will name by member (Class.Property) when used on members, |
| | | 12 | | /// or by class name when applied at class-level. |
| | | 13 | | /// </summary> |
| | 2 | 14 | | public string? Key { get; set; } |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// The HTTP status code (e.g., "200", "400", "404"). |
| | | 18 | | /// </summary> |
| | 2 | 19 | | public string StatusCode { get; set; } = "default"; |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// A short description of the response (required in OpenAPI spec). |
| | | 23 | | /// </summary> |
| | 6 | 24 | | public string? Description { get; set; } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Optional reference to a predefined schema (e.g., "UserInfoResponse"). |
| | | 28 | | /// </summary> |
| | 6 | 29 | | public string? SchemaRef { get; set; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Optional CLR type for the response schema. |
| | | 33 | | /// When set, this takes precedence over SchemaRef and is |
| | | 34 | | /// mapped via InferPrimitiveSchema / PrimitiveSchemaMap. |
| | | 35 | | /// </summary> |
| | 2 | 36 | | public Type? Schema { get; set; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// MIME type of the response payload (default: "application/json"). |
| | | 40 | | /// </summary> |
| | 8 | 41 | | public string[] ContentType { get; set; } = ["application/json"]; |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// If true, the schema will be inlined rather than referenced. |
| | | 45 | | /// </summary> |
| | 4 | 46 | | public bool Inline { get; set; } |
| | | 47 | | } |