Skip to content

Commit 137a456

Browse files
Merge pull request #1296 from microsoft/vnext
Release v1.6.6
2 parents ffb9bd0 + 8d41a27 commit 137a456

15 files changed

+793
-43
lines changed

.github/workflows/docker.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ jobs:
3030
id: getversion
3131
- name: Push to GitHub Packages - Nightly
3232
if: ${{ github.ref == 'refs/heads/vnext' }}
33-
uses: docker/[email protected].0
33+
uses: docker/[email protected].1
3434
with:
3535
push: true
3636
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
3737
- name: Push to GitHub Packages - Release
3838
if: ${{ github.ref == 'refs/heads/master' }}
39-
uses: docker/[email protected].0
39+
uses: docker/[email protected].1
4040
with:
4141
push: true
4242
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}

src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PackageId>Microsoft.OpenApi.Hidi</PackageId>
1616
<ToolCommandName>hidi</ToolCommandName>
1717
<PackageOutputPath>./../../artifacts</PackageOutputPath>
18-
<Version>1.2.5</Version>
18+
<Version>1.2.6</Version>
1919
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
2020
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
2121
<PackageTags>OpenAPI .NET</PackageTags>
@@ -43,7 +43,7 @@
4343
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
4444
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
4545
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
46-
<PackageReference Include="Microsoft.OData.Edm" Version="7.16.0" />
46+
<PackageReference Include="Microsoft.OData.Edm" Version="7.17.0" />
4747
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.5.0-preview2" />
4848
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
4949
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />

src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Company>Microsoft</Company>
1111
<Title>Microsoft.OpenApi.Readers</Title>
1212
<PackageId>Microsoft.OpenApi.Readers</PackageId>
13-
<Version>1.6.5</Version>
13+
<Version>1.6.6</Version>
1414
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
1515
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
1616
<PackageTags>OpenAPI .NET</PackageTags>

src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
66
<UseWPF>true</UseWPF>
77
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
8+
<EnableWindowsTargeting>true</EnableWindowsTargeting>
89
</PropertyGroup>
910
<ItemGroup>
1011
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
1112
<PrivateAssets>all</PrivateAssets>
1213
</PackageReference>
13-
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.3" />
14+
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.4" />
1415
</ItemGroup>
1516
<ItemGroup>
1617
<Resource Include="Themes\Metro\HowToApplyTheme.txt" />

src/Microsoft.OpenApi/Microsoft.OpenApi.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Company>Microsoft</Company>
1212
<Title>Microsoft.OpenApi</Title>
1313
<PackageId>Microsoft.OpenApi</PackageId>
14-
<Version>1.6.5</Version>
14+
<Version>1.6.6</Version>
1515
<Description>.NET models with JSON and YAML writers for OpenAPI specification</Description>
1616
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
1717
<PackageTags>OpenAPI .NET</PackageTags>

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

+15-3
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,18 @@ public void SerializeAsV2(IOpenApiWriter writer)
290290
writer.WriteEndObject();
291291
}
292292

293+
private static string ParseServerUrl(OpenApiServer server)
294+
{
295+
var parsedUrl = server.Url;
296+
297+
var variables = server.Variables;
298+
foreach (var variable in variables.Where(static x => !string.IsNullOrEmpty(x.Value.Default)))
299+
{
300+
parsedUrl = parsedUrl.Replace($"{{{variable.Key}}}", variable.Value.Default);
301+
}
302+
return parsedUrl;
303+
}
304+
293305
private static void WriteHostInfoV2(IOpenApiWriter writer, IList<OpenApiServer> servers)
294306
{
295307
if (servers == null || !servers.Any())
@@ -299,11 +311,11 @@ private static void WriteHostInfoV2(IOpenApiWriter writer, IList<OpenApiServer>
299311

300312
// Arbitrarily choose the first server given that V2 only allows
301313
// one host, port, and base path.
302-
var firstServer = servers.First();
314+
var serverUrl = ParseServerUrl(servers.First());
303315

304316
// Divide the URL in the Url property into host and basePath required in OpenAPI V2
305317
// The Url property cannotcontain path templating to be valid for V2 serialization.
306-
var firstServerUrl = new Uri(firstServer.Url, UriKind.RelativeOrAbsolute);
318+
var firstServerUrl = new Uri(serverUrl, UriKind.RelativeOrAbsolute);
307319

308320
// host
309321
if (firstServerUrl.IsAbsoluteUri)
@@ -337,7 +349,7 @@ private static void WriteHostInfoV2(IOpenApiWriter writer, IList<OpenApiServer>
337349
var schemes = servers.Select(
338350
s =>
339351
{
340-
Uri.TryCreate(s.Url, UriKind.RelativeOrAbsolute, out var url);
352+
Uri.TryCreate(ParseServerUrl(s), UriKind.RelativeOrAbsolute, out var url);
341353
return url;
342354
})
343355
.Where(

test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj

+4-4
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

33
<PropertyGroup>
44
<TargetFramework>net7.0</TargetFramework>
@@ -13,10 +13,10 @@
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
1717
<PackageReference Include="Moq" Version="4.18.4" />
18-
<PackageReference Include="xunit" Version="2.4.2" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
18+
<PackageReference Include="xunit" Version="2.5.0" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
<PrivateAssets>all</PrivateAssets>
2222
</PackageReference>

test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string opera
5151
public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection()
5252
{
5353
// Arrange
54-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver2.json");
54+
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver2.json");
5555
var fileInput = new FileInfo(filePath);
5656
var stream = fileInput.OpenRead();
5757

@@ -107,7 +107,7 @@ public void TestPredicateFiltersUsingRelativeRequestUrls()
107107
public void ShouldParseNestedPostmanCollection()
108108
{
109109
// Arrange
110-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver3.json");
110+
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver3.json");
111111
var fileInput = new FileInfo(filePath);
112112
var stream = fileInput.OpenRead();
113113

@@ -124,7 +124,7 @@ public void ShouldParseNestedPostmanCollection()
124124
public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument()
125125
{
126126
// Arrange
127-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver1.json");
127+
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver1.json");
128128
var fileInput = new FileInfo(filePath);
129129
var stream = fileInput.OpenRead();
130130

@@ -141,7 +141,7 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument()
141141
public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument()
142142
{
143143
// Arrange
144-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver4.json");
144+
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver4.json");
145145
var fileInput = new FileInfo(filePath);
146146
var stream = fileInput.OpenRead();
147147

test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs

+18-15
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public OpenApiServiceTests()
3030
public async Task ReturnConvertedCSDLFile()
3131
{
3232
// Arrange
33-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml");
33+
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml");
3434
var fileInput = new FileInfo(filePath);
3535
var csdlStream = fileInput.OpenRead();
3636
// Act
@@ -50,7 +50,7 @@ public async Task ReturnConvertedCSDLFile()
5050
public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount)
5151
{
5252
// Arrange
53-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml");
53+
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml");
5454
var fileInput = new FileInfo(filePath);
5555
var csdlStream = fileInput.OpenRead();
5656

@@ -137,7 +137,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram()
137137
// create a dummy ILogger instance for testing
138138
var options = new HidiOptions()
139139
{
140-
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
140+
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
141141
Output = new FileInfo("sample.md")
142142
};
143143

@@ -152,7 +152,7 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram()
152152
{
153153
var options = new HidiOptions()
154154
{
155-
OpenApi = "UtilityFiles\\SampleOpenApi.yml"
155+
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml")
156156
};
157157
var filePath = await OpenApiService.ShowOpenApiDocument(options, _logger, new CancellationToken());
158158
Assert.True(File.Exists(filePath));
@@ -163,7 +163,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag
163163
{
164164
var options = new HidiOptions()
165165
{
166-
Csdl = "UtilityFiles\\Todo.xml",
166+
Csdl = Path.Combine("UtilityFiles", "Todo.xml"),
167167
CsdlFilter = "todos",
168168
Output = new FileInfo("sample.md")
169169
};
@@ -201,7 +201,7 @@ await Assert.ThrowsAsync<InvalidOperationException>(async () =>
201201
public async Task ValidateCommandProcessesOpenApi()
202202
{
203203
// create a dummy ILogger instance for testing
204-
await OpenApiService.ValidateOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", _logger, new CancellationToken());
204+
await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, new CancellationToken());
205205

206206
Assert.True(true);
207207
}
@@ -212,7 +212,7 @@ public async Task TransformCommandConvertsOpenApi()
212212
{
213213
HidiOptions options = new HidiOptions
214214
{
215-
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
215+
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
216216
Output = new FileInfo("sample.json"),
217217
CleanOutput = true,
218218
TerseOutput = false,
@@ -232,7 +232,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputname()
232232
{
233233
HidiOptions options = new HidiOptions
234234
{
235-
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
235+
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
236236
CleanOutput = true,
237237
TerseOutput = false,
238238
InlineLocal = false,
@@ -250,7 +250,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputname()
250250
{
251251
HidiOptions options = new HidiOptions
252252
{
253-
Csdl = "UtilityFiles\\Todo.xml",
253+
Csdl = Path.Combine("UtilityFiles", "Todo.xml"),
254254
CleanOutput = true,
255255
TerseOutput = false,
256256
InlineLocal = false,
@@ -268,7 +268,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchF
268268
{
269269
HidiOptions options = new HidiOptions
270270
{
271-
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
271+
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
272272
CleanOutput = true,
273273
Version = "3.0",
274274
OpenApiFormat = OpenApiFormat.Yaml,
@@ -301,10 +301,10 @@ await Assert.ThrowsAsync<ArgumentException>(async () =>
301301
[Fact]
302302
public async Task TransformToPowerShellCompliantOpenApi()
303303
{
304-
var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\examplepowershellsettings.json");
304+
var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json");
305305
HidiOptions options = new HidiOptions
306306
{
307-
OpenApi = "UtilityFiles\\SampleOpenApi.yml",
307+
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
308308
CleanOutput = true,
309309
Version = "3.0",
310310
OpenApiFormat = OpenApiFormat.Yaml,
@@ -324,7 +324,8 @@ public async Task TransformToPowerShellCompliantOpenApi()
324324
public void InvokeTransformCommand()
325325
{
326326
var rootCommand = Program.CreateRootCommand();
327-
var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json", "--co" };
327+
var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
328+
var args = new string[] { "transform", "-d", openapi, "-o", "sample.json", "--co" };
328329
var parseResult = rootCommand.Parse(args);
329330
var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler;
330331
var context = new InvocationContext(parseResult);
@@ -340,7 +341,8 @@ public void InvokeTransformCommand()
340341
public void InvokeShowCommand()
341342
{
342343
var rootCommand = Program.CreateRootCommand();
343-
var args = new string[] { "show", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.md" };
344+
var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
345+
var args = new string[] { "show", "-d", openapi, "-o", "sample.md" };
344346
var parseResult = rootCommand.Parse(args);
345347
var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler;
346348
var context = new InvocationContext(parseResult);
@@ -355,7 +357,8 @@ public void InvokeShowCommand()
355357
public void InvokePluginCommand()
356358
{
357359
var rootCommand = Program.CreateRootCommand();
358-
var args = new string[] { "plugin", "-m", ".\\UtilityFiles\\exampleapimanifest.json", "--of", AppDomain.CurrentDomain.BaseDirectory };
360+
var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json");
361+
var args = new string[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory };
359362
var parseResult = rootCommand.Parse(args);
360363
var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler;
361364
var context = new InvocationContext(parseResult);

test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,16 @@
268268
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
269269
<PrivateAssets>all</PrivateAssets>
270270
</PackageReference>
271-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
271+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
272272
<PackageReference Include="FluentAssertions" Version="6.11.0">
273273
</PackageReference>
274274
<PackageReference Include="Newtonsoft.Json" Version="13.0.3">
275275
</PackageReference>
276276
<PackageReference Include="SharpYaml" Version="2.1.0">
277277
</PackageReference>
278-
<PackageReference Include="xunit" Version="2.4.2">
278+
<PackageReference Include="xunit" Version="2.5.0">
279279
</PackageReference>
280-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
280+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
281281
<PrivateAssets>all</PrivateAssets>
282282
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
283283
</PackageReference>

test/Microsoft.OpenApi.SmokeTests/Microsoft.OpenApi.SmokeTests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
<PrivateAssets>all</PrivateAssets>
1818
</PackageReference>
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
2020
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
21-
<PackageReference Include="xunit" Version="2.4.2" />
22-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
21+
<PackageReference Include="xunit" Version="2.5.0" />
22+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
</PackageReference>

test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
<PrivateAssets>all</PrivateAssets>
2525
</PackageReference>
2626
<PackageReference Include="FluentAssertions" Version="6.11.0" />
27-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
27+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
2828
<PackageReference Include="Moq" Version="4.18.4" />
2929
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
3030
<PackageReference Include="SharpYaml" Version="2.1.0" />
31-
<PackageReference Include="Verify.Xunit" Version="20.3.2" />
32-
<PackageReference Include="xunit" Version="2.4.2" />
33-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
31+
<PackageReference Include="Verify.Xunit" Version="20.5.1" />
32+
<PackageReference Include="xunit" Version="2.5.0" />
33+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
3434
<PrivateAssets>all</PrivateAssets>
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3636
</PackageReference>

0 commit comments

Comments
 (0)