Skip to content

Commit

Permalink
Merge pull request #1802 from microsoft/vnext
Browse files Browse the repository at this point in the history
Release hidi and libs
  • Loading branch information
MaggieKimani1 authored Aug 30, 2024
2 parents ea7dcd0 + ef4de8b commit 7668c28
Show file tree
Hide file tree
Showing 164 changed files with 535 additions and 1,022 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extends:
arguments: '--configuration $(BuildConfiguration) --no-build'

- task: EsrpCodeSigning@5
displayName: 'ESRP CodeSigning binaries'
inputs:
ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection'
AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8'
Expand All @@ -87,8 +88,6 @@ extends:
AuthCertName: 'ReferenceLibraryPrivateCert'
AuthSignCertName: 'ReferencePackagePublisherCertificate'
FolderPath: '$(Build.SourcesDirectory)\src'
Pattern: '*.dll'
UseMinimatch: true
signConfigType: 'inlineSignParams'
inlineOperation: |
[
Expand Down Expand Up @@ -146,6 +145,7 @@ extends:
displayName: 'pack Hidi'

- task: EsrpCodeSigning@5
displayName: 'ESRP CodeSigning Nuget Packages'
inputs:
ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection'
AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8'
Expand Down
7 changes: 0 additions & 7 deletions Microsoft.OpenApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E546B92F-20A
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6357D7FD-2DE4-4900-ADB9-ABC37052040A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.SmokeTests", "test\Microsoft.OpenApi.SmokeTests\Microsoft.OpenApi.SmokeTests.csproj", "{AD79B61D-88CF-497C-9ED5-41AE3867C5AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Hidi", "src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj", "{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi.Tests", "test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj", "{D8F799DD-04AC-4A13-B344-45A5B944450A}"
Expand Down Expand Up @@ -58,10 +56,6 @@ Global
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.Build.0 = Release|Any CPU
{AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Release|Any CPU.Build.0 = Release|Any CPU
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -84,7 +78,6 @@ Global
{79933258-0126-4382-8755-D50820ECC483} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1}
{AD83F991-DBF3-4251-8613-9CC54C826964} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
{AD79B61D-88CF-497C-9ED5-41AE3867C5AC} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1}
{D8F799DD-04AC-4A13-B344-45A5B944450A} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
{1D2E0C6E-B103-4CB6-912E-D56FA1501296} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
Expand Down
14 changes: 14 additions & 0 deletions src/Microsoft.OpenApi.Hidi/Handlers/AsyncCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.CommandLine.Invocation;
using System.Threading.Tasks;

namespace Microsoft.OpenApi.Hidi.Handlers;

internal abstract class AsyncCommandHandler : ICommandHandler
{
public int Invoke(InvocationContext context)
{
throw new InvalidOperationException("This method should not be called");
}
public abstract Task<int> InvokeAsync(InvocationContext context);
}
10 changes: 3 additions & 7 deletions src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@

namespace Microsoft.OpenApi.Hidi.Handlers
{
internal class PluginCommandHandler : ICommandHandler
internal class PluginCommandHandler : AsyncCommandHandler
{
public CommandOptions CommandOptions { get; }
public PluginCommandHandler(CommandOptions commandOptions)
{
CommandOptions = commandOptions;
}
public int Invoke(InvocationContext context)
{
return InvokeAsync(context).GetAwaiter().GetResult();
}
public async Task<int> InvokeAsync(InvocationContext context)
public override async Task<int> InvokeAsync(InvocationContext context)
{
var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions);
var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken));
Expand All @@ -31,7 +27,7 @@ public async Task<int> InvokeAsync(InvocationContext context)
var logger = loggerFactory.CreateLogger<PluginCommandHandler>();
try
{
await OpenApiService.PluginManifest(hidiOptions, logger, cancellationToken).ConfigureAwait(false);
await OpenApiService.PluginManifestAsync(hidiOptions, logger, cancellationToken).ConfigureAwait(false);

return 0;
}
Expand Down
10 changes: 3 additions & 7 deletions src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@

namespace Microsoft.OpenApi.Hidi.Handlers
{
internal class ShowCommandHandler : ICommandHandler
internal class ShowCommandHandler : AsyncCommandHandler
{
public CommandOptions CommandOptions { get; set; }
public ShowCommandHandler(CommandOptions commandOptions)
{
CommandOptions = commandOptions;
}
public int Invoke(InvocationContext context)
{
return InvokeAsync(context).GetAwaiter().GetResult();
}
public async Task<int> InvokeAsync(InvocationContext context)
public override async Task<int> InvokeAsync(InvocationContext context)
{
var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions);
var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken));
Expand All @@ -31,7 +27,7 @@ public async Task<int> InvokeAsync(InvocationContext context)
var logger = loggerFactory.CreateLogger<ShowCommandHandler>();
try
{
await OpenApiService.ShowOpenApiDocument(hidiOptions, logger, cancellationToken).ConfigureAwait(false);
await OpenApiService.ShowOpenApiDocumentAsync(hidiOptions, logger, cancellationToken).ConfigureAwait(false);

return 0;
}
Expand Down
10 changes: 3 additions & 7 deletions src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@

namespace Microsoft.OpenApi.Hidi.Handlers
{
internal class TransformCommandHandler : ICommandHandler
internal class TransformCommandHandler : AsyncCommandHandler
{
public CommandOptions CommandOptions { get; }
public TransformCommandHandler(CommandOptions commandOptions)
{
CommandOptions = commandOptions;
}
public int Invoke(InvocationContext context)
{
return InvokeAsync(context).GetAwaiter().GetResult();
}
public async Task<int> InvokeAsync(InvocationContext context)
public override async Task<int> InvokeAsync(InvocationContext context)
{
var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions);
var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken));
Expand All @@ -31,7 +27,7 @@ public async Task<int> InvokeAsync(InvocationContext context)
var logger = loggerFactory.CreateLogger<TransformCommandHandler>();
try
{
await OpenApiService.TransformOpenApiDocument(hidiOptions, logger, cancellationToken).ConfigureAwait(false);
await OpenApiService.TransformOpenApiDocumentAsync(hidiOptions, logger, cancellationToken).ConfigureAwait(false);

return 0;
}
Expand Down
11 changes: 3 additions & 8 deletions src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,15 @@

namespace Microsoft.OpenApi.Hidi.Handlers
{
internal class ValidateCommandHandler : ICommandHandler
internal class ValidateCommandHandler : AsyncCommandHandler
{
public CommandOptions CommandOptions { get; }

public ValidateCommandHandler(CommandOptions commandOptions)
{
CommandOptions = commandOptions;
}

public int Invoke(InvocationContext context)
{
return InvokeAsync(context).GetAwaiter().GetResult();
}
public async Task<int> InvokeAsync(InvocationContext context)
public override async Task<int> InvokeAsync(InvocationContext context)
{
var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions);
var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken));
Expand All @@ -33,7 +28,7 @@ public async Task<int> InvokeAsync(InvocationContext context)
try
{
if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required");
var isValid = await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false);
var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false);
return isValid is not false ? 0 : -1;
}
#if RELEASE
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Nullable>enable</Nullable>
<ToolCommandName>hidi</ToolCommandName>
<PackageOutputPath>./../../artifacts</PackageOutputPath>
<Version>1.4.8</Version>
<Version>1.4.9</Version>
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -33,6 +33,7 @@
<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="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
Loading

0 comments on commit 7668c28

Please sign in to comment.