diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyGetOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyGetOperationHandler.cs index c152705a..1195ffa0 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyGetOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyGetOperationHandler.cs @@ -35,9 +35,6 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = $"Get {ComplexPropertySegment.Property.Name} property value"; - // OperationId if (Context.Settings.EnableOperationId) { @@ -46,8 +43,10 @@ protected override void SetBasicInfo(OpenApiOperation operation) operation.OperationId = ComplexPropertySegment.Property.Name + "." + typeName + listOrGet + Utils.UpperFirstChar(typeName); } - // Description - operation.Description = ReadRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(ComplexPropertySegment.Property); + // Summary and Description + string placeHolder = $"Get {ComplexPropertySegment.Property.Name} property value"; + operation.Summary = ReadRestrictions?.Description ?? placeHolder; + operation.Description = ReadRestrictions?.LongDescription ?? Context.Model.GetDescriptionAnnotation(ComplexPropertySegment.Property); base.SetBasicInfo(operation); } diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyPostOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyPostOperationHandler.cs index 6df41872..680613a3 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyPostOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyPostOperationHandler.cs @@ -21,7 +21,7 @@ internal class ComplexPropertyPostOperationHandler : ComplexPropertyBaseOperatio protected override void Initialize(ODataContext context, ODataPath path) { base.Initialize(context, path); - if(!ComplexPropertySegment.Property.Type.IsCollection()) + if (!ComplexPropertySegment.Property.Type.IsCollection()) { throw new InvalidOperationException("OData conventions do not support POSTing to a complex property that is not a collection."); } @@ -39,9 +39,6 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = $"Sets a new value for the collection of {ComplexPropertySegment.ComplexType.Name}."; - // OperationId if (Context.Settings.EnableOperationId) { @@ -49,8 +46,10 @@ protected override void SetBasicInfo(OpenApiOperation operation) operation.OperationId = ComplexPropertySegment.Property.Name + "." + typeName + ".Set" + Utils.UpperFirstChar(typeName); } - // Description - operation.Description = InsertRestrictions?.Description; + // Summary and Description + string placeHolder = $"Sets a new value for the collection of {ComplexPropertySegment.ComplexType.Name}."; + operation.Summary = InsertRestrictions?.Description ?? placeHolder; + operation.Description = InsertRestrictions?.LongDescription; base.SetBasicInfo(operation); } diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyUpdateOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyUpdateOperationHandler.cs index b726257a..f24d5eb4 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyUpdateOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/ComplexPropertyUpdateOperationHandler.cs @@ -31,11 +31,10 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = $"Update property {ComplexPropertySegment.Property.Name} value."; - - // Description - operation.Description = UpdateRestrictions?.Description; + // Summary and Description + string placeHolder = $"Update property {ComplexPropertySegment.Property.Name} value."; + operation.Summary = UpdateRestrictions?.Description ?? placeHolder; + operation.Description = UpdateRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/EntityDeleteOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/EntityDeleteOperationHandler.cs index 37a444dc..107fa0b7 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/EntityDeleteOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/EntityDeleteOperationHandler.cs @@ -38,13 +38,12 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Delete entity from " + EntitySet.Name; - IEdmEntityType entityType = EntitySet.EntityType(); // Description - operation.Description = DeleteRestrictions?.Description; + string placeHolder = "Delete entity from " + EntitySet.Name; + operation.Summary = DeleteRestrictions?.Description ?? placeHolder; + operation.Description = DeleteRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/EntityGetOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/EntityGetOperationHandler.cs index 4a5889d5..d0f493ed 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/EntityGetOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/EntityGetOperationHandler.cs @@ -39,13 +39,12 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Get entity from " + EntitySet.Name + " by key"; - IEdmEntityType entityType = EntitySet.EntityType(); // Description - operation.Description = ReadRestrictions?.ReadByKeyRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(entityType); + string placeHolder = "Get entity from " + EntitySet.Name + " by key"; + operation.Summary = ReadRestrictions?.ReadByKeyRestrictions?.Description ?? placeHolder; + operation.Description = ReadRestrictions?.ReadByKeyRestrictions?.LongDescription ?? Context.Model.GetDescriptionAnnotation(entityType); // OperationId if (Context.Settings.EnableOperationId) @@ -132,7 +131,7 @@ protected override void SetResponses(OpenApiOperation operation) } protected override void SetSecurity(OpenApiOperation operation) - { + { if (ReadRestrictions == null) { return; diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetGetOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetGetOperationHandler.cs index ab54ea89..c3559626 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetGetOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetGetOperationHandler.cs @@ -40,8 +40,10 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Get entities from " + EntitySet.Name; + // Summary and Descriptions + string placeHolder = "Get entities from " + EntitySet.Name; + operation.Summary = ReadRestrictions?.Description ?? placeHolder; + operation.Description = ReadRestrictions?.LongDescription ?? Context.Model.GetDescriptionAnnotation(EntitySet); // OperationId if (Context.Settings.EnableOperationId) @@ -49,9 +51,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) string typeName = EntitySet.EntityType().Name; operation.OperationId = EntitySet.Name + "." + typeName + ".List" + Utils.UpperFirstChar(typeName); } - - // Description - operation.Description = ReadRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(EntitySet); } protected override void SetExtensions(OpenApiOperation operation) diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetPostOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetPostOperationHandler.cs index cfb2ace8..7d8fa787 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetPostOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/EntitySetPostOperationHandler.cs @@ -39,8 +39,10 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Add new entity to " + EntitySet.Name; + // Summary and Description + string placeHolder = "Add new entity to " + EntitySet.Name; + operation.Summary = InsertRestrictions?.Description ?? placeHolder; + operation.Description = InsertRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) @@ -48,9 +50,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) string typeName = EntitySet.EntityType().Name; operation.OperationId = EntitySet.Name + "." + typeName + ".Create" + Utils.UpperFirstChar(typeName); } - - // Description - operation.Description = InsertRestrictions?.Description; } /// diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/EntityUpdateOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/EntityUpdateOperationHandler.cs index 70749507..f8ce6212 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/EntityUpdateOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/EntityUpdateOperationHandler.cs @@ -34,13 +34,12 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Update entity in " + EntitySet.Name; - IEdmEntityType entityType = EntitySet.EntityType(); - // Description - operation.Description = UpdateRestrictions?.Description; + // Summary and Description + string placeHolder = "Update entity in " + EntitySet.Name; + operation.Summary = UpdateRestrictions?.Description ?? placeHolder; + operation.Description = UpdateRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyDeleteOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyDeleteOperationHandler.cs index 01238038..938a15a4 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyDeleteOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyDeleteOperationHandler.cs @@ -24,18 +24,17 @@ internal class NavigationPropertyDeleteOperationHandler : NavigationPropertyOper /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Delete navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name; + // Summary and Description + string placeHolder = "Delete navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name; + operation.Summary = Restriction?.DeleteRestrictions?.Description ?? placeHolder; + operation.Description = Restriction?.DeleteRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) { string prefix = "Delete"; operation.OperationId = GetOperationId(prefix); - } - - // Description - operation.Description = Restriction?.DeleteRestrictions?.Description; + } base.SetBasicInfo(operation); } diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyGetOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyGetOperationHandler.cs index c1981db2..184e64c3 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyGetOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyGetOperationHandler.cs @@ -27,8 +27,12 @@ internal class NavigationPropertyGetOperationHandler : NavigationPropertyOperati /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Get " + NavigationProperty.Name + " from " + NavigationSource.Name; + // Summary and Description + ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions; + string placeHolder = "Get " + NavigationProperty.Name + " from " + NavigationSource.Name; + operation.Summary = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description) ?? placeHolder; + operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.LongDescription : readRestriction?.LongDescription) + ?? Context.Model.GetDescriptionAnnotation(NavigationProperty); // OperationId if (Context.Settings.EnableOperationId) @@ -41,12 +45,7 @@ protected override void SetBasicInfo(OpenApiOperation operation) operation.OperationId = GetOperationId(prefix); } - - // Description - ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions; - operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description) - ?? Context.Model.GetDescriptionAnnotation(NavigationProperty); - + base.SetBasicInfo(operation); } diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyPostOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyPostOperationHandler.cs index 3535138c..c7a05bb2 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyPostOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyPostOperationHandler.cs @@ -25,8 +25,10 @@ internal class NavigationPropertyPostOperationHandler : NavigationPropertyOperat /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Create new navigation property to " + NavigationProperty.Name + " for " + NavigationSource.Name; + // Summary and Description + string placeHolder = "Create new navigation property to " + NavigationProperty.Name + " for " + NavigationSource.Name; + operation.Summary = Restriction?.InsertRestrictions?.Description ?? placeHolder; + operation.Description = Restriction?.InsertRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) @@ -35,9 +37,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) operation.OperationId = GetOperationId(prefix); } - // Description - operation.Description = Restriction?.InsertRestrictions?.Description; - base.SetBasicInfo(operation); } diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyUpdateOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyUpdateOperationHandler.cs index 7c4e7454..1796ef26 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyUpdateOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyUpdateOperationHandler.cs @@ -22,8 +22,10 @@ internal abstract class NavigationPropertyUpdateOperationHandler : NavigationPro /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Update the navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name; + // Summary and Description + string placeHolder = "Update the navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name; + operation.Summary = Restriction?.UpdateRestrictions?.Description ?? placeHolder; + operation.Description = Restriction?.UpdateRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) @@ -32,9 +34,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) operation.OperationId = GetOperationId(prefix); } - // Description - operation.Description = Restriction?.UpdateRestrictions?.Description; - base.SetBasicInfo(operation); } diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/RefDeleteOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/RefDeleteOperationHandler.cs index 97c0e250..d21740c4 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/RefDeleteOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/RefDeleteOperationHandler.cs @@ -22,18 +22,17 @@ internal class RefDeleteOperationHandler : NavigationPropertyOperationHandler /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Delete ref of navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name; + // Summary and Description + string placeHolder = "Delete ref of navigation property " + NavigationProperty.Name + " for " + NavigationSource.Name; + operation.Summary = Restriction?.DeleteRestrictions?.Description ?? placeHolder; + operation.Description = Restriction?.DeleteRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) { string prefix = "DeleteRef"; operation.OperationId = GetOperationId(prefix); - } - - // Description - operation.Description = Restriction?.DeleteRestrictions?.Description; + } } /// diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/RefGetOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/RefGetOperationHandler.cs index 7faa24cb..b9b19a5a 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/RefGetOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/RefGetOperationHandler.cs @@ -25,8 +25,12 @@ internal class RefGetOperationHandler : NavigationPropertyOperationHandler /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Get ref of " + NavigationProperty.Name + " from " + NavigationSource.Name; + // Summary and Description + ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions; + string placeHolder = "Get ref of " + NavigationProperty.Name + " from " + NavigationSource.Name; + operation.Summary = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description) ?? placeHolder; + operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.LongDescription : readRestriction?.LongDescription) + ?? Context.Model.GetDescriptionAnnotation(NavigationProperty); // OperationId if (Context.Settings.EnableOperationId) @@ -39,11 +43,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) operation.OperationId = GetOperationId(prefix); } - - // Description - ReadRestrictionsType readRestriction = Restriction?.ReadRestrictions; - operation.Description = (LastSegmentIsKeySegment ? readRestriction?.ReadByKeyRestrictions?.Description : readRestriction?.Description) - ?? Context.Model.GetDescriptionAnnotation(NavigationProperty); } protected override void SetExtensions(OpenApiOperation operation) diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/RefPostOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/RefPostOperationHandler.cs index d5759037..d706a185 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/RefPostOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/RefPostOperationHandler.cs @@ -22,8 +22,10 @@ internal class RefPostOperationHandler : NavigationPropertyOperationHandler /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Create new navigation property ref to " + NavigationProperty.Name + " for " + NavigationSource.Name; + // Summary and Description + string placeHolder = "Create new navigation property ref to " + NavigationProperty.Name + " for " + NavigationSource.Name; + operation.Summary = Restriction?.InsertRestrictions?.Description ?? placeHolder; + operation.Description = Restriction?.InsertRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) @@ -32,8 +34,7 @@ protected override void SetBasicInfo(OpenApiOperation operation) operation.OperationId = GetOperationId(prefix); } - // Description - operation.Description = Restriction?.InsertRestrictions?.Description; + } /// diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/RefPutOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/RefPutOperationHandler.cs index f221bc54..f37e825f 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/RefPutOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/RefPutOperationHandler.cs @@ -22,8 +22,10 @@ internal class RefPutOperationHandler : NavigationPropertyOperationHandler /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary - operation.Summary = "Update the ref of navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name; + // Summary and Description + string placeHolder = "Update the ref of navigation property " + NavigationProperty.Name + " in " + NavigationSource.Name; + operation.Summary = Restriction?.UpdateRestrictions?.Description ?? placeHolder; + operation.Description = Restriction?.UpdateRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) @@ -31,8 +33,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) string prefix = "UpdateRef"; operation.OperationId = GetOperationId(prefix); } - - operation.Description = Restriction?.UpdateRestrictions?.Description; } /// diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonGetOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonGetOperationHandler.cs index 46834bae..647da6e5 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonGetOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonGetOperationHandler.cs @@ -39,8 +39,10 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary, this summary maybe update in the base function call. - operation.Summary = "Get " + Singleton.Name; + // Summary and Descriptions + string placeHolder = "Get " + Singleton.Name; + operation.Summary = ReadRestrictions?.Description ?? placeHolder; + operation.Description = ReadRestrictions?.LongDescription ?? Context.Model.GetDescriptionAnnotation(Singleton); // OperationId, it should be unique among all operations described in the API. if (Context.Settings.EnableOperationId) @@ -48,9 +50,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) string typeName = Singleton.EntityType().Name; operation.OperationId = Singleton.Name + "." + typeName + ".Get" + Utils.UpperFirstChar(typeName); } - - // Description - operation.Description = ReadRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(Singleton); } /// diff --git a/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonPatchOperationHandler.cs b/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonPatchOperationHandler.cs index fff63c17..3814f1f0 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonPatchOperationHandler.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Operation/SingletonPatchOperationHandler.cs @@ -39,8 +39,10 @@ protected override void Initialize(ODataContext context, ODataPath path) /// protected override void SetBasicInfo(OpenApiOperation operation) { - // Summary, this summary maybe update in the base function call. - operation.Summary = "Update " + Singleton.Name; + // Summary and Descriptions + string placeHolder = "Update " + Singleton.Name; + operation.Summary = UpdateRestrictions?.Description ?? placeHolder; + operation.Description = UpdateRestrictions?.LongDescription; // OperationId if (Context.Settings.EnableOperationId) @@ -48,9 +50,6 @@ protected override void SetBasicInfo(OpenApiOperation operation) string typeName = Singleton.EntityType().Name; operation.OperationId = Singleton.Name + "." + typeName + ".Update" + Utils.UpperFirstChar(typeName); } - - // Description - operation.Description = UpdateRestrictions?.Description ?? Context.Model.GetDescriptionAnnotation(Singleton); } /// @@ -97,7 +96,7 @@ protected override void SetRequestBody(OpenApiOperation operation) /// protected override void SetResponses(OpenApiOperation operation) { - operation.AddErrorResponses(Context.Settings, true); + operation.AddErrorResponses(Context.Settings, true); base.SetResponses(operation); } diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyGetOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyGetOperationHandlerTests.cs index 74e9deb4..88cdd928 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyGetOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyGetOperationHandlerTests.cs @@ -36,8 +36,8 @@ public void CreateComplexPropertyGetOperationReturnsCorrectOperationForSingle(bo // Assert Assert.NotNull(get); - Assert.Equal("Get BillingAddress property value", get.Summary); - Assert.Equal("Get the BillingAddress.", get.Description); + Assert.Equal("Get the BillingAddress.", get.Summary); + Assert.Equal("Get the BillingAddress value.", get.Description); Assert.NotNull(get.Parameters); Assert.Equal(3, get.Parameters.Count); //id, select, expand diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPatchOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPatchOperationHandlerTests.cs index 61b4a36a..c378bd8d 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPatchOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPatchOperationHandlerTests.cs @@ -36,8 +36,8 @@ public void CreateComplexPropertyDeleteOperationReturnsCorrectOperationForSingle // Assert Assert.NotNull(patch); - Assert.Equal("Update property BillingAddress value.", patch.Summary); - Assert.Equal("Update the BillingAddress.", patch.Description); + Assert.Equal("Update the BillingAddress.", patch.Summary); + Assert.Equal("Update the BillingAddress value.", patch.Description); Assert.NotNull(patch.Parameters); Assert.Equal(1, patch.Parameters.Count); //id @@ -64,7 +64,7 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti var model = EntitySetGetOperationHandlerTests.GetEdmModel(""); var entitySet = model.EntityContainer.FindEntitySet("Customers"); var entity = entitySet.EntityType(); - var property = entity.FindProperty("AlternativeAddresses"); + var property = entity.FindProperty("BillingAddress"); var settings = new OpenApiConvertSettings { EnableOperationId = enableOperationId @@ -77,8 +77,8 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti // Assert Assert.NotNull(patch); - Assert.Equal("Update property AlternativeAddresses value.", patch.Summary); - Assert.Null(patch.Description); + Assert.Equal("Update the BillingAddress.", patch.Summary); + Assert.Equal("Update the BillingAddress value.", patch.Description); Assert.NotNull(patch.Parameters); Assert.Equal(1, patch.Parameters.Count); //id @@ -89,7 +89,7 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti if (enableOperationId) { - Assert.Equal("AlternativeAddresses.Address.UpdateAddress", patch.OperationId); + Assert.Equal("BillingAddress.Address.UpdateAddress", patch.OperationId); } else { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPostOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPostOperationHandlerTests.cs index 87042a32..77e0e5cf 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPostOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPostOperationHandlerTests.cs @@ -51,7 +51,7 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti // Assert Assert.NotNull(post); - Assert.Equal("Sets a new value for the collection of Address.", post.Summary); + Assert.Equal("Create AlternativeAddress.", post.Summary); Assert.Equal("Create a new AlternativeAddress.", post.Description); Assert.NotNull(post.Parameters); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPutOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPutOperationHandlerTests.cs index 05232962..ea168026 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPutOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPutOperationHandlerTests.cs @@ -36,7 +36,8 @@ public void CreateComplexPropertyDeleteOperationReturnsCorrectOperationForSingle // Assert Assert.NotNull(put); - Assert.Equal("Update property BillingAddress value.", put.Summary); + Assert.Equal("Update the BillingAddress.", put.Summary); + Assert.Equal("Update the BillingAddress value.", put.Description); Assert.NotNull(put.Parameters); Assert.Equal(1, put.Parameters.Count); //id @@ -63,7 +64,7 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti var model = EntitySetGetOperationHandlerTests.GetEdmModel(""); var entitySet = model.EntityContainer.FindEntitySet("Customers"); var entity = entitySet.EntityType(); - var property = entity.FindProperty("AlternativeAddresses"); + var property = entity.FindProperty("BillingAddress"); var settings = new OpenApiConvertSettings { EnableOperationId = enableOperationId @@ -76,7 +77,8 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti // Assert Assert.NotNull(put); - Assert.Equal("Update property AlternativeAddresses value.", put.Summary); + Assert.Equal("Update the BillingAddress.", put.Summary); + Assert.Equal("Update the BillingAddress value.", put.Description); Assert.NotNull(put.Parameters); Assert.Equal(1, put.Parameters.Count); //id @@ -87,7 +89,7 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti if (enableOperationId) { - Assert.Equal("AlternativeAddresses.Address.UpdateAddress", put.OperationId); + Assert.Equal("BillingAddress.Address.UpdateAddress", put.OperationId); } else { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityDeleteOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityDeleteOperationHandlerTests.cs index 21824d9a..a94b8a38 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityDeleteOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityDeleteOperationHandlerTests.cs @@ -36,8 +36,8 @@ public void CreateEntityDeleteOperationReturnsCorrectOperation(bool enableOperat // Assert Assert.NotNull(delete); - Assert.Equal("Delete entity from Customers", delete.Summary); - Assert.Equal("Delete a customer.", delete.Description); + Assert.Equal("Delete customer.", delete.Summary); + Assert.Equal("Deletes a single customer.", delete.Description); Assert.NotNull(delete.Tags); var tag = Assert.Single(delete.Tags); Assert.Equal("Customers.Customer", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityGetOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityGetOperationHandlerTests.cs index a23f7492..021a8717 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityGetOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityGetOperationHandlerTests.cs @@ -37,8 +37,8 @@ public void CreateEntityGetOperationReturnsCorrectOperation(bool enableOperation // Assert Assert.NotNull(get); - Assert.Equal("Get entity from Customers by key", get.Summary); - Assert.Equal("Get a customer.", get.Description); + Assert.Equal("Get customer.", get.Summary); + Assert.Equal("Returns a single customer.", get.Description); Assert.NotNull(get.Tags); var tag = Assert.Single(get.Tags); Assert.Equal("Customers.Customer", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPatchOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPatchOperationHandlerTests.cs index 6e7fa515..97c43760 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPatchOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPatchOperationHandlerTests.cs @@ -36,8 +36,8 @@ public void CreateEntityPatchOperationReturnsCorrectOperation(bool enableOperati // Assert Assert.NotNull(patch); - Assert.Equal("Update entity in Customers", patch.Summary); - Assert.Equal("Update a customer.", patch.Description); + Assert.Equal("Update customer.", patch.Summary); + Assert.Equal("Updates a single customer.", patch.Description); Assert.NotNull(patch.Tags); var tag = Assert.Single(patch.Tags); Assert.Equal("Customers.Customer", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPutOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPutOperationHandlerTests.cs index 8aba198f..b67b4abc 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPutOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntityPutOperationHandlerTests.cs @@ -36,8 +36,8 @@ public void CreateEntityPutOperationReturnsCorrectOperation(bool enableOperation // Assert Assert.NotNull(putOperation); - Assert.Equal("Update entity in Customers", putOperation.Summary); - Assert.Equal("Update a customer.", putOperation.Description); + Assert.Equal("Update customer.", putOperation.Summary); + Assert.Equal("Updates a single customer.", putOperation.Description); Assert.NotNull(putOperation.Tags); var tag = Assert.Single(putOperation.Tags); Assert.Equal("Customers.Customer", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetGetOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetGetOperationHandlerTests.cs index 935f963c..792796bb 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetGetOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetGetOperationHandlerTests.cs @@ -43,8 +43,8 @@ public void CreateEntitySetGetOperationReturnsCorrectOperation(bool enableOperat // Assert Assert.NotNull(get); - Assert.Equal("Get entities from " + entitySet.Name, get.Summary); - Assert.Equal("List customers.", get.Description); + Assert.Equal("List customers.", get.Summary); + Assert.Equal("Returns a list of customers.", get.Description); Assert.NotNull(get.Tags); var tag = Assert.Single(get.Tags); Assert.Equal("Customers.Customer", tag.Name); @@ -340,17 +340,20 @@ public static IEdmModel GetEdmModel(string annotation) + + - + + @@ -365,21 +368,25 @@ public static IEdmModel GetEdmModel(string annotation) + - + + - + + - + + diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetPostOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetPostOperationHandlerTests.cs index ca2c28a1..ccbc420e 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetPostOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetPostOperationHandlerTests.cs @@ -58,7 +58,7 @@ private void VerifyEntitySetPostOperation(string annotation, bool enableOperatio // Assert Assert.NotNull(post); - Assert.Equal("Add new entity to " + entitySet.Name, post.Summary); + Assert.Equal("Create customer.", post.Summary); Assert.Equal("Create a new customer.", post.Description); Assert.NotNull(post.Tags); var tag = Assert.Single(post.Tags); @@ -247,7 +247,8 @@ internal static IEdmModel GetEdmModel(string annotation, bool hasStream = false) - + + @@ -255,6 +256,7 @@ internal static IEdmModel GetEdmModel(string annotation, bool hasStream = false) + @@ -263,7 +265,8 @@ internal static IEdmModel GetEdmModel(string annotation, bool hasStream = false) - + + diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyDeleteOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyDeleteOperationHandlerTests.cs index 9c04259f..c0c9d444 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyDeleteOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyDeleteOperationHandlerTests.cs @@ -39,8 +39,8 @@ public void CreateNavigationDeleteOperationReturnsCorrectOperation(bool enableOp // Assert Assert.NotNull(operation); - Assert.Equal("Delete navigation property Trips for People", operation.Summary); - Assert.Equal("Delete a trip.", operation.Description); + Assert.Equal("Delete a trip.", operation.Summary); + Assert.Equal("Delete an instance of a trip.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Trip", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyGetOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyGetOperationHandlerTests.cs index c4c1cb6b..8f8b3118 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyGetOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyGetOperationHandlerTests.cs @@ -41,8 +41,8 @@ public void CreateNavigationGetOperationReturnsCorrectOperation(bool enableOpera // Assert Assert.NotNull(operation); - Assert.Equal("Get Trips from People", operation.Summary); - Assert.Equal("List trips.", operation.Description); + Assert.Equal("List trips.", operation.Summary); + Assert.Equal("Retrieve a list of trips.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Trip", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPatchOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPatchOperationHandlerTests.cs index 0c1d0a39..620d4fbe 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPatchOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPatchOperationHandlerTests.cs @@ -41,8 +41,8 @@ public void CreateNavigationPatchOperationReturnsCorrectOperation(bool enableOpe // Assert Assert.NotNull(operation); - Assert.Equal("Update the navigation property BestFriend in People", operation.Summary); - Assert.Equal("Update the best friend.", operation.Description); + Assert.Equal("Update the best friend.", operation.Summary); + Assert.Equal("Update an instance of a best friend.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Person", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPostOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPostOperationHandlerTests.cs index 0298508f..dd2d2c8e 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPostOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPostOperationHandlerTests.cs @@ -41,8 +41,8 @@ public void CreateNavigationPostOperationReturnsCorrectOperation(bool enableOper // Assert Assert.NotNull(operation); - Assert.Equal("Create new navigation property to Trips for People", operation.Summary); - Assert.Equal("Create a trip.", operation.Description); + Assert.Equal("Create a trip.", operation.Summary); + Assert.Equal("Create a new trip.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Trip", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPutOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPutOperationHandlerTests.cs index f8bab680..f0966898 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPutOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/NavigationPropertyPutOperationHandlerTests.cs @@ -41,8 +41,8 @@ public void CreateNavigationPutOperationReturnsCorrectOperation(bool enableOpera // Assert Assert.NotNull(operation); - Assert.Equal("Update the navigation property BestFriend in People", operation.Summary); - Assert.Equal("Update the best friend.", operation.Description); + Assert.Equal("Update the best friend.", operation.Summary); + Assert.Equal("Update an instance of a best friend.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Person", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefDeleteOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefDeleteOperationHandlerTests.cs index 705c0186..68f3df8d 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefDeleteOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefDeleteOperationHandlerTests.cs @@ -42,8 +42,8 @@ public void CreateNavigationRefDeleteOperationReturnsCorrectOperation(bool enabl // Assert Assert.NotNull(operation); - Assert.Equal("Delete ref of navigation property Trips for People", operation.Summary); - Assert.Equal("Delete a trip.", operation.Description); + Assert.Equal("Delete a trip.", operation.Summary); + Assert.Equal("Delete an instance of a trip.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Trip", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefGetOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefGetOperationHandlerTests.cs index 4748fcb5..b54705ec 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefGetOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefGetOperationHandlerTests.cs @@ -42,8 +42,8 @@ public void CreateNavigationRefGetOperationReturnsCorrectOperation(bool enableOp // Assert Assert.NotNull(operation); - Assert.Equal("Get ref of Trips from People", operation.Summary); - Assert.Equal("List trips.", operation.Description); + Assert.Equal("List trips.", operation.Summary); + Assert.Equal("Retrieve a list of trips.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Trip", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPostOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPostOperationHandlerTests.cs index e2169e90..a6845f94 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPostOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPostOperationHandlerTests.cs @@ -42,8 +42,8 @@ public void CreateNavigationRefPostOperationReturnsCorrectOperation(bool enableO // Assert Assert.NotNull(operation); - Assert.Equal("Create new navigation property ref to Trips for People", operation.Summary); - Assert.Equal("Create a trip.", operation.Description); + Assert.Equal("Create a trip.", operation.Summary); + Assert.Equal("Create a new trip.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Trip", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPutOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPutOperationHandlerTests.cs index 35591bff..ff953438 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPutOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/RefPutOperationHandlerTests.cs @@ -42,8 +42,8 @@ public void CreateNavigationRefPutOperationReturnsCorrectOperation(bool enableOp // Assert Assert.NotNull(operation); - Assert.Equal("Update the ref of navigation property BestFriend in People", operation.Summary); - Assert.Equal("Update the best friend.", operation.Description); + Assert.Equal("Update the best friend.", operation.Summary); + Assert.Equal("Update an instance of a best friend.", operation.Description); Assert.NotNull(operation.Tags); var tag = Assert.Single(operation.Tags); Assert.Equal("People.Person", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonGetOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonGetOperationHandlerTests.cs index 5d51a46d..d4d3a30a 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonGetOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonGetOperationHandlerTests.cs @@ -30,7 +30,8 @@ public void CreateSingletonGetOperationReturnsCorrectOperation(bool enableOperat string annotation = @" - + + "; IEdmModel model = GetEdmModel(annotation); @@ -47,8 +48,8 @@ public void CreateSingletonGetOperationReturnsCorrectOperation(bool enableOperat // Assert Assert.NotNull(get); - Assert.Equal("Get Me", get.Summary); - Assert.Equal("Get the signed-in user.", get.Description); + Assert.Equal("List users.", get.Summary); + Assert.Equal("Retrieve a list of user objects.", get.Description); Assert.NotNull(get.Tags); var tag = Assert.Single(get.Tags); Assert.Equal("Me.Customer", tag.Name); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonPatchOperationHandlerTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonPatchOperationHandlerTests.cs index 52f90062..dba73e73 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonPatchOperationHandlerTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/SingletonPatchOperationHandlerTests.cs @@ -28,6 +28,7 @@ public void CreateSingletonPatchOperationReturnsCorrectOperation(bool enableOper + "; IEdmModel model = SingletonGetOperationHandlerTests.GetEdmModel(annotation); @@ -44,7 +45,7 @@ public void CreateSingletonPatchOperationReturnsCorrectOperation(bool enableOper // Assert Assert.NotNull(patch); - Assert.Equal("Update Me", patch.Summary); + Assert.Equal("Update the signed-in user.", patch.Summary); Assert.Equal("Update the signed-in user.", patch.Description); Assert.NotNull(patch.Tags); var tag = Assert.Single(patch.Tags); diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json index 960f4a4b..6f5176ad 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.json @@ -1670,8 +1670,8 @@ "tags": [ "Me.Person" ], - "summary": "Update the ref of navigation property BestFriend in Me", - "description": "Update the best friend.", + "summary": "Update the best friend.", + "description": "Update an instance of a best friend.", "operationId": "Me.UpdateRefBestFriend", "consumes": [ "application/json" @@ -8539,8 +8539,8 @@ "tags": [ "Me.Trip" ], - "summary": "Get Trips from Me", - "description": "List trips.", + "summary": "List trips.", + "description": "Retrieve a list of trips.", "operationId": "Me.ListTrips", "parameters": [ { @@ -8640,8 +8640,8 @@ "tags": [ "Me.Trip" ], - "summary": "Create new navigation property to Trips for Me", - "description": "Create a trip.", + "summary": "Create a trip.", + "description": "Create a new trip.", "operationId": "Me.CreateTrips", "consumes": [ "application/json" @@ -8687,8 +8687,8 @@ "tags": [ "Me.Trip" ], - "summary": "Get Trips from Me", - "description": "Get a trip.", + "summary": "Get a trip.", + "description": "Retrieve the properties of a trip.", "operationId": "Me.GetTrips", "produces": [ "application/json" @@ -8763,8 +8763,8 @@ "tags": [ "Me.Trip" ], - "summary": "Update the navigation property Trips in Me", - "description": "Update a trip.", + "summary": "Update a trip.", + "description": "Update an instance of a trip.", "operationId": "Me.UpdateTrips", "consumes": [ "application/json" @@ -8812,8 +8812,8 @@ "tags": [ "Me.Trip" ], - "summary": "Delete navigation property Trips for Me", - "description": "Delete a trip.", + "summary": "Delete a trip.", + "description": "Delete an instance of a trip.", "operationId": "Me.DeleteTrips", "parameters": [ { @@ -9915,8 +9915,8 @@ "tags": [ "NewComePeople.Person" ], - "summary": "Update the ref of navigation property BestFriend in NewComePeople", - "description": "Update the best friend.", + "summary": "Update the best friend.", + "description": "Update an instance of a best friend.", "operationId": "NewComePeople.UpdateRefBestFriend", "consumes": [ "application/json" @@ -15590,8 +15590,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Get Trips from NewComePeople", - "description": "List trips.", + "summary": "List trips.", + "description": "Retrieve a list of trips.", "operationId": "NewComePeople.ListTrips", "parameters": [ { @@ -15692,8 +15692,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Create new navigation property to Trips for NewComePeople", - "description": "Create a trip.", + "summary": "Create a trip.", + "description": "Create a new trip.", "operationId": "NewComePeople.CreateTrips", "consumes": [ "application/json" @@ -15740,8 +15740,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Get Trips from NewComePeople", - "description": "Get a trip.", + "summary": "Get a trip.", + "description": "Retrieve the properties of a trip.", "operationId": "NewComePeople.GetTrips", "produces": [ "application/json" @@ -15817,8 +15817,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Update the navigation property Trips in NewComePeople", - "description": "Update a trip.", + "summary": "Update a trip.", + "description": "Update an instance of a trip.", "operationId": "NewComePeople.UpdateTrips", "consumes": [ "application/json" @@ -15867,8 +15867,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Delete navigation property Trips for NewComePeople", - "description": "Delete a trip.", + "summary": "Delete a trip.", + "description": "Delete an instance of a trip.", "operationId": "NewComePeople.DeleteTrips", "parameters": [ { @@ -17072,8 +17072,8 @@ "tags": [ "People.Person" ], - "summary": "Update the ref of navigation property BestFriend in People", - "description": "Update the best friend.", + "summary": "Update the best friend.", + "description": "Update an instance of a best friend.", "operationId": "People.UpdateRefBestFriend", "consumes": [ "application/json" @@ -24991,8 +24991,8 @@ "tags": [ "People.Trip" ], - "summary": "Get Trips from People", - "description": "List trips.", + "summary": "List trips.", + "description": "Retrieve a list of trips.", "operationId": "People.ListTrips", "parameters": [ { @@ -25100,8 +25100,8 @@ "tags": [ "People.Trip" ], - "summary": "Create new navigation property to Trips for People", - "description": "Create a trip.", + "summary": "Create a trip.", + "description": "Create a new trip.", "operationId": "People.CreateTrips", "consumes": [ "application/json" @@ -25155,8 +25155,8 @@ "tags": [ "People.Trip" ], - "summary": "Get Trips from People", - "description": "Get a trip.", + "summary": "Get a trip.", + "description": "Retrieve the properties of a trip.", "operationId": "People.GetTrips", "produces": [ "application/json" @@ -25239,8 +25239,8 @@ "tags": [ "People.Trip" ], - "summary": "Update the navigation property Trips in People", - "description": "Update a trip.", + "summary": "Update a trip.", + "description": "Update an instance of a trip.", "operationId": "People.UpdateTrips", "consumes": [ "application/json" @@ -25296,8 +25296,8 @@ "tags": [ "People.Trip" ], - "summary": "Delete navigation property Trips for People", - "description": "Delete a trip.", + "summary": "Delete a trip.", + "description": "Delete an instance of a trip.", "operationId": "People.DeleteTrips", "parameters": [ { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml index b44fd2b7..20b56361 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.V2.yaml @@ -1144,8 +1144,8 @@ paths: put: tags: - Me.Person - summary: Update the ref of navigation property BestFriend in Me - description: Update the best friend. + summary: Update the best friend. + description: Update an instance of a best friend. operationId: Me.UpdateRefBestFriend consumes: - application/json @@ -6019,8 +6019,8 @@ paths: get: tags: - Me.Trip - summary: Get Trips from Me - description: List trips. + summary: List trips. + description: Retrieve a list of trips. operationId: Me.ListTrips parameters: - $ref: '#/parameters/top' @@ -6091,8 +6091,8 @@ paths: post: tags: - Me.Trip - summary: Create new navigation property to Trips for Me - description: Create a trip. + summary: Create a trip. + description: Create a new trip. operationId: Me.CreateTrips consumes: - application/json @@ -6124,8 +6124,8 @@ paths: get: tags: - Me.Trip - summary: Get Trips from Me - description: Get a trip. + summary: Get a trip. + description: Retrieve the properties of a trip. operationId: Me.GetTrips produces: - application/json @@ -6181,8 +6181,8 @@ paths: patch: tags: - Me.Trip - summary: Update the navigation property Trips in Me - description: Update a trip. + summary: Update a trip. + description: Update an instance of a trip. operationId: Me.UpdateTrips consumes: - application/json @@ -6217,8 +6217,8 @@ paths: delete: tags: - Me.Trip - summary: Delete navigation property Trips for Me - description: Delete a trip. + summary: Delete a trip. + description: Delete an instance of a trip. operationId: Me.DeleteTrips parameters: - in: path @@ -6996,8 +6996,8 @@ paths: put: tags: - NewComePeople.Person - summary: Update the ref of navigation property BestFriend in NewComePeople - description: Update the best friend. + summary: Update the best friend. + description: Update an instance of a best friend. operationId: NewComePeople.UpdateRefBestFriend consumes: - application/json @@ -10992,8 +10992,8 @@ paths: get: tags: - NewComePeople.Trip - summary: Get Trips from NewComePeople - description: List trips. + summary: List trips. + description: Retrieve a list of trips. operationId: NewComePeople.ListTrips parameters: - in: path @@ -11064,8 +11064,8 @@ paths: post: tags: - NewComePeople.Trip - summary: Create new navigation property to Trips for NewComePeople - description: Create a trip. + summary: Create a trip. + description: Create a new trip. operationId: NewComePeople.CreateTrips consumes: - application/json @@ -11097,8 +11097,8 @@ paths: get: tags: - NewComePeople.Trip - summary: Get Trips from NewComePeople - description: Get a trip. + summary: Get a trip. + description: Retrieve the properties of a trip. operationId: NewComePeople.GetTrips produces: - application/json @@ -11154,8 +11154,8 @@ paths: patch: tags: - NewComePeople.Trip - summary: Update the navigation property Trips in NewComePeople - description: Update a trip. + summary: Update a trip. + description: Update an instance of a trip. operationId: NewComePeople.UpdateTrips consumes: - application/json @@ -11190,8 +11190,8 @@ paths: delete: tags: - NewComePeople.Trip - summary: Delete navigation property Trips for NewComePeople - description: Delete a trip. + summary: Delete a trip. + description: Delete an instance of a trip. operationId: NewComePeople.DeleteTrips parameters: - in: path @@ -12046,8 +12046,8 @@ paths: put: tags: - People.Person - summary: Update the ref of navigation property BestFriend in People - description: Update the best friend. + summary: Update the best friend. + description: Update an instance of a best friend. operationId: People.UpdateRefBestFriend consumes: - application/json @@ -17702,8 +17702,8 @@ paths: get: tags: - People.Trip - summary: Get Trips from People - description: List trips. + summary: List trips. + description: Retrieve a list of trips. operationId: People.ListTrips parameters: - in: path @@ -17780,8 +17780,8 @@ paths: post: tags: - People.Trip - summary: Create new navigation property to Trips for People - description: Create a trip. + summary: Create a trip. + description: Create a new trip. operationId: People.CreateTrips consumes: - application/json @@ -17819,8 +17819,8 @@ paths: get: tags: - People.Trip - summary: Get Trips from People - description: Get a trip. + summary: Get a trip. + description: Retrieve the properties of a trip. operationId: People.GetTrips produces: - application/json @@ -17882,8 +17882,8 @@ paths: patch: tags: - People.Trip - summary: Update the navigation property Trips in People - description: Update a trip. + summary: Update a trip. + description: Update an instance of a trip. operationId: People.UpdateTrips consumes: - application/json @@ -17924,8 +17924,8 @@ paths: delete: tags: - People.Trip - summary: Delete navigation property Trips for People - description: Delete a trip. + summary: Delete a trip. + description: Delete an instance of a trip. operationId: People.DeleteTrips parameters: - in: path diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json index 0aa6ae8a..a4f43dec 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json @@ -1890,8 +1890,8 @@ "tags": [ "Me.Person" ], - "summary": "Update the ref of navigation property BestFriend in Me", - "description": "Update the best friend.", + "summary": "Update the best friend.", + "description": "Update an instance of a best friend.", "operationId": "Me.UpdateRefBestFriend", "requestBody": { "description": "New navigation property ref values", @@ -9435,8 +9435,8 @@ "tags": [ "Me.Trip" ], - "summary": "Get Trips from Me", - "description": "List trips.", + "summary": "List trips.", + "description": "Retrieve a list of trips.", "operationId": "Me.ListTrips", "parameters": [ { @@ -9551,8 +9551,8 @@ "tags": [ "Me.Trip" ], - "summary": "Create new navigation property to Trips for Me", - "description": "Create a trip.", + "summary": "Create a trip.", + "description": "Create a new trip.", "operationId": "Me.CreateTrips", "requestBody": { "description": "New navigation property", @@ -9596,8 +9596,8 @@ "tags": [ "Me.Trip" ], - "summary": "Get Trips from Me", - "description": "Get a trip.", + "summary": "Get a trip.", + "description": "Retrieve the properties of a trip.", "operationId": "Me.GetTrips", "parameters": [ { @@ -9685,8 +9685,8 @@ "tags": [ "Me.Trip" ], - "summary": "Update the navigation property Trips in Me", - "description": "Update a trip.", + "summary": "Update a trip.", + "description": "Update an instance of a trip.", "operationId": "Me.UpdateTrips", "parameters": [ { @@ -9735,8 +9735,8 @@ "tags": [ "Me.Trip" ], - "summary": "Delete navigation property Trips for Me", - "description": "Delete a trip.", + "summary": "Delete a trip.", + "description": "Delete an instance of a trip.", "operationId": "Me.DeleteTrips", "parameters": [ { @@ -10960,8 +10960,8 @@ "tags": [ "NewComePeople.Person" ], - "summary": "Update the ref of navigation property BestFriend in NewComePeople", - "description": "Update the best friend.", + "summary": "Update the best friend.", + "description": "Update an instance of a best friend.", "operationId": "NewComePeople.UpdateRefBestFriend", "parameters": [ { @@ -17371,8 +17371,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Get Trips from NewComePeople", - "description": "List trips.", + "summary": "List trips.", + "description": "Retrieve a list of trips.", "operationId": "NewComePeople.ListTrips", "parameters": [ { @@ -17490,8 +17490,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Create new navigation property to Trips for NewComePeople", - "description": "Create a trip.", + "summary": "Create a trip.", + "description": "Create a new trip.", "operationId": "NewComePeople.CreateTrips", "parameters": [ { @@ -17540,8 +17540,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Get Trips from NewComePeople", - "description": "Get a trip.", + "summary": "Get a trip.", + "description": "Retrieve the properties of a trip.", "operationId": "NewComePeople.GetTrips", "parameters": [ { @@ -17632,8 +17632,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Update the navigation property Trips in NewComePeople", - "description": "Update a trip.", + "summary": "Update a trip.", + "description": "Update an instance of a trip.", "operationId": "NewComePeople.UpdateTrips", "parameters": [ { @@ -17685,8 +17685,8 @@ "tags": [ "NewComePeople.Trip" ], - "summary": "Delete navigation property Trips for NewComePeople", - "description": "Delete a trip.", + "summary": "Delete a trip.", + "description": "Delete an instance of a trip.", "operationId": "NewComePeople.DeleteTrips", "parameters": [ { @@ -19028,8 +19028,8 @@ "tags": [ "People.Person" ], - "summary": "Update the ref of navigation property BestFriend in People", - "description": "Update the best friend.", + "summary": "Update the best friend.", + "description": "Update an instance of a best friend.", "operationId": "People.UpdateRefBestFriend", "parameters": [ { @@ -27903,8 +27903,8 @@ "tags": [ "People.Trip" ], - "summary": "Get Trips from People", - "description": "List trips.", + "summary": "List trips.", + "description": "Retrieve a list of trips.", "operationId": "People.ListTrips", "parameters": [ { @@ -28029,8 +28029,8 @@ "tags": [ "People.Trip" ], - "summary": "Create new navigation property to Trips for People", - "description": "Create a trip.", + "summary": "Create a trip.", + "description": "Create a new trip.", "operationId": "People.CreateTrips", "parameters": [ { @@ -28086,8 +28086,8 @@ "tags": [ "People.Trip" ], - "summary": "Get Trips from People", - "description": "Get a trip.", + "summary": "Get a trip.", + "description": "Retrieve the properties of a trip.", "operationId": "People.GetTrips", "parameters": [ { @@ -28185,8 +28185,8 @@ "tags": [ "People.Trip" ], - "summary": "Update the navigation property Trips in People", - "description": "Update a trip.", + "summary": "Update a trip.", + "description": "Update an instance of a trip.", "operationId": "People.UpdateTrips", "parameters": [ { @@ -28245,8 +28245,8 @@ "tags": [ "People.Trip" ], - "summary": "Delete navigation property Trips for People", - "description": "Delete a trip.", + "summary": "Delete a trip.", + "description": "Delete an instance of a trip.", "operationId": "People.DeleteTrips", "parameters": [ { diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml index 8bb51646..de948f32 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml @@ -1277,8 +1277,8 @@ paths: put: tags: - Me.Person - summary: Update the ref of navigation property BestFriend in Me - description: Update the best friend. + summary: Update the best friend. + description: Update an instance of a best friend. operationId: Me.UpdateRefBestFriend requestBody: description: New navigation property ref values @@ -6589,8 +6589,8 @@ paths: get: tags: - Me.Trip - summary: Get Trips from Me - description: List trips. + summary: List trips. + description: Retrieve a list of trips. operationId: Me.ListTrips parameters: - $ref: '#/components/parameters/top' @@ -6673,8 +6673,8 @@ paths: post: tags: - Me.Trip - summary: Create new navigation property to Trips for Me - description: Create a trip. + summary: Create a trip. + description: Create a new trip. operationId: Me.CreateTrips requestBody: description: New navigation property @@ -6704,8 +6704,8 @@ paths: get: tags: - Me.Trip - summary: Get Trips from Me - description: Get a trip. + summary: Get a trip. + description: Retrieve the properties of a trip. operationId: Me.GetTrips parameters: - name: TripId @@ -6770,8 +6770,8 @@ paths: patch: tags: - Me.Trip - summary: Update the navigation property Trips in Me - description: Update a trip. + summary: Update a trip. + description: Update an instance of a trip. operationId: Me.UpdateTrips parameters: - name: TripId @@ -6806,8 +6806,8 @@ paths: delete: tags: - Me.Trip - summary: Delete navigation property Trips for Me - description: Delete a trip. + summary: Delete a trip. + description: Delete an instance of a trip. operationId: Me.DeleteTrips parameters: - name: TripId @@ -7661,8 +7661,8 @@ paths: put: tags: - NewComePeople.Person - summary: Update the ref of navigation property BestFriend in NewComePeople - description: Update the best friend. + summary: Update the best friend. + description: Update an instance of a best friend. operationId: NewComePeople.UpdateRefBestFriend parameters: - name: UserName @@ -12098,8 +12098,8 @@ paths: get: tags: - NewComePeople.Trip - summary: Get Trips from NewComePeople - description: List trips. + summary: List trips. + description: Retrieve a list of trips. operationId: NewComePeople.ListTrips parameters: - name: UserName @@ -12183,8 +12183,8 @@ paths: post: tags: - NewComePeople.Trip - summary: Create new navigation property to Trips for NewComePeople - description: Create a trip. + summary: Create a trip. + description: Create a new trip. operationId: NewComePeople.CreateTrips parameters: - name: UserName @@ -12216,8 +12216,8 @@ paths: get: tags: - NewComePeople.Trip - summary: Get Trips from NewComePeople - description: Get a trip. + summary: Get a trip. + description: Retrieve the properties of a trip. operationId: NewComePeople.GetTrips parameters: - name: UserName @@ -12283,8 +12283,8 @@ paths: patch: tags: - NewComePeople.Trip - summary: Update the navigation property Trips in NewComePeople - description: Update a trip. + summary: Update a trip. + description: Update an instance of a trip. operationId: NewComePeople.UpdateTrips parameters: - name: UserName @@ -12320,8 +12320,8 @@ paths: delete: tags: - NewComePeople.Trip - summary: Delete navigation property Trips for NewComePeople - description: Delete a trip. + summary: Delete a trip. + description: Delete an instance of a trip. operationId: NewComePeople.DeleteTrips parameters: - name: UserName @@ -13260,8 +13260,8 @@ paths: put: tags: - People.Person - summary: Update the ref of navigation property BestFriend in People - description: Update the best friend. + summary: Update the best friend. + description: Update an instance of a best friend. operationId: People.UpdateRefBestFriend parameters: - name: UserName @@ -19493,8 +19493,8 @@ paths: get: tags: - People.Trip - summary: Get Trips from People - description: List trips. + summary: List trips. + description: Retrieve a list of trips. operationId: People.ListTrips parameters: - name: UserName @@ -19584,8 +19584,8 @@ paths: post: tags: - People.Trip - summary: Create new navigation property to Trips for People - description: Create a trip. + summary: Create a trip. + description: Create a new trip. operationId: People.CreateTrips parameters: - name: UserName @@ -19623,8 +19623,8 @@ paths: get: tags: - People.Trip - summary: Get Trips from People - description: Get a trip. + summary: Get a trip. + description: Retrieve the properties of a trip. operationId: People.GetTrips parameters: - name: UserName @@ -19696,8 +19696,8 @@ paths: patch: tags: - People.Trip - summary: Update the navigation property Trips in People - description: Update a trip. + summary: Update a trip. + description: Update an instance of a trip. operationId: People.UpdateTrips parameters: - name: UserName @@ -19739,8 +19739,8 @@ paths: delete: tags: - People.Trip - summary: Delete navigation property Trips for People - description: Delete a trip. + summary: Delete a trip. + description: Delete an instance of a trip. operationId: People.DeleteTrips parameters: - name: UserName