Skip to content

Commit 16e559c

Browse files
authored
Merge pull request #688 from microsoft/feat/preview18
feat: upgrades OpenApi.Net to preview18
2 parents ec78902 + c7cc418 commit 16e559c

39 files changed

+104
-78
lines changed

src/Microsoft.OpenApi.OData.Reader/Common/Utils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Linq;
1010
using Microsoft.OData.Edm;
1111
using Microsoft.OData.Edm.Vocabularies;
12-
using Microsoft.OpenApi.Any;
12+
using Microsoft.OpenApi.Extensions;
1313
using Microsoft.OpenApi.Interfaces;
1414
using Microsoft.OpenApi.Models;
1515
using Microsoft.OpenApi.Models.Interfaces;
@@ -159,7 +159,7 @@ internal static void AddCustomAttributesToExtensions(this IDictionary<string, IO
159159
{
160160
foreach (var item in attributesValueMap)
161161
{
162-
extensions.TryAdd(item.Key, new OpenApiAny(item.Value));
162+
extensions.TryAdd(item.Key, new JsonNodeExtension(item.Value));
163163
}
164164
}
165165
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using System.Linq;
99
using Microsoft.OData.Edm;
1010
using Microsoft.OData.Edm.Vocabularies;
11-
using Microsoft.OpenApi.Any;
11+
using Microsoft.OpenApi.Extensions;
1212
using Microsoft.OpenApi.Interfaces;
1313
using Microsoft.OpenApi.Models;
1414
using Microsoft.OpenApi.OData.Common;
@@ -172,7 +172,7 @@ internal void AppendTag(OpenApiTag tagItem)
172172
/// <param name="extensionName">The extension name.</param>
173173
/// <param name="extensionValue">The extension value to set.</param>
174174
/// <param name="initialValueFactory">The tag default value factory.</param>
175-
internal void AddExtensionToTag(string tagName, string extensionName, OpenApiAny extensionValue, Func<OpenApiTag> initialValueFactory)
175+
internal void AddExtensionToTag(string tagName, string extensionName, JsonNodeExtension extensionValue, Func<OpenApiTag> initialValueFactory)
176176
{
177177
Utils.CheckArgumentNullOrEmpty(tagName, nameof(tagName));
178178
Utils.CheckArgumentNullOrEmpty(extensionName, nameof(extensionName));

src/Microsoft.OpenApi.OData.Reader/EdmModelOpenApiExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using System.Collections.Generic;
77
using Microsoft.OData.Edm;
88
using Microsoft.OData.Edm.Validation;
9-
using Microsoft.OpenApi.Any;
9+
using Microsoft.OpenApi.Extensions;
1010
using Microsoft.OpenApi.Interfaces;
1111
using Microsoft.OpenApi.Models;
1212
using Microsoft.OpenApi.OData.Common;
@@ -48,7 +48,7 @@ public static OpenApiDocument ConvertToOpenApi(this IEdmModel model, OpenApiConv
4848
document.Extensions ??= new Dictionary<string, IOpenApiExtension>();
4949
foreach (var error in errors)
5050
{
51-
document.Extensions.Add(Constants.xMsEdmModelError + index++, new OpenApiAny(error.ToString()));
51+
document.Extensions.Add(Constants.xMsEdmModelError + index++, new JsonNodeExtension(error.ToString()));
5252
}
5353

5454
return document;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Reflection;
1010
using System.Text.Json.Nodes;
1111
using Microsoft.OData.Edm;
12-
using Microsoft.OpenApi.Any;
12+
using Microsoft.OpenApi.Extensions;
1313
using Microsoft.OpenApi.Interfaces;
1414
using Microsoft.OpenApi.Models;
1515
using Microsoft.OpenApi.OData.Common;
@@ -110,7 +110,7 @@ private static string GetDescription(this ODataContext context)
110110
{
111111
{
112112
"x-ms-generated-by",
113-
new OpenApiAny(new JsonObject
113+
new JsonNodeExtension(new JsonObject
114114
{
115115
{ "toolName", "Microsoft.OpenApi.OData" },
116116
{ "toolVersion", Assembly.GetExecutingAssembly().GetName().Version?.ToString() }

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
using System.Diagnostics;
1515
using System;
1616
using System.Text.Json.Nodes;
17-
using Microsoft.OpenApi.Any;
1817
using Microsoft.OpenApi.Models.References;
1918
using Microsoft.OpenApi.Models.Interfaces;
2019
using Microsoft.OpenApi.Interfaces;
20+
using Microsoft.OpenApi.Extensions;
2121

2222
namespace Microsoft.OpenApi.OData.Generator
2323
{
@@ -195,7 +195,7 @@ public static IList<OpenApiParameter> CreateKeyParameters(this ODataContext cont
195195
};
196196

197197
parameter.Extensions ??= new Dictionary<string, IOpenApiExtension>();
198-
parameter.Extensions.Add(Constants.xMsKeyType, new OpenApiAny(entityType.Name));
198+
parameter.Extensions.Add(Constants.xMsKeyType, new JsonNodeExtension(entityType.Name));
199199
parameters.Add(parameter);
200200
}
201201
else
@@ -221,7 +221,7 @@ public static IList<OpenApiParameter> CreateKeyParameters(this ODataContext cont
221221
}
222222

223223
parameter.Extensions ??= new Dictionary<string, IOpenApiExtension>();
224-
parameter.Extensions.Add(Constants.xMsKeyType, new OpenApiAny(entityType.Name));
224+
parameter.Extensions.Add(Constants.xMsKeyType, new JsonNodeExtension(entityType.Name));
225225
parameters.Add(parameter);
226226
}
227227
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using Microsoft.OpenApi.MicrosoftExtensions;
1818
using Microsoft.OpenApi.OData.Vocabulary.Core;
1919
using System.Text.Json.Nodes;
20-
using Microsoft.OpenApi.Any;
2120
using Microsoft.OpenApi.Extensions;
2221
using Microsoft.OpenApi.Models.References;
2322
using System.Globalization;
@@ -452,7 +451,7 @@ public static Dictionary<string, IOpenApiSchema> CreateStructuredTypePropertiesS
452451
// we always want a new copy because it's a reference
453452
openApiSchema.Extensions = propertySchema.Extensions is null ? [] : new Dictionary<string, IOpenApiExtension>(propertySchema.Extensions);
454453
openApiSchema.Extensions.AddCustomAttributesToExtensions(context, property);
455-
openApiSchema.Extensions.Add(Constants.xMsNavigationProperty, new OpenApiAny(true));
454+
openApiSchema.Extensions.Add(Constants.xMsNavigationProperty, new JsonNodeExtension(true));
456455
}
457456
properties.Add(property.Name, propertySchema);
458457
}
@@ -514,7 +513,7 @@ private static OpenApiSchema CreateStructuredTypeSchema(this ODataContext contex
514513
{
515514
extension = new Dictionary<string, IOpenApiExtension>
516515
{
517-
{ Constants.xMsDiscriminatorValue, new OpenApiAny("#" + structuredType.FullTypeName()) }
516+
{ Constants.xMsDiscriminatorValue, new JsonNodeExtension("#" + structuredType.FullTypeName()) }
518517
};
519518
}
520519

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

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

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

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

6-
using Microsoft.OpenApi.Any;
6+
using Microsoft.OpenApi.Extensions;
77
using Microsoft.OpenApi.Models;
88
using Microsoft.OpenApi.Models.References;
99
using Microsoft.OpenApi.OData.Common;
@@ -41,7 +41,7 @@ protected override void SetTags(OpenApiOperation operation)
4141
operation.Tags ??= new HashSet<OpenApiTagReference>();
4242
if (!string.IsNullOrEmpty(tagName))
4343
{
44-
Context.AddExtensionToTag(tagName, Constants.xMsTocType, new OpenApiAny("page"), () => new OpenApiTag()
44+
Context.AddExtensionToTag(tagName, Constants.xMsTocType, new JsonNodeExtension("page"), () => new OpenApiTag()
4545
{
4646
Name = tagName
4747
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using System.Net.Http;
99
using System.Text.Json.Nodes;
1010
using Microsoft.OData.Edm;
11-
using Microsoft.OpenApi.Any;
11+
using Microsoft.OpenApi.Extensions;
1212
using Microsoft.OpenApi.Interfaces;
1313
using Microsoft.OpenApi.Models;
1414
using Microsoft.OpenApi.Models.Interfaces;
@@ -165,7 +165,7 @@ ComplexPropertySegment is not null &&
165165
{ "operationName", Context.Settings.PageableOperationName}
166166
};
167167
operation.Extensions ??= new Dictionary<string, IOpenApiExtension>();
168-
operation.Extensions.Add(Constants.xMsPageable, new OpenApiAny(extension));
168+
operation.Extensions.Add(Constants.xMsPageable, new JsonNodeExtension(extension));
169169

170170
base.SetExtensions(operation);
171171
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Net.Http;
1010
using Microsoft.OData.Edm;
1111
using Microsoft.OData.Edm.Vocabularies;
12-
using Microsoft.OpenApi.Any;
12+
using Microsoft.OpenApi.Extensions;
1313
using Microsoft.OpenApi.Models;
1414
using Microsoft.OpenApi.Models.References;
1515
using Microsoft.OpenApi.OData.Common;
@@ -113,7 +113,7 @@ protected override void SetTags(OpenApiOperation operation)
113113

114114
if (tagName != null && Context is not null)
115115
{
116-
Context.AddExtensionToTag(tagName, Constants.xMsTocType, new OpenApiAny("page"), () => new OpenApiTag()
116+
Context.AddExtensionToTag(tagName, Constants.xMsTocType, new JsonNodeExtension("page"), () => new OpenApiTag()
117117
{
118118
Name = tagName
119119
});

0 commit comments

Comments
 (0)