| | | 1 | | |
| | | 2 | | using System.Text.Json.Nodes; |
| | | 3 | | using Microsoft.OpenApi; |
| | | 4 | | |
| | | 5 | | namespace Kestrun.Languages; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Base class for parameter information to be injected into a script. |
| | | 9 | | /// </summary> |
| | 33 | 10 | | public abstract class ParameterForInjectionInfoBase(string name, Type parameterType) |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// The name of the parameter. |
| | | 14 | | /// </summary> |
| | 85 | 15 | | public string Name { get; init; } = name; |
| | | 16 | | |
| | | 17 | | /// <summary> |
| | | 18 | | /// The .NET type of the parameter. |
| | | 19 | | /// </summary> |
| | 63 | 20 | | public Type ParameterType { get; init; } = parameterType; |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// The JSON schema type of the parameter. |
| | | 24 | | /// </summary> |
| | 82 | 25 | | public JsonSchemaType? Type { get; init; } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// The default value of the parameter. |
| | | 29 | | /// </summary> |
| | 50 | 30 | | public JsonNode? DefaultValue { get; init; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// The location of the parameter. |
| | | 34 | | /// </summary> |
| | 95 | 35 | | public ParameterLocation? In { get; init; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Indicates whether the parameter is from the request body. |
| | | 39 | | /// </summary> |
| | 23 | 40 | | public bool IsRequestBody => In is null; |
| | | 41 | | /// <summary> |
| | | 42 | | /// Content types associated with the parameter. |
| | | 43 | | /// </summary> |
| | 53 | 44 | | public List<string> ContentTypes { get; init; } = []; |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// The style of the parameter. |
| | | 48 | | /// </summary> |
| | 7 | 49 | | public ParameterStyle? Style { get; init; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Indicates whether the parameter should be exploded. |
| | | 53 | | /// </summary> |
| | 7 | 54 | | public bool Explode { get; init; } |
| | | 55 | | } |