Skip to content

Commit 487194f

Browse files
committed
Add summary field to info object
1 parent d23ad22 commit 487194f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/Microsoft.OpenApi.Readers/V3/OpenApiInfoDeserializer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ internal static partial class OpenApiV3Deserializer
2929
o.Version = n.GetScalarValue();
3030
}
3131
},
32+
{
33+
"summary", (o, n) =>
34+
{
35+
o.Summary = n.GetScalarValue();
36+
}
37+
},
3238
{
3339
"description", (o, n) =>
3440
{

src/Microsoft.OpenApi/Models/OpenApiInfo.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using Microsoft.OpenApi.Any;
76
using Microsoft.OpenApi.Interfaces;
87
using Microsoft.OpenApi.Writers;
98

@@ -19,11 +18,16 @@ public class OpenApiInfo : IOpenApiSerializable, IOpenApiExtensible
1918
/// </summary>
2019
public string Title { get; set; }
2120

21+
/// <summary>
22+
/// A short summary of the API.
23+
/// </summary>
24+
public string Summary { get; set; }
25+
2226
/// <summary>
2327
/// A short description of the application.
2428
/// </summary>
2529
public string Description { get; set; }
26-
30+
2731
/// <summary>
2832
/// REQUIRED. The version of the OpenAPI document.
2933
/// </summary>
@@ -60,6 +64,7 @@ public OpenApiInfo() {}
6064
public OpenApiInfo(OpenApiInfo info)
6165
{
6266
Title = info?.Title ?? Title;
67+
Summary = info?.Summary ?? Summary;
6368
Description = info?.Description ?? Description;
6469
Version = info?.Version ?? Version;
6570
TermsOfService = info?.TermsOfService ?? TermsOfService;
@@ -83,6 +88,9 @@ public void SerializeAsV3(IOpenApiWriter writer)
8388
// title
8489
writer.WriteProperty(OpenApiConstants.Title, Title);
8590

91+
// summary
92+
writer.WriteProperty(OpenApiConstants.Summary, Summary);
93+
8694
// description
8795
writer.WriteProperty(OpenApiConstants.Description, Description);
8896

0 commit comments

Comments
 (0)