Skip to content

Commit d8b9f3f

Browse files
authored
Merge pull request #666 from microsoft/feat/upgrade-oai
feat: bump openapi.net packages to the latest preview.
2 parents a578631 + 181d926 commit d8b9f3f

File tree

78 files changed

+439
-367
lines changed

Some content is hidden

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

78 files changed

+439
-367
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.14" />
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/ComplexPropertyBaseOperationHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.OpenApi.OData.Common;
1010
using Microsoft.OpenApi.OData.Edm;
1111
using Microsoft.OpenApi.OData.Vocabulary.Core;
12+
using System.Collections.Generic;
1213

1314
namespace Microsoft.OpenApi.OData.Operation;
1415

@@ -35,7 +36,7 @@ protected override void Initialize(ODataContext context, ODataPath path)
3536
protected override void SetTags(OpenApiOperation operation)
3637
{
3738
string tagName = EdmModelHelper.GenerateComplexPropertyPathTagName(Path, Context);
38-
39+
operation.Tags ??= new HashSet<OpenApiTagReference>();
3940
if (!string.IsNullOrEmpty(tagName))
4041
{
4142
Context.AddExtensionToTag(tagName, Constants.xMsTocType, new OpenApiAny("page"), () => new OpenApiTag()

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
}

0 commit comments

Comments
 (0)