Skip to content
This repository was archived by the owner on Nov 11, 2025. It is now read-only.

Commit 8f5c5cb

Browse files
Copilotbaywet
andcommitted
Update IOpenApiResponse to derive from IOpenApiSummarizedElement
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
1 parent 48d714c commit 8f5c5cb

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Microsoft.OpenApi;
66
/// Defines the base properties for the response object.
77
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
88
/// </summary>
9-
public interface IOpenApiResponse : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiResponse>, IOpenApiReferenceable
9+
public interface IOpenApiResponse : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiResponse>, IOpenApiReferenceable, IOpenApiSummarizedElement
1010
{
1111
/// <summary>
1212
/// Maps a header name to its definition.

src/Microsoft.OpenApi/Models/OpenApiResponse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.OpenApi
1010
/// <summary>
1111
/// Response object.
1212
/// </summary>
13-
public class OpenApiResponse : IOpenApiExtensible, IOpenApiResponse, IOpenApiSummarizedElement
13+
public class OpenApiResponse : IOpenApiExtensible, IOpenApiResponse
1414
{
1515
/// <inheritdoc/>
1616
public string? Summary { get; set; }
@@ -41,7 +41,7 @@ public OpenApiResponse() { }
4141
internal OpenApiResponse(IOpenApiResponse response)
4242
{
4343
Utils.CheckArgumentNull(response);
44-
Summary = (response as IOpenApiSummarizedElement)?.Summary ?? Summary;
44+
Summary = response.Summary ?? Summary;
4545
Description = response.Description ?? Description;
4646
Headers = response.Headers != null ? new Dictionary<string, IOpenApiHeader>(response.Headers) : null;
4747
Content = response.Content != null ? new Dictionary<string, OpenApiMediaType>(response.Content) : null;

src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.OpenApi
88
/// <summary>
99
/// Response Object Reference.
1010
/// </summary>
11-
public class OpenApiResponseReference : BaseOpenApiReferenceHolder<OpenApiResponse, IOpenApiResponse, OpenApiReferenceWithDescription>, IOpenApiResponse, IOpenApiSummarizedElement
11+
public class OpenApiResponseReference : BaseOpenApiReferenceHolder<OpenApiResponse, IOpenApiResponse, OpenApiReferenceWithDescription>, IOpenApiResponse
1212
{
1313
/// <summary>
1414
/// Constructor initializing the reference object.
@@ -35,8 +35,8 @@ private OpenApiResponseReference(OpenApiResponseReference openApiResponseReferen
3535
/// <inheritdoc/>
3636
public string? Summary
3737
{
38-
get => (Target as IOpenApiSummarizedElement)?.Summary;
39-
set { if (Target is IOpenApiSummarizedElement summarizedTarget) summarizedTarget.Summary = value; }
38+
get => Target?.Summary;
39+
set { if (Target != null) Target.Summary = value; }
4040
}
4141

4242
/// <inheritdoc/>

0 commit comments

Comments
 (0)