Skip to content

Commit

Permalink
Merge pull request #1822 from microsoft/vnext
Browse files Browse the repository at this point in the history
Release libs
  • Loading branch information
MaggieKimani1 authored Sep 5, 2024
2 parents afa73a4 + 0ae4031 commit ef58bf6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 70 deletions.
5 changes: 4 additions & 1 deletion src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.11.20" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="8.0.1" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.20</Version>
<Version>1.6.21</Version>
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -18,8 +18,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.11.20">
<PrivateAssets>all</PrivateAssets>

<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

<PackageReference Include="SharpYaml" Version="2.1.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.11.20" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.8" />
<!-- Microsoft.Windows.Compatibility 8.0.8 depends on 8.0.0 this dependency can be removed once they update theirs -->
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
Expand Down
7 changes: 4 additions & 3 deletions src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.20</Version>
<Version>1.6.21</Version>
<Description>.NET models with JSON and YAML writers for OpenAPI specification</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand Down Expand Up @@ -37,8 +37,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.11.20" >
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Models/OpenApiDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class OpenApiDocument : IOpenApiSerializable, IOpenApiExtensible, IOpenAp
/// <summary>
/// A declaration of which security mechanisms can be used across the API.
/// </summary>
public IList<OpenApiSecurityRequirement> SecurityRequirements { get; set; }
public IList<OpenApiSecurityRequirement> SecurityRequirements { get; set; } = new List<OpenApiSecurityRequirement>();

/// <summary>
/// A list of tags used by the specification with additional metadata.
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Models/OpenApiOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class OpenApiOperation : IOpenApiSerializable, IOpenApiExtensible, IOpenA
/// This definition overrides any declared top-level security.
/// To remove a top-level security declaration, an empty array can be used.
/// </summary>
public IList<OpenApiSecurityRequirement> Security { get; set; }
public IList<OpenApiSecurityRequirement> Security { get; set; } = new List<OpenApiSecurityRequirement>();

/// <summary>
/// An alternative server array to service this operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1433,65 +1433,5 @@ public void ParseBasicDocumentWithServerVariableAndNoDefaultShouldFail()

diagnostic.Errors.Should().NotBeEmpty();
}

[Fact]
public void ParseDocumentWithMissingSecuritySchemeDefaultsToNull()
{
// Arrange
var input = @"openapi: 3.0.0
info:
title: test
version: ""1.0""
paths:
/test:
get:
description: description for test path
responses:
'200':
description: test
components:
securitySchemes:
apiKey0:
type: apiKey,
name: x-api-key,
in: header";

// Act && Assert
var doc = new OpenApiStringReader().Read(input, out var diagnostic);

doc.Paths["/test"].Operations[OperationType.Get].Security.Should().BeNull();
doc.SecurityRequirements.Should().BeNull();
}

[Fact]
public void ParseDocumentWithEmptySecuritySchemeDefaultsToEmptyList()
{
// Arrange
var input = @"openapi: 3.0.0
info:
title: test
version: ""1.0""
paths:
/test:
get:
description: description for test path
responses:
'200':
description: test
security: []
security:
- apiKey0: []
components:
securitySchemes:
apiKey0:
type: apiKey,
name: x-api-key,
in: header";

// Act && Assert
var doc = new OpenApiStringReader().Read(input, out var diagnostic);

doc.Paths["/test"].Operations[OperationType.Get].Security.Should().BeEmpty();
}
}
}

0 comments on commit ef58bf6

Please sign in to comment.