Skip to content

Commit

Permalink
Merge pull request #1816 from microsoft/vnext
Browse files Browse the repository at this point in the history
Release libs
  • Loading branch information
MaggieKimani1 committed Sep 4, 2024
2 parents 7668c28 + 5d9d099 commit afa73a4
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ extends:
version: 8.x

# Install the nuget tool.
- task: NuGetToolInstaller@0
displayName: 'Use NuGet >=5.2.0'
- task: NuGetToolInstaller@1
displayName: 'Use NuGet >=6.11.0'
inputs:
versionSpec: '>=5.2.0'
versionSpec: '>=6.11.0'
checkLatest: true

# Build the Product project
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.2" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
<!--STJ
required until Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Configuration.Json
update their dependencies -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
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.19</Version>
<Version>1.6.20</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,7 +18,10 @@
</PropertyGroup>

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

<PackageReference Include="SharpYaml" Version="2.1.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.11.20" />
<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" />
</ItemGroup>
<ItemGroup>
<Resource Include="Themes\Metro\HowToApplyTheme.txt" />
Expand Down
6 changes: 4 additions & 2 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.19</Version>
<Version>1.6.20</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,6 +37,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.11.20" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.11.20" >
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
5 changes: 2 additions & 3 deletions src/Microsoft.OpenApi/Models/OpenApiDocument.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System;
Expand Down Expand Up @@ -48,8 +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; } =
new List<OpenApiSecurityRequirement>();
public IList<OpenApiSecurityRequirement> SecurityRequirements { get; set; }

/// <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; } = new List<OpenApiSecurityRequirement>();
public IList<OpenApiSecurityRequirement> Security { get; set; }

/// <summary>
/// An alternative server array to service this operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Moq" Version="4.20.71" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly()
var targetExamples = subsetOpenApiDocument.Components.Examples;

// Assert
Assert.Same(doc.Servers, subsetOpenApiDocument.Servers);
Assert.False(responseHeader.UnresolvedReference);
Assert.False(mediaTypeExample.UnresolvedReference);
Assert.Single(targetHeaders);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ openapi: 3.0.1
info:
title: Example with Multiple Operations and Local $refs
version: 1.0.0
servers:
- url: https://api.github.com
paths:
/items:
get:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all" />
<!--STJ required until Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Configuration.Json update their dependencies -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using FluentAssertions;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Exceptions;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Readers.Interface;
Expand Down Expand Up @@ -1432,5 +1433,65 @@ 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();
}
}
}
4 changes: 2 additions & 2 deletions test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<PackageReference Include="coverlet.msbuild" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Moq" Version="4.20.71" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="Verify.Xunit" Version="26.2.0" />
<PackageReference Include="Verify.Xunit" Version="26.3.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
Expand Down

0 comments on commit afa73a4

Please sign in to comment.