|
| 1 | +using System.Collections.Generic; |
| 2 | +using System.Text.Json.Nodes; |
| 3 | +using Microsoft.OpenApi.Interfaces; |
| 4 | + |
| 5 | +namespace Microsoft.OpenApi.Models.Interfaces; |
| 6 | + |
| 7 | +/// <summary> |
| 8 | +/// Defines the base properties for the example object. |
| 9 | +/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking. |
| 10 | +/// </summary> |
| 11 | +public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible |
| 12 | +{ |
| 13 | + /// <summary> |
| 14 | + /// REQUIRED. The name of the parameter. Parameter names are case sensitive. |
| 15 | + /// If in is "path", the name field MUST correspond to the associated path segment from the path field in the Paths Object. |
| 16 | + /// If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored. |
| 17 | + /// For all other cases, the name corresponds to the parameter name used by the in property. |
| 18 | + /// </summary> |
| 19 | + public string Name { get; } |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// REQUIRED. The location of the parameter. |
| 23 | + /// Possible values are "query", "header", "path" or "cookie". |
| 24 | + /// </summary> |
| 25 | + public ParameterLocation? In { get; } |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// Determines whether this parameter is mandatory. |
| 29 | + /// If the parameter location is "path", this property is REQUIRED and its value MUST be true. |
| 30 | + /// Otherwise, the property MAY be included and its default value is false. |
| 31 | + /// </summary> |
| 32 | + public bool Required { get; } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. |
| 36 | + /// </summary> |
| 37 | + public bool Deprecated { get; } |
| 38 | + |
| 39 | + /// <summary> |
| 40 | + /// Sets the ability to pass empty-valued parameters. |
| 41 | + /// This is valid only for query parameters and allows sending a parameter with an empty value. |
| 42 | + /// Default value is false. |
| 43 | + /// If style is used, and if behavior is n/a (cannot be serialized), |
| 44 | + /// the value of allowEmptyValue SHALL be ignored. |
| 45 | + /// </summary> |
| 46 | + public bool AllowEmptyValue { get; } |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Describes how the parameter value will be serialized depending on the type of the parameter value. |
| 50 | + /// Default values (based on value of in): for query - form; for path - simple; for header - simple; |
| 51 | + /// for cookie - form. |
| 52 | + /// </summary> |
| 53 | + public ParameterStyle? Style { get; } |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// When this is true, parameter values of type array or object generate separate parameters |
| 57 | + /// for each value of the array or key-value pair of the map. |
| 58 | + /// For other types of parameters this property has no effect. |
| 59 | + /// When style is form, the default value is true. |
| 60 | + /// For all other styles, the default value is false. |
| 61 | + /// </summary> |
| 62 | + public bool Explode { get; } |
| 63 | + |
| 64 | + /// <summary> |
| 65 | + /// Determines whether the parameter value SHOULD allow reserved characters, |
| 66 | + /// as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. |
| 67 | + /// This property only applies to parameters with an in value of query. |
| 68 | + /// The default value is false. |
| 69 | + /// </summary> |
| 70 | + public bool AllowReserved { get; } |
| 71 | + |
| 72 | + /// <summary> |
| 73 | + /// The schema defining the type used for the parameter. |
| 74 | + /// </summary> |
| 75 | + public OpenApiSchema Schema { get; } |
| 76 | + |
| 77 | + /// <summary> |
| 78 | + /// Examples of the media type. Each example SHOULD contain a value |
| 79 | + /// in the correct format as specified in the parameter encoding. |
| 80 | + /// The examples object is mutually exclusive of the example object. |
| 81 | + /// Furthermore, if referencing a schema which contains an example, |
| 82 | + /// the examples value SHALL override the example provided by the schema. |
| 83 | + /// </summary> |
| 84 | + public IDictionary<string, IOpenApiExample> Examples { get; } |
| 85 | + |
| 86 | + /// <summary> |
| 87 | + /// Example of the media type. The example SHOULD match the specified schema and encoding properties |
| 88 | + /// if present. The example object is mutually exclusive of the examples object. |
| 89 | + /// Furthermore, if referencing a schema which contains an example, |
| 90 | + /// the example value SHALL override the example provided by the schema. |
| 91 | + /// To represent examples of media types that cannot naturally be represented in JSON or YAML, |
| 92 | + /// a string value can contain the example with escaping where necessary. |
| 93 | + /// </summary> |
| 94 | + public JsonNode Example { get; } |
| 95 | + |
| 96 | + /// <summary> |
| 97 | + /// A map containing the representations for the parameter. |
| 98 | + /// The key is the media type and the value describes it. |
| 99 | + /// The map MUST only contain one entry. |
| 100 | + /// For more complex scenarios, the content property can define the media type and schema of the parameter. |
| 101 | + /// A parameter MUST contain either a schema property, or a content property, but not both. |
| 102 | + /// When example or examples are provided in conjunction with the schema object, |
| 103 | + /// the example MUST follow the prescribed serialization strategy for the parameter. |
| 104 | + /// </summary> |
| 105 | + public IDictionary<string, OpenApiMediaType> Content { get; } |
| 106 | +} |
0 commit comments