Skip to content

Commit fd202c7

Browse files
authored
Merge pull request #2014 from microsoft/chore/v1-sync
chore/v1 sync
2 parents 83ac7f0 + 6553f30 commit fd202c7

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
4141
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.3" />
4242
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.7" />
43-
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
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;
@@ -85,7 +86,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog
8586
var apiDependency = await FindApiDependencyAsync(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false);
8687
if (apiDependency != null)
8788
{
88-
options.OpenApi = apiDependency.ApiDescripionUrl;
89+
options.OpenApi = apiDependency.ApiDescriptionUrl;
8990
}
9091

9192
// If Postman Collection is provided, load it
@@ -745,7 +746,7 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg
745746
var apiDependency = await FindApiDependencyAsync(options.FilterOptions?.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false);
746747
if (apiDependency != null)
747748
{
748-
options.OpenApi = apiDependency.ApiDescripionUrl;
749+
options.OpenApi = apiDependency.ApiDescriptionUrl;
749750
}
750751

751752
// Load OpenAPI document
@@ -771,15 +772,11 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg
771772
WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_1, document, logger);
772773

773774
// Create OpenAIPluginManifest from ApiDependency and OpenAPI document
774-
var manifest = new OpenAIPluginManifest
775+
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")
775776
{
776-
NameForHuman = document.Info.Title,
777-
DescriptionForHuman = document.Info.Description,
778-
Api = new()
779-
{
780-
Type = "openapi",
781-
Url = "./openapi.json"
782-
}
777+
DescriptionForHuman = document.Info?.Description ?? "Description placeholder",
778+
Api = new("openapi", "./openapi.json"),
779+
Auth = new ManifestNoAuth(),
783780
};
784781
manifest.NameForModel = manifest.NameForHuman;
785782
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
@@ -335,7 +335,7 @@ public async Task InvokeShowCommandAsync()
335335
var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
336336
var args = new[] { "show", "-d", openApi, "-o", "sample.md" };
337337
var parseResult = rootCommand.Parse(args);
338-
var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler;
338+
var handler = rootCommand.Subcommands.First(c => c.Name == "show").Handler;
339339
var context = new InvocationContext(parseResult);
340340

341341
await handler!.InvokeAsync(context);
@@ -351,7 +351,7 @@ public async Task InvokePluginCommandAsync()
351351
var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json");
352352
var args = new[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory };
353353
var parseResult = rootCommand.Parse(args);
354-
var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler;
354+
var handler = rootCommand.Subcommands.First(c => c.Name == "plugin").Handler;
355355
var context = new InvocationContext(parseResult);
356356

357357
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)