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