Skip to content

Commit

Permalink
Merge pull request #1481 from microsoft/mk/fix-hidi-relative-path
Browse files Browse the repository at this point in the history
Configure Hidi --settings-file path to be relative to the current working directory
  • Loading branch information
MaggieKimani1 authored Nov 22, 2023
2 parents d06a89d + 85dafb5 commit 9037ca4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 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.3.5</Version>
<Version>1.3.6</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 Down
11 changes: 8 additions & 3 deletions src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System.IO;
using Microsoft.Extensions.Configuration;
using Microsoft.OpenApi.OData;

Expand All @@ -11,15 +12,19 @@ internal static class SettingsUtilities
internal static IConfiguration GetConfiguration(string? settingsFile = null)
{
if (string.IsNullOrEmpty(settingsFile))
{
settingsFile = "appsettings.json";
}

var settingsFilePath = Path.Combine(Directory.GetCurrentDirectory(), settingsFile);

IConfiguration config = new ConfigurationBuilder()
.AddJsonFile(settingsFile, true)
.Build();
.AddJsonFile(settingsFilePath, true)
.Build();

return config;
}

internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion)
{
if (config == null) { throw new System.ArgumentNullException(nameof(config)); }
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.10</Version>
<Version>1.6.11</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 Down
2 changes: 1 addition & 1 deletion 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.10</Version>
<Version>1.6.11</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

0 comments on commit 9037ca4

Please sign in to comment.