44using System ;
55using System . Collections . Generic ;
66using Microsoft . OpenApi . Interfaces ;
7+ using Microsoft . OpenApi . Models . Interfaces ;
78using Microsoft . OpenApi . Writers ;
89
910namespace Microsoft . OpenApi . Models
1011{
1112 /// <summary>
1213 /// Link Object.
1314 /// </summary>
14- public class OpenApiLink : IOpenApiReferenceable , IOpenApiExtensible
15+ public class OpenApiLink : IOpenApiReferenceable , IOpenApiExtensible , IOpenApiLink
1516 {
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 ; }
2119
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 ; }
2722
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 > ( ) ;
3325
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 ; }
4828
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 ; }
5331
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 ; }
5834
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 > ( ) ;
6337
6438 /// <summary>
6539 /// Parameterless constructor
@@ -69,36 +43,31 @@ public OpenApiLink() { }
6943 /// <summary>
7044 /// Initializes a copy of an <see cref="OpenApiLink"/> object
7145 /// </summary>
72- public OpenApiLink ( OpenApiLink link )
46+ public OpenApiLink ( IOpenApiLink link )
7347 {
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 ;
8356 }
8457
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 )
8960 {
9061 SerializeInternal ( writer , ( writer , element ) => element . SerializeAsV31 ( writer ) ) ;
9162 }
9263
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 )
9766 {
9867 SerializeInternal ( writer , ( writer , element ) => element . SerializeAsV3 ( writer ) ) ;
9968 }
10069
101- internal virtual void SerializeInternal ( IOpenApiWriter writer , Action < IOpenApiWriter , IOpenApiSerializable > callback )
70+ internal void SerializeInternal ( IOpenApiWriter writer , Action < IOpenApiWriter , IOpenApiSerializable > callback )
10271 {
10372 Utils . CheckArgumentNull ( writer ) ;
10473
@@ -128,9 +97,7 @@ internal virtual void SerializeInternal(IOpenApiWriter writer, Action<IOpenApiWr
12897 writer . WriteEndObject ( ) ;
12998 }
13099
131- /// <summary>
132- /// Serialize <see cref="OpenApiLink"/> to Open Api v2.0
133- /// </summary>
100+ /// <inheritdoc/>
134101 public void SerializeAsV2 ( IOpenApiWriter writer )
135102 {
136103 // Link object does not exist in V2.
0 commit comments