4
4
using System ;
5
5
using System . Collections . Generic ;
6
6
using Microsoft . OpenApi . Interfaces ;
7
+ using Microsoft . OpenApi . Models . Interfaces ;
7
8
using Microsoft . OpenApi . Writers ;
8
9
9
10
namespace Microsoft . OpenApi . Models
10
11
{
11
12
/// <summary>
12
13
/// Link Object.
13
14
/// </summary>
14
- public class OpenApiLink : IOpenApiReferenceable , IOpenApiExtensible
15
+ public class OpenApiLink : IOpenApiReferenceable , IOpenApiExtensible , IOpenApiLink
15
16
{
16
- /// <summary>
17
- /// A relative or absolute reference to an OAS operation.
18
- /// This field is mutually exclusive of the operationId field, and MUST point to an Operation Object.
19
- /// </summary>
20
- public virtual string OperationRef { get ; set ; }
17
+ /// <inheritdoc/>
18
+ public string OperationRef { get ; set ; }
21
19
22
- /// <summary>
23
- /// The name of an existing, resolvable OAS operation, as defined with a unique operationId.
24
- /// This field is mutually exclusive of the operationRef field.
25
- /// </summary>
26
- public virtual string OperationId { get ; set ; }
20
+ /// <inheritdoc/>
21
+ public string OperationId { get ; set ; }
27
22
28
- /// <summary>
29
- /// A map representing parameters to pass to an operation as specified with operationId or identified via operationRef.
30
- /// </summary>
31
- public virtual Dictionary < string , RuntimeExpressionAnyWrapper > Parameters { get ; set ; } =
32
- new ( ) ;
23
+ /// <inheritdoc/>
24
+ public IDictionary < string , RuntimeExpressionAnyWrapper > Parameters { get ; set ; } = new Dictionary < string , RuntimeExpressionAnyWrapper > ( ) ;
33
25
34
- /// <summary>
35
- /// A literal value or {expression} to use as a request body when calling the target operation.
36
- /// </summary>
37
- public virtual RuntimeExpressionAnyWrapper RequestBody { get ; set ; }
38
-
39
- /// <summary>
40
- /// A description of the link.
41
- /// </summary>
42
- public virtual string Description { get ; set ; }
43
-
44
- /// <summary>
45
- /// A server object to be used by the target operation.
46
- /// </summary>
47
- public virtual OpenApiServer Server { get ; set ; }
26
+ /// <inheritdoc/>
27
+ public RuntimeExpressionAnyWrapper RequestBody { get ; set ; }
48
28
49
- /// <summary>
50
- /// This object MAY be extended with Specification Extensions.
51
- /// </summary>
52
- public virtual IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
29
+ /// <inheritdoc/>
30
+ public string Description { get ; set ; }
53
31
54
- /// <summary>
55
- /// Indicates if object is populated with data or is just a reference to the data
56
- /// </summary>
57
- public virtual bool UnresolvedReference { get ; set ; }
32
+ /// <inheritdoc/>
33
+ public OpenApiServer Server { get ; set ; }
58
34
59
- /// <summary>
60
- /// Reference pointer.
61
- /// </summary>
62
- public OpenApiReference Reference { get ; set ; }
35
+ /// <inheritdoc/>
36
+ public IDictionary < string , IOpenApiExtension > Extensions { get ; set ; } = new Dictionary < string , IOpenApiExtension > ( ) ;
63
37
64
38
/// <summary>
65
39
/// Parameterless constructor
@@ -69,36 +43,31 @@ public OpenApiLink() { }
69
43
/// <summary>
70
44
/// Initializes a copy of an <see cref="OpenApiLink"/> object
71
45
/// </summary>
72
- public OpenApiLink ( OpenApiLink link )
46
+ public OpenApiLink ( IOpenApiLink link )
73
47
{
74
- OperationRef = link ? . OperationRef ?? OperationRef ;
75
- OperationId = link ? . OperationId ?? OperationId ;
76
- Parameters = link ? . Parameters != null ? new ( link ? . Parameters ) : null ;
77
- RequestBody = link ? . RequestBody != null ? new ( link ? . RequestBody ) : null ;
78
- Description = link ? . Description ?? Description ;
79
- Server = link ? . Server != null ? new ( link ? . Server ) : null ;
80
- Extensions = link ? . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( link . Extensions ) : null ;
81
- UnresolvedReference = link ? . UnresolvedReference ?? UnresolvedReference ;
82
- Reference = link ? . Reference != null ? new ( link ? . Reference ) : null ;
48
+ Utils . CheckArgumentNull ( link ) ;
49
+ OperationRef = link . OperationRef ?? OperationRef ;
50
+ OperationId = link . OperationId ?? OperationId ;
51
+ Parameters = link . Parameters != null ? new Dictionary < string , RuntimeExpressionAnyWrapper > ( link . Parameters ) : null ;
52
+ RequestBody = link . RequestBody != null ? new ( link . RequestBody ) : null ;
53
+ Description = link . Description ?? Description ;
54
+ Server = link . Server != null ? new ( link . Server ) : null ;
55
+ Extensions = link . Extensions != null ? new Dictionary < string , IOpenApiExtension > ( link . Extensions ) : null ;
83
56
}
84
57
85
- /// <summary>
86
- /// Serialize <see cref="OpenApiLink"/> to Open Api v3.1
87
- /// </summary>
88
- public virtual void SerializeAsV31 ( IOpenApiWriter writer )
58
+ /// <inheritdoc/>
59
+ public void SerializeAsV31 ( IOpenApiWriter writer )
89
60
{
90
61
SerializeInternal ( writer , ( writer , element ) => element . SerializeAsV31 ( writer ) ) ;
91
62
}
92
63
93
- /// <summary>
94
- /// Serialize <see cref="OpenApiLink"/> to Open Api v3.0
95
- /// </summary>
96
- public virtual void SerializeAsV3 ( IOpenApiWriter writer )
64
+ /// <inheritdoc/>
65
+ public void SerializeAsV3 ( IOpenApiWriter writer )
97
66
{
98
67
SerializeInternal ( writer , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
99
68
}
100
69
101
- internal virtual void SerializeInternal ( IOpenApiWriter writer , Action < IOpenApiWriter , IOpenApiSerializable > callback )
70
+ internal void SerializeInternal ( IOpenApiWriter writer , Action < IOpenApiWriter , IOpenApiSerializable > callback )
102
71
{
103
72
Utils . CheckArgumentNull ( writer ) ;
104
73
@@ -128,9 +97,7 @@ internal virtual void SerializeInternal(IOpenApiWriter writer, Action<IOpenApiWr
128
97
writer . WriteEndObject ( ) ;
129
98
}
130
99
131
- /// <summary>
132
- /// Serialize <see cref="OpenApiLink"/> to Open Api v2.0
133
- /// </summary>
100
+ /// <inheritdoc/>
134
101
public void SerializeAsV2 ( IOpenApiWriter writer )
135
102
{
136
103
// Link object does not exist in V2.
0 commit comments