Skip to content

Commit 5005122

Browse files
authored
Merge pull request #663 from microsoft/dependabot/nuget/Microsoft.OpenApi-2.0.0-preview9
chore(deps): bump Microsoft.OpenApi from 2.0.0-preview8 to 2.0.0-preview9
2 parents f2b297e + 384702c commit 5005122

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public static IOpenApiSchema CreateSchema(this ODataContext context, IEdmPrimiti
150150

151151
// Nullable properties are marked with the keyword nullable and a value of true.
152152
// nullable cannot be true when type is empty, often common in anyof/allOf since individual entries are nullable
153-
if (!string.IsNullOrEmpty(schema.Type.ToIdentifier()) && primitiveType.IsNullable)
153+
if (schema.Type.ToIdentifiers() is { Length: > 0 } && primitiveType.IsNullable)
154154
{
155155
openApiSchema.Type |= JsonSchemaType.Null;
156156
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ private static JsonNode GetTypeNameForPrimitive(ODataContext context, IEdmTypeRe
659659
}
660660
else
661661
{
662-
return schema.Type.ToIdentifier() ??
662+
return (schema.Type & ~JsonSchemaType.Null)?.ToIdentifiers()[0] ??
663663
(schema.AnyOf ?? Enumerable.Empty<IOpenApiSchema>())
664664
.Union(schema.AllOf ?? Enumerable.Empty<IOpenApiSchema>())
665665
.Union(schema.OneOf ?? Enumerable.Empty<IOpenApiSchema>())

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-preview8" />
32+
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
3333
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
3434
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.13.2">
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/OoasGui/OoasGui.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>net8.0-windows</TargetFramework>
44
<OutputType>WinExe</OutputType>
@@ -17,7 +17,7 @@
1717
<ItemGroup>
1818
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
1919
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.3" />
20-
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview8" />
20+
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
2121
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
2222
</ItemGroup>
2323
</Project>

test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ public async Task CreateComplexTypeWithBaseSchemaReturnCorrectSchema()
512512

513513
// Assert
514514
Assert.NotNull(schema);
515-
Assert.True(String.IsNullOrEmpty(schema.Type.ToIdentifier()));
515+
Assert.Null(schema.Type.ToIdentifiers());
516516

517517
Assert.NotNull(schema.AllOf);
518518
Assert.Null(schema.AnyOf);
@@ -660,7 +660,7 @@ public async Task CreateEntityTypeWithBaseSchemaReturnCorrectSchema()
660660

661661
// Assert
662662
Assert.NotNull(schema);
663-
Assert.True(String.IsNullOrEmpty(schema.Type.ToIdentifier()));
663+
Assert.Null(schema.Type.ToIdentifiers());
664664

665665
Assert.NotNull(schema.AllOf);
666666
Assert.Null(schema.AnyOf);
@@ -735,7 +735,7 @@ public void CreateEntityTypeWithCrossReferenceBaseSchemaReturnCorrectSchema()
735735

736736
// Assert
737737
Assert.NotNull(schema);
738-
Assert.True(string.IsNullOrEmpty(schema.Type.ToIdentifier()));
738+
Assert.Null(schema.Type.ToIdentifiers());
739739

740740
Assert.NotNull(schema.AllOf);
741741
Assert.Null(schema.AnyOf);

test/Microsoft.OpenAPI.OData.Reader.Tests/Microsoft.OpenAPI.OData.Reader.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8989
<PrivateAssets>all</PrivateAssets>
9090
</PackageReference>
91-
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview8" />
91+
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
9292
<PackageReference Include="moq" Version="4.20.72" />
9393
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
9494
<PackageReference Include="xunit" Version="2.9.3" />

tool/UpdateDocs/UpdateDocs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
</ItemGroup>
1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.3" />
16-
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview8" />
16+
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
1717
</ItemGroup>
1818
</Project>

0 commit comments

Comments
 (0)