Skip to content

Commit 9082e03

Browse files
authored
Merge pull request #3006 from microsoft/chore/dependencies
chore: upgrades dependencies not picked up by dependabot
2 parents dbf1f9e + 0a7c001 commit 9082e03

119 files changed

Lines changed: 943 additions & 943 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
},
77
"cSpell.words": [
88
"csdl",
9-
"Hidi"
9+
"Hidi",
10+
"Xunit"
1011
]
1112
}

performance/resultsComparer/resultsComparer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.10" />
1313
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.10" />
1414
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.10" />
15-
<PackageReference Include="System.CommandLine" Version="2.0.5" />
15+
<PackageReference Include="System.CommandLine" Version="2.0.10" />
1616
<PackageReference Include="system.text.json" Version="10.0.10" />
1717
</ItemGroup>
1818

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3838
<PrivateAssets>all</PrivateAssets>
3939
</PackageReference>
40-
<PackageReference Include="System.CommandLine" Version="2.0.5" />
40+
<PackageReference Include="System.CommandLine" Version="2.0.10" />
4141
<PackageReference Include="Microsoft.OData.Edm" Version="8.4.4" />
4242
<PackageReference Include="Microsoft.OpenApi.OData" Version="3.2.1" />
4343
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="3.0.0-preview.1" />

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121

2222
<!-- Windows-specific dependencies -->
2323
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
24-
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15">
24+
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="18.7.23">
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
<PrivateAssets>all</PrivateAssets>
2727
</PackageReference>
28-
<PackageReference Include="Microsoft.Windows.Compatibility" Version="10.0.5" />
29-
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.6" />
28+
<PackageReference Include="Microsoft.Windows.Compatibility" Version="10.0.10" />
29+
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.10" />
3030
</ItemGroup>
3131

3232
<!-- Windows-specific resources -->

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PackageReference Include="coverlet.msbuild" Version="10.0.1" PrivateAssets="all" />
1717
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.8.1" />
1818
<PackageReference Include="Moq" Version="4.20.72" />
19-
<PackageReference Include="xunit" Version="2.9.3" />
19+
<PackageReference Include="xunit.v3" Version="3.2.2" />
2020
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" PrivateAssets="all" />
2121
<PackageReference Include="coverlet.collector" Version="10.0.1" PrivateAssets="all" />
2222
</ItemGroup>

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string? oper
5151
public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection()
5252
{
5353
// Arrange
54-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver2.json");
54+
var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver2.json");
5555
var fileInput = new FileInfo(filePath);
5656
var stream = fileInput.OpenRead();
5757

@@ -158,7 +158,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl()
158158
public void ShouldParseNestedPostmanCollection()
159159
{
160160
// Arrange
161-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver3.json");
161+
var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver3.json");
162162
var fileInput = new FileInfo(filePath);
163163
var stream = fileInput.OpenRead();
164164

@@ -175,7 +175,7 @@ public void ShouldParseNestedPostmanCollection()
175175
public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument()
176176
{
177177
// Arrange
178-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver1.json");
178+
var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver1.json");
179179
var fileInput = new FileInfo(filePath);
180180
var stream = fileInput.OpenRead();
181181

@@ -192,7 +192,7 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument()
192192
public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument()
193193
{
194194
// Arrange
195-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver4.json");
195+
var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver4.json");
196196
var fileInput = new FileInfo(filePath);
197197
var stream = fileInput.OpenRead();
198198

@@ -291,14 +291,14 @@ public void CreatePredicateMatchesAbsoluteUrlsWhenSourceHasNoServers()
291291
public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly()
292292
{
293293
// Arrange
294-
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "docWithReusableHeadersAndExamples.yaml");
294+
var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "docWithReusableHeadersAndExamples.yaml");
295295
var operationIds = "getItems";
296296

297297
// Act
298298
using var stream = File.OpenRead(filePath);
299299
var settings = new OpenApiReaderSettings();
300300
settings.AddYamlReader();
301-
var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings)).Document;
301+
var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings, TestContext.Current.CancellationToken)).Document;
302302

303303
// validated the tags are read as references
304304
var openApiOperationTags = doc?.Paths["/items"].Operations?[HttpMethod.Get].Tags?.ToArray();
@@ -344,7 +344,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly(
344344
}
345345
};
346346
subsetOpenApiDocument.SerializeAsV3(writer);
347-
await writer.FlushAsync();
347+
await writer.FlushAsync(TestContext.Current.CancellationToken);
348348
var result = outputStringWriter.ToString();
349349
Assert.NotEmpty(result);
350350
}

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

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync
134134
// create a dummy ILogger instance for testing
135135
var options = new HidiOptions
136136
{
137-
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
138-
Output = new("sample.md")
137+
OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"),
138+
Output = new($"{nameof(ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync)}.md")
139139
};
140140

141-
await OpenApiService.ShowOpenApiDocumentAsync(options, _logger);
141+
await OpenApiService.ShowOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken);
142142

143-
var output = await File.ReadAllTextAsync(options.Output.FullName);
143+
var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken);
144144
Assert.Contains("graph LR", output, StringComparison.Ordinal);
145145
}
146146

@@ -149,54 +149,54 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagramAsync()
149149
{
150150
var options = new HidiOptions
151151
{
152-
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml")
152+
OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml")
153153
};
154-
var filePath = await OpenApiService.ShowOpenApiDocumentAsync(options, _logger);
154+
var filePath = await OpenApiService.ShowOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken);
155155
Assert.True(File.Exists(filePath));
156156
}
157157

158158
[Fact]
159159
public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidatingAsync()
160160
{
161161
return Assert.ThrowsAsync<ArgumentNullException>(() =>
162-
OpenApiService.ValidateOpenApiDocumentAsync("", _logger));
162+
OpenApiService.ValidateOpenApiDocumentAsync("", _logger, TestContext.Current.CancellationToken));
163163
}
164164

165165
[Fact]
166166
public Task ThrowIfURLIsNotResolvableWhenValidatingAsync()
167167
{
168168
return Assert.ThrowsAsync<InvalidOperationException>(() =>
169-
OpenApiService.ValidateOpenApiDocumentAsync("https://example.org926F4F21-88E7-4DC5-BF88-6C529BB77844/itdoesnmatter", _logger));
169+
OpenApiService.ValidateOpenApiDocumentAsync("https://example.org926F4F21-88E7-4DC5-BF88-6C529BB77844/itdoesnmatter", _logger, TestContext.Current.CancellationToken));
170170
}
171171

172172
[Fact]
173173
public Task ThrowIfFileDoesNotExistWhenValidatingAsync()
174174
{
175175
return Assert.ThrowsAsync<InvalidOperationException>(() =>
176-
OpenApiService.ValidateOpenApiDocumentAsync("aFileThatBetterNotExist.fake", _logger));
176+
OpenApiService.ValidateOpenApiDocumentAsync("aFileThatBetterNotExist.fake", _logger, TestContext.Current.CancellationToken));
177177
}
178178

179179
[Fact]
180180
public async Task ValidateCommandProcessesOpenApiAsync()
181181
{
182182
// create a dummy ILogger instance for testing
183-
await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger);
183+
await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken);
184184

185185
Assert.True(true);
186186
}
187187

188188
[Fact]
189189
public async Task ValidFileReturnsTrueAsync()
190190
{
191-
var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger);
191+
var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken);
192192

193193
Assert.True(isValid);
194194
}
195195

196196
[Fact]
197197
public async Task InvalidFileReturnsFalseAsync()
198198
{
199-
var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger);
199+
var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken);
200200

201201
Assert.False(isValid);
202202
}
@@ -206,7 +206,7 @@ public async Task CancellingValidationReturnsNullAsync()
206206
{
207207
using var cts = new CancellationTokenSource();
208208
await cts.CancelAsync();
209-
var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token);
209+
var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token);
210210

211211
Assert.Null(isValid);
212212
}
@@ -216,17 +216,17 @@ public async Task TransformCommandConvertsOpenApiAsync()
216216
{
217217
var options = new HidiOptions
218218
{
219-
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
220-
Output = new("sample.json"),
219+
OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"),
220+
Output = new($"{nameof(TransformCommandConvertsOpenApiAsync)}.json"),
221221
CleanOutput = true,
222222
TerseOutput = false,
223223
InlineLocal = false,
224224
InlineExternal = false,
225225
};
226226
// create a dummy ILogger instance for testing
227-
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger);
227+
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken);
228228

229-
var output = await File.ReadAllTextAsync("sample.json");
229+
var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken);
230230
Assert.NotEmpty(output);
231231
}
232232

@@ -236,16 +236,17 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAsync()
236236
{
237237
var options = new HidiOptions
238238
{
239-
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
239+
OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"),
240240
CleanOutput = true,
241241
TerseOutput = false,
242242
InlineLocal = false,
243243
InlineExternal = false,
244+
Output = new FileInfo($"{nameof(TransformCommandConvertsOpenApiWithDefaultOutputNameAsync)}.yml")
244245
};
245246
// create a dummy ILogger instance for testing
246-
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger);
247+
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken);
247248

248-
var output = await File.ReadAllTextAsync("output.yml");
249+
var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken);
249250
Assert.NotEmpty(output);
250251
}
251252

@@ -254,7 +255,8 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF
254255
{
255256
var options = new HidiOptions
256257
{
257-
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
258+
OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"),
259+
Output = new($"{nameof(TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormatAsync)}.yml"),
258260
CleanOutput = true,
259261
Version = "3.0",
260262
OpenApiFormat = OpenApiConstants.Yaml,
@@ -263,9 +265,9 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF
263265
InlineExternal = false,
264266
};
265267
// create a dummy ILogger instance for testing
266-
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger);
268+
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken);
267269

268-
var output = await File.ReadAllTextAsync("output.yml");
270+
var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken);
269271
Assert.NotEmpty(output);
270272
}
271273

@@ -280,16 +282,17 @@ public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmptyAsync()
280282
InlineExternal = false,
281283
};
282284
return Assert.ThrowsAsync<ArgumentException>(() =>
283-
OpenApiService.TransformOpenApiDocumentAsync(options, _logger));
285+
OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken));
284286
}
285287

286288
[Fact]
287289
public async Task TransformToPowerShellCompliantOpenApiAsync()
288290
{
289-
var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json");
291+
var settingsPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json");
290292
var options = new HidiOptions
291293
{
292-
OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"),
294+
OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"),
295+
Output = new($"{nameof(TransformToPowerShellCompliantOpenApiAsync)}.yaml"),
293296
CleanOutput = true,
294297
Version = "3.0",
295298
OpenApiFormat = OpenApiConstants.Yaml,
@@ -299,24 +302,25 @@ public async Task TransformToPowerShellCompliantOpenApiAsync()
299302
SettingsConfig = SettingsUtilities.GetConfiguration(settingsPath)
300303
};
301304
// create a dummy ILogger instance for testing
302-
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger);
305+
await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken);
303306

304-
var output = await File.ReadAllTextAsync("output.yaml");
307+
var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken);
305308
Assert.NotEmpty(output);
306309
}
307310

308311
[Fact]
309312
public async Task InvokeTransformCommandAsync()
310313
{
311314
var rootCommand = Program.CreateRootCommand();
312-
var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
313-
var args = new[] { "transform", "-d", openapi, "-o", "sample.json", "--co" };
315+
var openapi = Path.Join(".", "UtilityFiles", "SampleOpenApi.yml");
316+
var outputPath = $"{nameof(InvokeTransformCommandAsync)}.json";
317+
var args = new[] { "transform", "-d", openapi, "-o", outputPath, "--co" };
314318
var parseResult = rootCommand.Parse(args);
315319
var handler = Assert.IsType<AsynchronousCommandLineAction>(rootCommand.Subcommands.First(c => c.Name == "transform").Action, exactMatch: false);
316320

317-
await handler.InvokeAsync(parseResult);
321+
await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken);
318322

319-
var output = await File.ReadAllTextAsync("sample.json");
323+
var output = await File.ReadAllTextAsync(outputPath, TestContext.Current.CancellationToken);
320324
Assert.NotEmpty(output);
321325
}
322326

@@ -325,29 +329,31 @@ public async Task InvokeTransformCommandAsync()
325329
public async Task InvokeShowCommandAsync()
326330
{
327331
var rootCommand = Program.CreateRootCommand();
328-
var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
329-
var args = new[] { "show", "-d", openApi, "-o", "sample.md" };
332+
var openApi = Path.Join(".", "UtilityFiles", "SampleOpenApi.yml");
333+
var outputPath = $"{nameof(InvokeShowCommandAsync)}.md";
334+
var args = new[] { "show", "-d", openApi, "-o", outputPath };
330335
var parseResult = rootCommand.Parse(args);
331336
var handler = Assert.IsType<AsynchronousCommandLineAction>(rootCommand.Subcommands.First(c => c.Name == "show").Action, exactMatch: false);
332337

333-
await handler.InvokeAsync(parseResult);
338+
await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken);
334339

335-
var output = await File.ReadAllTextAsync("sample.md");
340+
var output = await File.ReadAllTextAsync(outputPath, TestContext.Current.CancellationToken);
336341
Assert.Contains("graph LR", output, StringComparison.Ordinal);
337342
}
338343

339344
[Fact]
340345
public async Task InvokePluginCommandAsync()
341346
{
342347
var rootCommand = Program.CreateRootCommand();
343-
var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json");
344-
var args = new[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory };
348+
var manifest = Path.Join(".", "UtilityFiles", "exampleapimanifest.json");
349+
var outputPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, nameof(InvokePluginCommandAsync));
350+
var args = new[] { "plugin", "-m", manifest, "--of", outputPath };
345351
var parseResult = rootCommand.Parse(args);
346352
var handler = Assert.IsType<AsynchronousCommandLineAction>(rootCommand.Subcommands.First(c => c.Name == "plugin").Action, exactMatch: false);
347353

348-
await handler.InvokeAsync(parseResult);
354+
await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken);
349355

350-
using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync("ai-plugin.json"));
356+
using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Join(outputPath, "ai-plugin.json"), TestContext.Current.CancellationToken));
351357
var openAiManifest = OpenAIPluginManifest.Load(jsDoc.RootElement);
352358

353359
Assert.NotNull(openAiManifest);

0 commit comments

Comments
 (0)