Skip to content

Commit 076c3e9

Browse files
authored
Merge pull request #2 from irvinesunday/is/summaries
Update CRUD operations summaries and descriptions
2 parents 0f40d7b + bea9474 commit 076c3e9

16 files changed

+53
-58
lines changed

src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyGetOperationHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4545

4646
// Summary and Description
4747
string placeHolder = $"Get {ComplexPropertySegment.Property.Name} property value";
48-
operation.Summary = ReadRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(ComplexPropertySegment.Property) ?? placeHolder;
49-
operation.Description = ReadRestrictions?.LongDescription ?? Context.Model.GetLongDescriptionAnnotation(ComplexPropertySegment.Property) ?? placeHolder;
48+
operation.Summary = ReadRestrictions?.Description ?? placeHolder;
49+
operation.Description = ReadRestrictions?.LongDescription ?? Context.Model.GetDescriptionAnnotation(ComplexPropertySegment.Property) ?? placeHolder;
5050

5151
base.SetBasicInfo(operation);
5252
}

src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyPostOperationHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4848

4949
// Summary and Description
5050
string placeHolder = $"Sets a new value for the collection of {ComplexPropertySegment.ComplexType.Name}.";
51-
operation.Summary = placeHolder;
52-
operation.Description = InsertRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(ComplexPropertySegment.Property);
51+
operation.Summary = InsertRestrictions?.Description ?? placeHolder;
52+
operation.Description = InsertRestrictions?.LongDescription;
5353

5454
base.SetBasicInfo(operation);
5555
}

src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyUpdateOperationHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ protected override void SetBasicInfo(OpenApiOperation operation)
3333
{
3434
// Summary and Description
3535
string placeHolder = $"Update property {ComplexPropertySegment.Property.Name} value.";
36-
operation.Summary = UpdateRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(ComplexPropertySegment.Property) ?? placeHolder;
37-
operation.Description = UpdateRestrictions?.LongDescription ?? Context.Model.GetLongDescriptionAnnotation(ComplexPropertySegment.Property) ?? placeHolder;
36+
operation.Summary = UpdateRestrictions?.Description ?? placeHolder;
37+
operation.Description = UpdateRestrictions?.LongDescription ?? Context.Model.GetLongDescriptionAnnotation(ComplexPropertySegment.Property);
3838

3939
// OperationId
4040
if (Context.Settings.EnableOperationId)

src/Microsoft.OpenApi.OData.Reader/Operation/EntityDeleteOperationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4343
// Description
4444
string placeHolder = "Delete entity from " + EntitySet.Name;
4545
operation.Summary = DeleteRestrictions?.Description ?? placeHolder;
46-
operation.Description = DeleteRestrictions?.LongDescription ?? placeHolder;
46+
operation.Description = DeleteRestrictions?.LongDescription;
4747

4848
// OperationId
4949
if (Context.Settings.EnableOperationId)

src/Microsoft.OpenApi.OData.Reader/Operation/EntityGetOperationHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4343

4444
// Description
4545
string placeHolder = "Get entity from " + EntitySet.Name + " by key";
46-
operation.Summary = ReadRestrictions?.ReadByKeyRestrictions?.Description ?? Context.Model.GetLongDescriptionAnnotation(entityType) ?? placeHolder;
47-
operation.Description = ReadRestrictions?.ReadByKeyRestrictions?.LongDescription ?? Context.Model.GetLongDescriptionAnnotation(entityType) ?? placeHolder;
46+
operation.Summary = ReadRestrictions?.ReadByKeyRestrictions?.Description ?? placeHolder;
47+
operation.Description = ReadRestrictions?.ReadByKeyRestrictions?.LongDescription ?? Context.Model.GetDescriptionAnnotation(entityType) ?? placeHolder;
4848

4949
// OperationId
5050
if (Context.Settings.EnableOperationId)

src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetGetOperationHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4242
{
4343
// Summary and Descriptions
4444
string placeHolder = "Get entities from " + EntitySet.Name;
45-
operation.Summary = ReadRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(EntitySet) ?? placeHolder;
46-
operation.Description = ReadRestrictions?.LongDescription ?? Context.Model.GetLongDescriptionAnnotation(EntitySet) ?? placeHolder;
45+
operation.Summary = ReadRestrictions?.Description ?? placeHolder;
46+
operation.Description = ReadRestrictions?.LongDescription ?? Context.Model.GetDescriptionAnnotation(EntitySet);
4747

4848
// OperationId
4949
if (Context.Settings.EnableOperationId)

src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetPostOperationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4242
// Summary and Description
4343
string placeHolder = "Add new entity to " + EntitySet.Name;
4444
operation.Summary = InsertRestrictions?.Description ?? placeHolder;
45-
operation.Description = InsertRestrictions?.LongDescription ?? placeHolder;
45+
operation.Description = InsertRestrictions?.LongDescription;
4646

4747
// OperationId
4848
if (Context.Settings.EnableOperationId)

src/Microsoft.OpenApi.OData.Reader/Operation/EntityUpdateOperationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
3939
// Description
4040
string placeHolder = "Update entity in " + EntitySet.Name;
4141
operation.Summary = UpdateRestrictions?.Description ?? placeHolder;
42-
operation.Description = UpdateRestrictions?.LongDescription ?? placeHolder;
42+
operation.Description = UpdateRestrictions?.LongDescription;
4343

4444
// OperationId
4545
if (Context.Settings.EnableOperationId)

src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyDeleteOperationHandler.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,17 @@ internal class NavigationPropertyDeleteOperationHandler : NavigationPropertyOper
2424
/// <inheritdoc/>
2525
protected override void SetBasicInfo(OpenApiOperation operation)
2626
{
27-
// Summary
28-
operation.Summary = "Delete navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name;
27+
// Summary and Description
28+
string placeHolder = "Delete navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name;
29+
operation.Summary = Restriction?.DeleteRestrictions?.Description ?? placeHolder;
30+
operation.Description = Restriction?.DeleteRestrictions?.LongDescription;
2931

3032
// OperationId
3133
if (Context.Settings.EnableOperationId)
3234
{
3335
string prefix = "Delete";
3436
operation.OperationId = GetOperationId(prefix);
35-
}
36-
37-
// Description
38-
operation.Description = Restriction?.DeleteRestrictions?.Description;
37+
}
3938

4039
base.SetBasicInfo(operation);
4140
}

src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyGetOperationHandler.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ internal class NavigationPropertyGetOperationHandler : NavigationPropertyOperati
2727
/// <inheritdoc/>
2828
protected override void SetBasicInfo(OpenApiOperation operation)
2929
{
30-
// Summary
31-
operation.Summary = "Get " + NavigationProperty.Name + " from " + NavigationSource.Name;
30+
// Summary and Description
31+
ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions;
32+
string placeHolder = "Get " + NavigationProperty.Name + " from " + NavigationSource.Name;
33+
operation.Summary = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description) ?? placeHolder;
34+
operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.LongDescription : readRestriction?.LongDescription)
35+
?? Context.Model.GetDescriptionAnnotation(NavigationProperty);
3236

3337
// OperationId
3438
if (Context.Settings.EnableOperationId)
@@ -41,12 +45,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
4145

4246
operation.OperationId = GetOperationId(prefix);
4347
}
44-
45-
// Description
46-
ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions;
47-
operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description)
48-
?? Context.Model.GetDescriptionAnnotation(NavigationProperty);
49-
48+
5049
base.SetBasicInfo(operation);
5150
}
5251

src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyPostOperationHandler.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ internal class NavigationPropertyPostOperationHandler : NavigationPropertyOperat
2525
/// <inheritdoc/>
2626
protected override void SetBasicInfo(OpenApiOperation operation)
2727
{
28-
// Summary
29-
operation.Summary = "Create new navigation property to " + NavigationProperty.Name + " for " + NavigationSource.Name;
28+
// Summary and Description
29+
string placeHolder = "Create new navigation property to " + NavigationProperty.Name + " for " + NavigationSource.Name;
30+
operation.Summary = Restriction?.InsertRestrictions?.Description ?? placeHolder;
31+
operation.Description = Restriction?.InsertRestrictions?.LongDescription;
3032

3133
// OperationId
3234
if (Context.Settings.EnableOperationId)
@@ -35,9 +37,6 @@ protected override void SetBasicInfo(OpenApiOperation operation)
3537
operation.OperationId = GetOperationId(prefix);
3638
}
3739

38-
// Description
39-
operation.Description = Restriction?.InsertRestrictions?.Description;
40-
4140
base.SetBasicInfo(operation);
4241
}
4342

src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyUpdateOperationHandler.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ internal abstract class NavigationPropertyUpdateOperationHandler : NavigationPro
2222
/// <inheritdoc/>
2323
protected override void SetBasicInfo(OpenApiOperation operation)
2424
{
25-
// Summary
26-
operation.Summary = "Update the navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name;
25+
// Summary and Description
26+
string placeHolder = "Update the navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name;
27+
operation.Summary = Restriction?.UpdateRestrictions?.Description ?? placeHolder;
28+
operation.Description = Restriction?.UpdateRestrictions?.LongDescription;
2729

2830
// OperationId
2931
if (Context.Settings.EnableOperationId)
@@ -32,9 +34,6 @@ protected override void SetBasicInfo(OpenApiOperation operation)
3234
operation.OperationId = GetOperationId(prefix);
3335
}
3436

35-
// Description
36-
operation.Description = Restriction?.UpdateRestrictions?.Description;
37-
3837
base.SetBasicInfo(operation);
3938
}
4039

src/Microsoft.OpenApi.OData.Reader/Operation/RefDeleteOperationHandler.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@ internal class RefDeleteOperationHandler : NavigationPropertyOperationHandler
2222
/// <inheritdoc/>
2323
protected override void SetBasicInfo(OpenApiOperation operation)
2424
{
25-
// Summary
26-
operation.Summary = "Delete ref of navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name;
25+
// Summary and Description
26+
string placeHolder = "Delete ref of navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name;
27+
operation.Summary = Restriction?.DeleteRestrictions?.Description ?? placeHolder;
28+
operation.Description = Restriction?.DeleteRestrictions?.LongDescription;
2729

2830
// OperationId
2931
if (Context.Settings.EnableOperationId)
3032
{
3133
string prefix = "DeleteRef";
3234
operation.OperationId = GetOperationId(prefix);
33-
}
34-
35-
// Description
36-
operation.Description = Restriction?.DeleteRestrictions?.Description;
35+
}
3736
}
3837

3938
/// <inheritdoc/>

src/Microsoft.OpenApi.OData.Reader/Operation/RefGetOperationHandler.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ internal class RefGetOperationHandler : NavigationPropertyOperationHandler
2525
/// <inheritdoc/>
2626
protected override void SetBasicInfo(OpenApiOperation operation)
2727
{
28-
// Summary
29-
operation.Summary = "Get ref of " + NavigationProperty.Name + " from " + NavigationSource.Name;
28+
// Summary and Description
29+
ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions;
30+
string placeHolder = "Get ref of " + NavigationProperty.Name + " from " + NavigationSource.Name;
31+
operation.Summary = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description) ?? placeHolder;
32+
operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.LongDescription : readRestriction?.LongDescription)
33+
?? Context.Model.GetDescriptionAnnotation(NavigationProperty);
3034

3135
// OperationId
3236
if (Context.Settings.EnableOperationId)
@@ -39,11 +43,6 @@ protected override void SetBasicInfo(OpenApiOperation operation)
3943

4044
operation.OperationId = GetOperationId(prefix);
4145
}
42-
43-
// Description
44-
ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions;
45-
operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description)
46-
?? Context.Model.GetDescriptionAnnotation(NavigationProperty);
4746
}
4847

4948
protected override void SetExtensions(OpenApiOperation operation)

src/Microsoft.OpenApi.OData.Reader/Operation/RefPostOperationHandler.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ internal class RefPostOperationHandler : NavigationPropertyOperationHandler
2222
/// <inheritdoc/>
2323
protected override void SetBasicInfo(OpenApiOperation operation)
2424
{
25-
// Summary
26-
operation.Summary = "Create new navigation property ref to " + NavigationProperty.Name + " for " + NavigationSource.Name;
25+
// Summary and Description
26+
string placeHolder = "Create new navigation property ref to " + NavigationProperty.Name + " for " + NavigationSource.Name;
27+
operation.Summary = Restriction?.InsertRestrictions?.Description ?? placeHolder;
28+
operation.Description = Restriction?.InsertRestrictions?.LongDescription;
2729

2830
// OperationId
2931
if (Context.Settings.EnableOperationId)
@@ -32,8 +34,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
3234
operation.OperationId = GetOperationId(prefix);
3335
}
3436

35-
// Description
36-
operation.Description = Restriction?.InsertRestrictions?.Description;
37+
3738
}
3839

3940
/// <inheritdoc/>

src/Microsoft.OpenApi.OData.Reader/Operation/RefPutOperationHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ internal class RefPutOperationHandler : NavigationPropertyOperationHandler
2222
/// <inheritdoc/>
2323
protected override void SetBasicInfo(OpenApiOperation operation)
2424
{
25-
// Summary
26-
operation.Summary = "Update the ref of navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name;
25+
// Summary and Description
26+
string placeHolder = "Update the ref of navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name;
27+
operation.Summary = Restriction?.UpdateRestrictions?.Description ?? placeHolder;
28+
operation.Description = Restriction?.UpdateRestrictions?.LongDescription;
2729

2830
// OperationId
2931
if (Context.Settings.EnableOperationId)
3032
{
3133
string prefix = "UpdateRef";
3234
operation.OperationId = GetOperationId(prefix);
3335
}
34-
35-
operation.Description = Restriction?.UpdateRestrictions?.Description;
3636
}
3737

3838
/// <inheritdoc/>

0 commit comments

Comments
 (0)