Skip to content

Commit d6d5e89

Browse files
authored
Merge pull request #2012 from microsoft/chore/hidi-maintenance
chore/hidi maintenance
2 parents 687a5f6 + def760e commit d6d5e89

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
<PrivateAssets>all</PrivateAssets>
3939
</PackageReference>
4040
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
41-
<PackageReference Include="Microsoft.OData.Edm" Version="8.0.1" />
42-
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.2" />
43-
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
41+
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.3" />
42+
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.7" />
43+
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.6-preview" />
4444
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
4545
<!--STJ
4646
required until Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Configuration.Json

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using Microsoft.OData.Edm.Csdl;
2323
using Microsoft.OpenApi.ApiManifest;
2424
using Microsoft.OpenApi.ApiManifest.OpenAI;
25+
using Microsoft.OpenApi.ApiManifest.OpenAI.Authentication;
2526
using Microsoft.OpenApi.Extensions;
2627
using Microsoft.OpenApi.Hidi.Extensions;
2728
using Microsoft.OpenApi.Hidi.Formatters;
@@ -73,7 +74,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog
7374
var apiDependency = await FindApiDependencyAsync(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false);
7475
if (apiDependency != null)
7576
{
76-
options.OpenApi = apiDependency.ApiDescripionUrl;
77+
options.OpenApi = apiDependency.ApiDescriptionUrl;
7778
}
7879

7980
// If Postman Collection is provided, load it
@@ -728,7 +729,7 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg
728729
var apiDependency = await FindApiDependencyAsync(options.FilterOptions?.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false);
729730
if (apiDependency != null)
730731
{
731-
options.OpenApi = apiDependency.ApiDescripionUrl;
732+
options.OpenApi = apiDependency.ApiDescriptionUrl;
732733
}
733734

734735
// Load OpenAPI document
@@ -753,15 +754,11 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg
753754
WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_0, document, logger);
754755

755756
// Create OpenAIPluginManifest from ApiDependency and OpenAPI document
756-
var manifest = new OpenAIPluginManifest
757+
var manifest = new OpenAIPluginManifest(document.Info?.Title ?? "Title", document.Info?.Title ?? "Title", "https://go.microsoft.com/fwlink/?LinkID=288890", document.Info?.Contact?.Email ?? "[email protected]", document.Info?.License?.Url.ToString() ?? "https://placeholderlicenseurl.com")
757758
{
758-
NameForHuman = document.Info.Title,
759-
DescriptionForHuman = document.Info.Description,
760-
Api = new()
761-
{
762-
Type = "openapi",
763-
Url = "./openapi.json"
764-
}
759+
DescriptionForHuman = document.Info?.Description ?? "Description placeholder",
760+
Api = new("openapi", "./openapi.json"),
761+
Auth = new ManifestNoAuth(),
765762
};
766763
manifest.NameForModel = manifest.NameForHuman;
767764
manifest.DescriptionForModel = manifest.DescriptionForHuman;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public async Task InvokeShowCommandAsync()
405405
var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
406406
var args = new[] { "show", "-d", openApi, "-o", "sample.md" };
407407
var parseResult = rootCommand.Parse(args);
408-
var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler;
408+
var handler = rootCommand.Subcommands.First(c => c.Name == "show").Handler;
409409
var context = new InvocationContext(parseResult);
410410

411411
await handler!.InvokeAsync(context);
@@ -421,7 +421,7 @@ public async Task InvokePluginCommandAsync()
421421
var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json");
422422
var args = new[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory };
423423
var parseResult = rootCommand.Parse(args);
424-
var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler;
424+
var handler = rootCommand.Subcommands.First(c => c.Name == "plugin").Handler;
425425
var context = new InvocationContext(parseResult);
426426

427427
await handler!.InvokeAsync(context);

test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/exampleapimanifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
2+
"applicationName": "Example API",
23
"publisher": {
34
"name": "Alice",
45
"contactEmail": "[email protected]"
56
},
67
"apiDependencies": {
78
"moostodon" : {
8-
"apiDescripionUrl": "https://raw.githubusercontent.com/APIPatterns/Moostodon/main/spec/tsp-output/%40typespec/openapi3/openapi.yaml",
9+
"apiDescriptionUrl": "https://raw.githubusercontent.com/APIPatterns/Moostodon/main/spec/tsp-output/%40typespec/openapi3/openapi.yaml",
910
"auth": {
1011
"clientIdentifier": "some-uuid-here",
1112
"access": [ "resourceA.ReadWrite",

0 commit comments

Comments
 (0)