Skip to content

Commit 9f67833

Browse files
authored
Merge pull request #156 from microsoft/bugfix/path-items-descriptions
adds descriptions for path items
2 parents fd86423 + 79f73b0 commit 9f67833

30 files changed

+1004
-178
lines changed

src/Microsoft.OpenApi.OData.Reader/PathItem/DollarCountPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@ protected override void SetOperations(OpenApiPathItem item)
2121
{
2222
AddOperation(item, OperationType.Get);
2323
}
24+
/// <inheritdoc/>
25+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
26+
{
27+
base.SetBasicInfo(pathItem);
28+
pathItem.Description = "Provides operations to count the resources in the collection.";
29+
}
2430
}
2531
}

src/Microsoft.OpenApi.OData.Reader/PathItem/EntitySetPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,11 @@ protected override void Initialize(ODataContext context, ODataPath path)
4848
ODataNavigationSourceSegment navigationSourceSegment = path.FirstSegment as ODataNavigationSourceSegment;
4949
EntitySet = navigationSourceSegment.NavigationSource as IEdmEntitySet;
5050
}
51+
/// <inheritdoc/>
52+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
53+
{
54+
base.SetBasicInfo(pathItem);
55+
pathItem.Description = $"Provides operations to manage the collection of {EntitySet.EntityType().Name} entities.";
56+
}
5157
}
5258
}

src/Microsoft.OpenApi.OData.Reader/PathItem/MediaEntityPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,11 @@ protected override void Initialize(ODataContext context, ODataPath path)
6666
Singleton = navigationSourceSegment.NavigationSource as IEdmSingleton;
6767
}
6868
}
69+
/// <inheritdoc/>
70+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
71+
{
72+
base.SetBasicInfo(pathItem);
73+
pathItem.Description = $"Provides operations to manage the media for the {(EntitySet?.EntityType() ?? Singleton?.EntityType()).Name} entity.";
74+
}
6975
}
7076
}

src/Microsoft.OpenApi.OData.Reader/PathItem/MetadataPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@ protected override void SetOperations(OpenApiPathItem item)
2121
{
2222
AddOperation(item, OperationType.Get);
2323
}
24+
/// <inheritdoc/>
25+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
26+
{
27+
base.SetBasicInfo(pathItem);
28+
pathItem.Description = "Provides operations to obtain the service metadata.";
29+
}
2430
}
2531
}

src/Microsoft.OpenApi.OData.Reader/PathItem/NavigationPropertyPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,5 +246,11 @@ protected override void SetExtensions(OpenApiPathItem item)
246246
item.Extensions.Add(Constants.xMsDosGroupPath, array);
247247
}
248248
}
249+
/// <inheritdoc/>
250+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
251+
{
252+
base.SetBasicInfo(pathItem);
253+
pathItem.Description = $"Provides operations to manage the {NavigationProperty.Name} property of the {NavigationProperty.DeclaringType.FullTypeName()} entity.";
254+
}
249255
}
250256
}

src/Microsoft.OpenApi.OData.Reader/PathItem/OperationImportPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,11 @@ protected override void Initialize(ODataContext context, ODataPath path)
5858
ODataOperationImportSegment operationImportSegment = path.FirstSegment as ODataOperationImportSegment;
5959
EdmOperationImport = operationImportSegment.OperationImport;
6060
}
61+
/// <inheritdoc/>
62+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
63+
{
64+
base.SetBasicInfo(pathItem);
65+
pathItem.Description = $"Provides operations to call the {EdmOperationImport.Name} method.";
66+
}
6167
}
6268
}

src/Microsoft.OpenApi.OData.Reader/PathItem/OperationPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,11 @@ protected override void SetExtensions(OpenApiPathItem item)
9494
item.Extensions.Add(Constants.xMsDosGroupPath, array);
9595
}
9696
}
97+
/// <inheritdoc/>
98+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
99+
{
100+
base.SetBasicInfo(pathItem);
101+
pathItem.Description = $"Provides operations to call the {EdmOperation.Name} method.";
102+
}
97103
}
98104
}

src/Microsoft.OpenApi.OData.Reader/PathItem/PathItemHandler.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,22 @@ public virtual OpenApiPathItem CreatePathItem(ODataContext context, ODataPath pa
4141

4242
Initialize(context, path);
4343

44-
OpenApiPathItem item = new OpenApiPathItem();
44+
OpenApiPathItem item = new();
45+
46+
SetBasicInfo(item);
4547

4648
SetOperations(item);
4749

4850
SetExtensions(item);
4951

5052
return item;
5153
}
54+
/// <summary>
55+
/// Set the basic information for <see cref="OpenApiPathItem"/>.
56+
/// </summary>
57+
/// <param name="pathItem">The <see cref="OpenApiPathItem"/>.</param>
58+
protected virtual void SetBasicInfo(OpenApiPathItem pathItem)
59+
{ }
5260

5361
/// <summary>
5462
/// Set the operation for the path item.

src/Microsoft.OpenApi.OData.Reader/PathItem/RefPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,11 @@ protected override void Initialize(ODataContext context, ODataPath path)
137137

138138
NavigationProperty = path.OfType<ODataNavigationPropertySegment>().Last().NavigationProperty;
139139
}
140+
/// <inheritdoc/>
141+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
142+
{
143+
base.SetBasicInfo(pathItem);
144+
pathItem.Description = $"Provides operations to manage the collection of {NavigationSource?.EntityType().Name ?? NavigationProperty?.Type.ShortQualifiedName()} entities.";
145+
}
140146
}
141147
}

src/Microsoft.OpenApi.OData.Reader/PathItem/SingletonPathItemHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,11 @@ protected override void Initialize(ODataContext context, ODataPath path)
4949
ODataNavigationSourceSegment navigationSourceSegment = path.FirstSegment as ODataNavigationSourceSegment;
5050
Singleton = navigationSourceSegment.NavigationSource as IEdmSingleton;
5151
}
52+
/// <inheritdoc/>
53+
protected override void SetBasicInfo(OpenApiPathItem pathItem)
54+
{
55+
base.SetBasicInfo(pathItem);
56+
pathItem.Description = $"Provides operations to manage the {Singleton.EntityType().Name} singleton.";
57+
}
5258
}
5359
}

0 commit comments

Comments
 (0)