Skip to content

Commit 3295eb9

Browse files
baywetAndrew Omondi
authored andcommitted
feat: migrates to the latest preview of OAI.net
Signed-off-by: Vincent Biret <[email protected]>
1 parent a578631 commit 3295eb9

File tree

70 files changed

+422
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+422
-361
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ public IEnumerable<ODataPath> AllPaths
135135
/// <summary>
136136
/// Gets all tags.
137137
/// </summary>
138-
public IList<OpenApiTag> Tags { get; private set; }
138+
public ISet<OpenApiTag> Tags { get; private set; }
139139

140140
/// <summary>
141141
/// Append tag.
142142
/// </summary>
143143
/// <param name="tagItem">The tag item.</param>
144144
internal void AppendTag(OpenApiTag tagItem)
145145
{
146-
Tags ??= [];
146+
Tags ??= new HashSet<OpenApiTag>();
147147

148148
if (FindTagByName(tagItem.Name) is not null)
149149
{

src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiDocumentGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static OpenApiDocument CreateDocument(this ODataContext context)
3838

3939
Servers = context.CreateServers(),
4040

41-
SecurityRequirements = null,
41+
Security = null,
4242

4343
ExternalDocs = null,
4444
};

src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiPathItemGenerator.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System.Collections.Generic;
77
using System.Linq;
8+
using System.Net.Http;
89
using Microsoft.OData.Edm;
910
using Microsoft.OpenApi.Models;
1011
using Microsoft.OpenApi.Models.Interfaces;
@@ -58,9 +59,9 @@ public static void AddPathItemsToDocument(this ODataContext context, OpenApiDocu
5859
{
5960
OpenApiPathItem rootPath = new()
6061
{
61-
Operations = new Dictionary<OperationType, OpenApiOperation> {
62+
Operations = new Dictionary<HttpMethod, OpenApiOperation> {
6263
{
63-
OperationType.Get, new OpenApiOperation {
64+
HttpMethod.Get, new OpenApiOperation {
6465
OperationId = "graphService.GetGraphService",
6566
Responses = new OpenApiResponses()
6667
{

src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiTagGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal static class OpenApiTagGenerator
2222
/// </summary>
2323
/// <param name="context">The OData context.</param>
2424
/// <returns>The created collection of <see cref="OpenApiTag"/> object.</returns>
25-
public static IList<OpenApiTag> CreateTags(this ODataContext context)
25+
public static ISet<OpenApiTag> CreateTags(this ODataContext context)
2626
{
2727
Utils.CheckArgumentNull(context, nameof(context));
2828

@@ -38,7 +38,7 @@ public static IList<OpenApiTag> CreateTags(this ODataContext context)
3838
return context.Tags;
3939
}
4040

41-
IList<OpenApiTag> tags = new List<OpenApiTag>();
41+
var tags = new HashSet<OpenApiTag>();
4242
if (context.EntityContainer != null)
4343
{
4444
foreach (IEdmEntityContainerElement element in context.Model.EntityContainer.Elements)

src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3030
</PackageReference>
3131
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.3" />
32-
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
32+
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview.13" />
3333
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
3434
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.13.61">
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

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

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

66
using System.Linq;
7+
using System.Net.Http;
78
using System.Text.Json.Nodes;
89
using Microsoft.OData.Edm;
910
using Microsoft.OpenApi.Any;
@@ -28,7 +29,7 @@ public ComplexPropertyGetOperationHandler(OpenApiDocument document):base(documen
2829

2930
}
3031
/// <inheritdoc />
31-
public override OperationType OperationType => OperationType.Get;
32+
public override HttpMethod OperationType => HttpMethod.Get;
3233

3334
private ReadRestrictionsType _readRestrictions;
3435

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
44
// ------------------------------------------------------------
55

6+
using System.Net.Http;
67
using Microsoft.OpenApi.Models;
78

89
namespace Microsoft.OpenApi.OData.Operation;
@@ -18,5 +19,5 @@ public ComplexPropertyPatchOperationHandler(OpenApiDocument document):base(docum
1819

1920
}
2021
/// <inheritdoc />
21-
public override OperationType OperationType => OperationType.Patch;
22+
public override HttpMethod OperationType => HttpMethod.Patch;
2223
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System;
77
using System.Collections.Generic;
88
using System.Linq;
9+
using System.Net.Http;
910
using Microsoft.OData.Edm;
1011
using Microsoft.OpenApi.Models;
1112
using Microsoft.OpenApi.Models.References;
@@ -41,7 +42,7 @@ protected override void Initialize(ODataContext context, ODataPath path)
4142
_insertRestrictions ??= complexPropertyInsertRestrictions;
4243
}
4344
/// <inheritdoc />
44-
public override OperationType OperationType => OperationType.Post;
45+
public override HttpMethod OperationType => HttpMethod.Post;
4546

4647
private InsertRestrictionsType _insertRestrictions;
4748

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
44
// ------------------------------------------------------------
55

6+
using System.Net.Http;
67
using Microsoft.OpenApi.Models;
78

89
namespace Microsoft.OpenApi.OData.Operation;
@@ -18,5 +19,5 @@ public ComplexPropertyPutOperationHandler(OpenApiDocument document) : base(docum
1819

1920
}
2021
/// <inheritdoc />
21-
public override OperationType OperationType => OperationType.Put;
22+
public override HttpMethod OperationType => HttpMethod.Put;
2223
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System.Collections.Generic;
77
using System.Linq;
8+
using System.Net.Http;
89
using Microsoft.OData.Edm;
910
using Microsoft.OpenApi.Models;
1011
using Microsoft.OpenApi.Models.Interfaces;
@@ -50,7 +51,7 @@ protected override void SetBasicInfo(OpenApiOperation operation)
5051
// OperationId
5152
if (Context.Settings.EnableOperationId)
5253
{
53-
string prefix = OperationType == OperationType.Patch ? "Update" : "Set";
54+
string prefix = OperationType == HttpMethod.Patch ? "Update" : "Set";
5455
operation.OperationId = EdmModelHelper.GenerateComplexPropertyPathOperationId(Path, Context, prefix);
5556
}
5657
}

0 commit comments

Comments
 (0)