Skip to content

Commit db33949

Browse files
committed
- adds missing target type for deprecation for cast
- updates unit tests following merge Signed-off-by: Vincent Biret <[email protected]>
1 parent eaaa8dd commit db33949

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Microsoft.OpenApi.OData.Reader/Edm/ODataTypeCastSegment.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// ------------------------------------------------------------
55

66
using System.Collections.Generic;
7-
using System.Linq;
87
using Microsoft.OData.Edm;
98
using Microsoft.OData.Edm.Vocabularies;
109
using Microsoft.OpenApi.OData.Common;
@@ -37,7 +36,7 @@ public ODataTypeCastSegment(IEdmEntityType entityType)
3736
/// <inheritdoc />
3837
public override IEnumerable<IEdmVocabularyAnnotatable> GetAnnotables()
3938
{
40-
return Enumerable.Empty<IEdmVocabularyAnnotatable>();
39+
return new IEdmVocabularyAnnotatable[] { EntityType };
4140
}
4241

4342
/// <inheritdoc />

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ODataTypeCastGetOperationHandlerTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void CreateODataTypeCastGetOperationReturnsCorrectOperationForCollectionN
5656

5757
Assert.Null(operation.RequestBody);
5858
if(enablePagination)
59-
Assert.Single(operation.Extensions);
59+
Assert.Equal(2, operation.Extensions.Count); //deprecated, pagination
6060

6161
Assert.Equal(2, operation.Responses.Count);
6262
Assert.Equal(new string[] { "200", "default" }, operation.Responses.Select(e => e.Key));
@@ -114,7 +114,7 @@ public void CreateODataTypeCastGetOperationReturnsCorrectOperationForCollectionN
114114

115115
Assert.Null(operation.RequestBody);
116116
if(enablePagination)
117-
Assert.Empty(operation.Extensions);
117+
Assert.Single(operation.Extensions); //deprecated
118118

119119
Assert.Equal(2, operation.Responses.Count);
120120
Assert.Equal(new string[] { "200", "default" }, operation.Responses.Select(e => e.Key));
@@ -167,7 +167,7 @@ public void CreateODataTypeCastGetOperationReturnsCorrectOperationForEntitySet(b
167167

168168
Assert.Null(operation.RequestBody);
169169
if(enablePagination)
170-
Assert.Single(operation.Extensions);
170+
Assert.Equal(2, operation.Extensions.Count);
171171

172172
Assert.Equal(2, operation.Responses.Count);
173173
Assert.Equal(new string[] { "200", "default" }, operation.Responses.Select(e => e.Key));
@@ -222,7 +222,7 @@ public void CreateODataTypeCastGetOperationReturnsCorrectOperationForEntitySetId
222222

223223
Assert.Null(operation.RequestBody);
224224
if(enablePagination)
225-
Assert.Empty(operation.Extensions);
225+
Assert.Single(operation.Extensions); // deprecated
226226

227227
Assert.Equal(2, operation.Responses.Count);
228228
Assert.Equal(new string[] { "200", "default" }, operation.Responses.Select(e => e.Key));
@@ -279,7 +279,7 @@ public void CreateODataTypeCastGetOperationReturnsCorrectOperationForSingleNavig
279279

280280
Assert.Null(operation.RequestBody);
281281
if(enablePagination)
282-
Assert.Empty(operation.Extensions);
282+
Assert.Single(operation.Extensions); //deprecated
283283

284284
Assert.Equal(2, operation.Responses.Count);
285285
Assert.Equal(new string[] { "200", "default" }, operation.Responses.Select(e => e.Key));
@@ -332,7 +332,7 @@ public void CreateODataTypeCastGetOperationReturnsCorrectOperationForSingleton(b
332332

333333
Assert.Null(operation.RequestBody);
334334
if(enablePagination)
335-
Assert.Empty(operation.Extensions);
335+
Assert.Single(operation.Extensions); //deprecated
336336

337337
Assert.Equal(2, operation.Responses.Count);
338338
Assert.Equal(new string[] { "200", "default" }, operation.Responses.Select(e => e.Key));

0 commit comments

Comments
 (0)