Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="8.0.1" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.2" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.3" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.7" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.6-preview" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
<!--STJ
required until Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Configuration.Json
Expand Down
17 changes: 7 additions & 10 deletions src/Microsoft.OpenApi.Hidi/OpenApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Microsoft.OData.Edm.Csdl;
using Microsoft.OpenApi.ApiManifest;
using Microsoft.OpenApi.ApiManifest.OpenAI;
using Microsoft.OpenApi.ApiManifest.OpenAI.Authentication;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Hidi.Extensions;
using Microsoft.OpenApi.Hidi.Formatters;
Expand Down Expand Up @@ -73,7 +74,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog
var apiDependency = await FindApiDependencyAsync(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false);
if (apiDependency != null)
{
options.OpenApi = apiDependency.ApiDescripionUrl;
options.OpenApi = apiDependency.ApiDescriptionUrl;
}

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

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

// Create OpenAIPluginManifest from ApiDependency and OpenAPI document
var manifest = new OpenAIPluginManifest
var manifest = new OpenAIPluginManifest(document.Info?.Title ?? "Title", document.Info?.Title ?? "Title", "https://go.microsoft.com/fwlink/?LinkID=288890", document.Info?.Contact?.Email ?? "placeholder@contoso.com", document.Info?.License?.Url.ToString() ?? "https://placeholderlicenseurl.com")
{
NameForHuman = document.Info.Title,
DescriptionForHuman = document.Info.Description,
Api = new()
{
Type = "openapi",
Url = "./openapi.json"
}
DescriptionForHuman = document.Info?.Description ?? "Description placeholder",
Api = new("openapi", "./openapi.json"),
Auth = new ManifestNoAuth(),
};
manifest.NameForModel = manifest.NameForHuman;
manifest.DescriptionForModel = manifest.DescriptionForHuman;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public async Task InvokeShowCommandAsync()
var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml");
var args = new[] { "show", "-d", openApi, "-o", "sample.md" };
var parseResult = rootCommand.Parse(args);
var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler;
var handler = rootCommand.Subcommands.First(c => c.Name == "show").Handler;
var context = new InvocationContext(parseResult);

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

await handler!.InvokeAsync(context);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"applicationName": "Example API",
"publisher": {
"name": "Alice",
"contactEmail": "alice@example.org"
},
"apiDependencies": {
"moostodon" : {
"apiDescripionUrl": "https://raw.githubusercontent.com/APIPatterns/Moostodon/main/spec/tsp-output/%40typespec/openapi3/openapi.yaml",
"apiDescriptionUrl": "https://raw.githubusercontent.com/APIPatterns/Moostodon/main/spec/tsp-output/%40typespec/openapi3/openapi.yaml",
"auth": {
"clientIdentifier": "some-uuid-here",
"access": [ "resourceA.ReadWrite",
Expand Down
Loading