This repository was archived by the owner on Nov 11, 2025. It is now read-only.
forked from microsoft/OpenAPI.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenApiResponseReference.cs
More file actions
78 lines (67 loc) · 2.98 KB
/
OpenApiResponseReference.cs
File metadata and controls
78 lines (67 loc) · 2.98 KB
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System.Collections.Generic;
namespace Microsoft.OpenApi
{
/// <summary>
/// Response Object Reference.
/// </summary>
public class OpenApiResponseReference : BaseOpenApiReferenceHolder<OpenApiResponse, IOpenApiResponse, OpenApiReferenceWithDescriptionAndSummary>, IOpenApiResponse
{
/// <summary>
/// Constructor initializing the reference object.
/// </summary>
/// <param name="referenceId">The reference Id.</param>
/// <param name="hostDocument">The host OpenAPI document.</param>
/// <param name="externalResource">Optional: External resource in the reference.
/// It may be:
/// 1. a absolute/relative file path, for example: ../commons/pet.json
/// 2. a Url, for example: http://localhost/pet.json
/// </param>
public OpenApiResponseReference(string referenceId, OpenApiDocument? hostDocument = null, string? externalResource = null) : base(referenceId, hostDocument, ReferenceType.Response, externalResource)
{
}
/// <summary>
/// Copy constructor
/// </summary>
/// <param name="openApiResponseReference">The reference to copy</param>
private OpenApiResponseReference(OpenApiResponseReference openApiResponseReference) : base(openApiResponseReference)
{
}
/// <inheritdoc/>
public string? Summary
{
get => string.IsNullOrEmpty(Reference.Summary) ? Target?.Summary : Reference.Summary;
set => Reference.Summary = value;
}
/// <inheritdoc/>
public string? Description
{
get => string.IsNullOrEmpty(Reference.Description) ? Target?.Description : Reference.Description;
set => Reference.Description = value;
}
/// <inheritdoc/>
public IDictionary<string, OpenApiMediaType>? Content { get => Target?.Content; }
/// <inheritdoc/>
public IDictionary<string, IOpenApiHeader>? Headers { get => Target?.Headers; }
/// <inheritdoc/>
public IDictionary<string, IOpenApiLink>? Links { get => Target?.Links; }
/// <inheritdoc/>
public IDictionary<string, IOpenApiExtension>? Extensions { get => Target?.Extensions; }
/// <inheritdoc/>
public override IOpenApiResponse CopyReferenceAsTargetElementWithOverrides(IOpenApiResponse source)
{
return source is OpenApiResponse ? new OpenApiResponse(this) : source;
}
/// <inheritdoc/>
public IOpenApiResponse CreateShallowCopy()
{
return new OpenApiResponseReference(this);
}
/// <inheritdoc/>
protected override OpenApiReferenceWithDescriptionAndSummary CopyReference(OpenApiReferenceWithDescriptionAndSummary sourceReference)
{
return new OpenApiReferenceWithDescriptionAndSummary(sourceReference);
}
}
}