- fixes a bug where the operation id for count operations would not be unique

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
This commit is contained in:
Vincent Biret 2021-11-22 15:38:40 -05:00
parent 10b99ca357
commit 032fbaefb4
No known key found for this signature in database
GPG key ID: 32426322EDFFB7E3

View file

@ -25,7 +25,7 @@ namespace Microsoft.OpenApi.OData.Operation
/// this segment could be "entity set", "Collection property", "Composable function whose return is collection",etc.
/// </summary>
internal ODataSegment LastSecondSegment { get; set; }
private const int SecondLastSegmentIndex = 2;
/// <inheritdoc/>
protected override void Initialize(ODataContext context, ODataPath path)
{
@ -33,7 +33,8 @@ namespace Microsoft.OpenApi.OData.Operation
// get the last second segment
int count = path.Segments.Count;
LastSecondSegment = path.Segments.ElementAt(count - 1);
if(count >= SecondLastSegmentIndex)
LastSecondSegment = path.Segments.ElementAt(count - SecondLastSegmentIndex);
}
/// <inheritdoc/>